Changeset f03209d3
- Timestamp:
- Jan 5, 2021, 5:51:30 PM (4 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 4468a70, 587a608
- Parents:
- ed1a6374
- Location:
- benchmark/readyQ
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
benchmark/readyQ/locality.cfa
red1a6374 rf03209d3 184 184 unsigned wsize = 2; 185 185 unsigned wcnt = 2; 186 unsigned nspots = 0; 186 187 bool share = false; 187 188 cfa_option opt[] = { 188 189 BENCH_OPT, 190 { 'n', "nspots", "Number of spots where threads sleep (nthreads - nspots are active at the same time)", nspots}, 189 191 { 'w', "worksize", "Size of the array for each threads, in words (64bit)", wsize}, 190 192 { 'c', "workcnt" , "Number of words to touch when working (random pick, cells can be picked more than once)", wcnt }, … … 196 198 unsigned long long global_gmigs = 0; 197 199 unsigned long long global_dmigs = 0; 200 201 if( nspots == 0 ) { nspots = nthreads - nprocs; } 198 202 199 203 Time start, end; … … 205 209 } 206 210 207 MySpot * spots[n threads - nprocs];208 for(i; n threads - nprocs) {211 MySpot * spots[nspots]; 212 for(i; nspots) { 209 213 spots[i] = malloc(); 210 214 (*spots[i]){ i }; … … 220 224 data_arrays[i], 221 225 spots, 222 n threads - nprocs,226 nspots, 223 227 wcnt, 224 228 share, … … 258 262 } 259 263 260 for(i; n threads - nprocs) {264 for(i; nspots) { 261 265 ^( *spots[i] ){}; 262 266 free( spots[i] ); -
benchmark/readyQ/locality.cpp
red1a6374 rf03209d3 201 201 202 202 void thread_main( MyCtx & ctx ) { 203 uint64_t state ;203 uint64_t state = ctx.id; 204 204 205 205 // Wait for start … … 237 237 unsigned wsize = 2; 238 238 unsigned wcnt = 2; 239 unsigned nspots = 0; 239 240 bool share = false; 240 241 option_t opt[] = { 241 242 BENCH_OPT, 243 { 'n', "nspots", "Number of spots where threads sleep (nthreads - nspots are active at the same time)", nspots}, 242 244 { 'w', "worksize", "Size of the array for each threads, in words (64bit)", wsize}, 243 245 { 'c', "workcnt" , "Number of words to touch when working (random pick, cells can be picked more than once)", wcnt }, … … 252 254 unsigned long long global_gmigs = 0; 253 255 unsigned long long global_dmigs = 0; 256 257 if( nspots == 0 ) { nspots = nthreads - nprocs; } 254 258 255 259 uint64_t start, end; … … 261 265 } 262 266 263 MySpot * spots[n threads - nprocs];264 for( size_t i = 0; i < (nthreads - nprocs); i++) {267 MySpot * spots[nspots]; 268 for(unsigned i = 0; i < nspots; i++) { 265 269 spots[i] = new MySpot{ i }; 266 270 } 267 271 268 threads_left = nthreads ;272 threads_left = nthreads - nspots; 269 273 Fibre * threads[nthreads]; 270 274 MyCtx * thddata[nthreads]; … … 274 278 data_arrays[i], 275 279 spots, 276 n threads - nprocs,280 nspots, 277 281 wcnt, 278 282 share, … … 307 311 } 308 312 309 for(size_t i = 0; i < (nthreads - nprocs); i++) {313 for(size_t i = 0; i < nspots; i++) { 310 314 delete( spots[i] ); 311 315 } … … 315 319 printf("Number of processors : %'d\n", nprocs); 316 320 printf("Number of threads : %'d\n", nthreads); 317 printf(" Total Operations(ops) : %'15llu\n", global_count);321 printf("Number of spots : %'d\n", nspots); 318 322 printf("Work size (64bit words): %'15u\n", wsize); 319 323 printf("Total Operations(ops) : %'15llu\n", global_count); 320 324 printf("Total G Migrations : %'15llu\n", global_gmigs); 321 325 printf("Total D Migrations : %'15llu\n", global_dmigs); 322 printf("Ops per second : %'18.2lf\n", ((double)global_count) / to_fseconds(end - start));323 printf("ns per ops : %'18.2lf\n", ((double)(end - start)) / global_count);324 printf("Ops per threads : %'15llu\n", global_count / nthreads);325 printf("Ops per procs : %'15llu\n", global_count / nprocs);326 printf("Ops/sec/procs : %'18.2lf\n", (((double)global_count) / nprocs) / to_fseconds(end - start));327 printf("ns per ops/procs : %'18.2lf\n", ((double)(end - start)) / (global_count / nprocs));326 printf("Ops per second : %'18.2lf\n", ((double)global_count) / to_fseconds(end - start)); 327 printf("ns per ops : %'18.2lf\n", ((double)(end - start)) / global_count); 328 printf("Ops per threads : %'15llu\n", global_count / nthreads); 329 printf("Ops per procs : %'15llu\n", global_count / nprocs); 330 printf("Ops/sec/procs : %'18.2lf\n", (((double)global_count) / nprocs) / to_fseconds(end - start)); 331 printf("ns per ops/procs : %'18.2lf\n", ((double)(end - start)) / (global_count / nprocs)); 328 332 fflush(stdout); 329 333 } -
benchmark/readyQ/locality.go
red1a6374 rf03209d3 221 221 func main() { 222 222 // Benchmark specific command line arguments 223 nspotsOpt := flag.Int ("n", 0 , "Number of spots where threads sleep (nthreads - nspots are active at the same time)") 223 224 work_sizeOpt := flag.Uint64("w", 2 , "Size of the array for each threads, in words (64bit)") 224 225 countOpt := flag.Uint64("c", 2 , "Number of words to touch when working (random pick, cells can be picked more than once)") … … 229 230 230 231 // Eval command line arguments 232 nspots:= *nspotsOpt 231 233 size := *work_sizeOpt 232 234 cnt := *countOpt 233 235 share := *shareOpt 236 237 if nspots == 0 { nspots = nthreads - nprocs; } 234 238 235 239 // Check params … … 241 245 // Make global data 242 246 barrierStart := make(chan struct{}) // Barrier used at the start 243 threads_left = int64(n procs) // Counter for active threads (not 'nthreads' because at all times 'nthreads - nprocs' are blocked)247 threads_left = int64(nthreads - nspots) // Counter for active threads (not 'nthreads' because at all times 'nthreads - nprocs' are blocked) 244 248 result := make(chan Result) // Channel for results 245 channels := make([]Spot, n threads - nprocs) // Number of spots249 channels := make([]Spot, nspots) // Number of spots 246 250 for i := range channels { 247 251 channels[i] = Spot{[16]uint64{0},uintptr(0), i,[16]uint64{0}} // init spots -
benchmark/readyQ/locality.rs
red1a6374 rf03209d3 257 257 let options = App::new("Locality Tokio") 258 258 .args(&bench::args()) 259 .arg(Arg::with_name("size") .short("w").long("worksize").takes_value(true).default_value("2").help("Size of the array for each threads, in words (64bit)")) 260 .arg(Arg::with_name("work") .short("c").long("workcnt") .takes_value(true).default_value("2").help("Number of words to touch when working (random pick, cells can be picked more than once)")) 261 .arg(Arg::with_name("share").short("s").long("share") .takes_value(true).default_value("true").help("Pass the work data to the next thread when blocking")) 259 .arg(Arg::with_name("nspots").short("n").long("nspots") .takes_value(true).default_value("0").help("Number of spots where threads sleep (nthreads - nspots are active at the same time)")) 260 .arg(Arg::with_name("size") .short("w").long("worksize").takes_value(true).default_value("2").help("Size of the array for each threads, in words (64bit)")) 261 .arg(Arg::with_name("work") .short("c").long("workcnt") .takes_value(true).default_value("2").help("Number of words to touch when working (random pick, cells can be picked more than once)")) 262 .arg(Arg::with_name("share") .short("s").long("share") .takes_value(true).default_value("true").help("Pass the work data to the next thread when blocking")) 262 263 .get_matches(); 263 264 … … 267 268 let wcnt = options.value_of("work").unwrap().parse::<u64>().unwrap(); 268 269 let share = options.value_of("share").unwrap().parse::<bool>().unwrap(); 270 let nspots = { 271 let val = options.value_of("nspots").unwrap().parse::<usize>().unwrap(); 272 if val != 0 { 273 val 274 } else { 275 nthreads - nprocs 276 } 277 }; 269 278 270 279 // Check params … … 282 291 283 292 let mut data_arrays : Vec<MyData> = (0..nthreads).map(|i| MyData::new(i, wsize)).rev().collect(); 284 let spots : Arc<Vec<MySpot>> = Arc::new((0..n threads - nprocs).map(|i| MySpot::new(i)).rev().collect());293 let spots : Arc<Vec<MySpot>> = Arc::new((0..nspots).map(|i| MySpot::new(i)).rev().collect()); 285 294 let barr = Arc::new(sync::Barrier::new(nthreads + 1)); 286 295
Note: See TracChangeset
for help on using the changeset viewer.