@@ -335,9 +335,16 @@ void measure_bandwidth_Host2Device2Host(ClImageCopy &Imagecopy,
335
335
std::stringstream Image_dimensions;
336
336
Image_dimensions << Imagecopy.width << " X" << Imagecopy.height << " X"
337
337
<< Imagecopy.depth ;
338
- test_ptree->put (
339
- " Name" , " Host2Device2Host: Bandwidth copying from Host->Device->Host " );
340
- test_ptree->put (" Image size" , Image_dimensions.str ());
338
+ try {
339
+ test_ptree->put (
340
+ " Name" ,
341
+ " Host2Device2Host: Bandwidth copying from Host->Device->Host " );
342
+ test_ptree->put (" Image size" , Image_dimensions.str ());
343
+ } catch (const std::exception &e) {
344
+ std::cerr
345
+ << " Error outputting bandwidth host to device to host measurement: "
346
+ << e.what () << std::endl;
347
+ }
341
348
} else {
342
349
std::cout << " Host2Device2Host: Measuring Bandwidth for copying the "
343
350
" image buffer size "
@@ -348,9 +355,15 @@ void measure_bandwidth_Host2Device2Host(ClImageCopy &Imagecopy,
348
355
Imagecopy.measureHost2Device2Host ();
349
356
350
357
if (Imagecopy.is_json_output_enabled ()) {
351
- test_ptree->put (" GBPS" , Imagecopy.gbps );
352
- if (Imagecopy.data_validation )
353
- test_ptree->put (" Result" , (Imagecopy.validRet ? " PASSED" : " FAILED" ));
358
+ try {
359
+ test_ptree->put (" GBPS" , Imagecopy.gbps );
360
+ if (Imagecopy.data_validation )
361
+ test_ptree->put (" Result" , (Imagecopy.validRet ? " PASSED" : " FAILED" ));
362
+ } catch (const std::exception &e) {
363
+ std::cerr
364
+ << " Error outputting bandwidth host to device to host measurement: "
365
+ << e.what () << std::endl;
366
+ }
354
367
} else {
355
368
if (Imagecopy.data_validation ) {
356
369
std::cout << " Results: Data validation "
@@ -365,8 +378,14 @@ void measure_bandwidth_Host2Device(ClImageCopy &Imagecopy, ptree *test_ptree) {
365
378
std::stringstream Image_dimensions;
366
379
Image_dimensions << Imagecopy.width << " X" << Imagecopy.height << " X"
367
380
<< Imagecopy.depth ;
368
- test_ptree->put (" Name" , " Host2Device: Bandwidth copying from Host->Device" );
369
- test_ptree->put (" Image size" , Image_dimensions.str ());
381
+ try {
382
+ test_ptree->put (" Name" ,
383
+ " Host2Device: Bandwidth copying from Host->Device" );
384
+ test_ptree->put (" Image size" , Image_dimensions.str ());
385
+ } catch (const std::exception &e) {
386
+ std::cerr << " Error outputting bandwidth measurement:" << e.what ()
387
+ << std::endl;
388
+ }
370
389
} else {
371
390
std::cout
372
391
<< " Host2Device: Measuring Bandwidth/Latency for copying the image "
@@ -378,9 +397,14 @@ void measure_bandwidth_Host2Device(ClImageCopy &Imagecopy, ptree *test_ptree) {
378
397
Imagecopy.measureParallelHost2Device ();
379
398
380
399
if (Imagecopy.is_json_output_enabled ()) {
381
- test_ptree->put (" GBPS" , Imagecopy.gbps );
382
- if (Imagecopy.data_validation ) {
383
- test_ptree->put (" Result" , (Imagecopy.validRet ? " PASSED" : " FAILED" ));
400
+ try {
401
+ test_ptree->put (" GBPS" , Imagecopy.gbps );
402
+ if (Imagecopy.data_validation ) {
403
+ test_ptree->put (" Result" , (Imagecopy.validRet ? " PASSED" : " FAILED" ));
404
+ }
405
+ } catch (const std::exception &e) {
406
+ std::cerr << " Error outputting bandwidth measurement:" << e.what ()
407
+ << std::endl;
384
408
}
385
409
} else {
386
410
if (Imagecopy.data_validation ) {
@@ -396,8 +420,14 @@ void measure_bandwidth_Device2Host(ClImageCopy &Imagecopy, ptree *test_ptree) {
396
420
std::stringstream Image_dimensions;
397
421
Image_dimensions << Imagecopy.width << " X" << Imagecopy.height << " X"
398
422
<< Imagecopy.depth ;
399
- test_ptree->put (" Name" , " Device2Host: Bandwidth copying from Device->Host" );
400
- test_ptree->put (" Image size" , Image_dimensions.str ());
423
+ try {
424
+ test_ptree->put (" Name" ,
425
+ " Device2Host: Bandwidth copying from Device->Host" );
426
+ test_ptree->put (" Image size" , Image_dimensions.str ());
427
+ } catch (const std::exception &e) {
428
+ std::cerr << " Error outputting bandwidth measurement:" << e.what ()
429
+ << std::endl;
430
+ }
401
431
} else {
402
432
std::cout
403
433
<< " Device2Host: Measurign Bandwidth/Latency for copying the image "
@@ -409,9 +439,14 @@ void measure_bandwidth_Device2Host(ClImageCopy &Imagecopy, ptree *test_ptree) {
409
439
Imagecopy.measureParallelDevice2Host ();
410
440
411
441
if (Imagecopy.is_json_output_enabled ()) {
412
- test_ptree->put (" GBPS" , Imagecopy.gbps );
413
- if (Imagecopy.data_validation )
414
- test_ptree->put (" Result" , (Imagecopy.validRet ? " PASSED" : " FAILED" ));
442
+ try {
443
+ test_ptree->put (" GBPS" , Imagecopy.gbps );
444
+ if (Imagecopy.data_validation )
445
+ test_ptree->put (" Result" , (Imagecopy.validRet ? " PASSED" : " FAILED" ));
446
+ } catch (const std::exception &e) {
447
+ std::cerr << " Error outputting bandwidth measurement:" << e.what ()
448
+ << std::endl;
449
+ }
415
450
} else {
416
451
if (Imagecopy.data_validation ) {
417
452
std::cout << " Results: Data validation "
@@ -435,9 +470,14 @@ void measure_bandwidth(ClImageCopy &Imagecopy) {
435
470
Imagecopy.param_array .push_back (std::make_pair (" " , ptree_Host2Device2Host));
436
471
Imagecopy.param_array .push_back (std::make_pair (" " , ptree_Host2Device));
437
472
Imagecopy.param_array .push_back (std::make_pair (" " , ptree_Device2Host));
438
- ptree_main.put_child (" Performance Benchmark.bandwidth" ,
439
- Imagecopy.param_array );
440
- pt::write_json (Imagecopy.JsonFileName .c_str (), ptree_main);
473
+ try {
474
+ ptree_main.put_child (" Performance Benchmark.bandwidth" ,
475
+ Imagecopy.param_array );
476
+ pt::write_json (Imagecopy.JsonFileName .c_str (), ptree_main);
477
+ } catch (const std::exception &e) {
478
+ std::cerr << " Error outputting bandwidth measurement:" << e.what ()
479
+ << std::endl;
480
+ }
441
481
}
442
482
}
443
483
@@ -447,14 +487,19 @@ void measure_latency_Host2Device(ClImageCopyLatency &imageCopyLatency,
447
487
std::stringstream Image_dimensions;
448
488
Image_dimensions << imageCopyLatency.width << " X" << imageCopyLatency.height
449
489
<< " X" << imageCopyLatency.depth ;
450
- test_ptree->put (" Name" ,
451
- " Host2Device: Measuring Latency for copying the image " );
452
- test_ptree->put (" Image size" , Image_dimensions.str ());
453
- test_ptree->put (" Image type" , level_zero_tests::to_string (
454
- (cl_uint)imageCopyLatency.clImagetype ));
455
- test_ptree->put (" Image Channel order" ,
456
- level_zero_tests::to_string (
457
- (cl_uint)imageCopyLatency.clImageChannelOrder ));
490
+ try {
491
+ test_ptree->put (" Name" ,
492
+ " Host2Device: Measuring Latency for copying the image " );
493
+ test_ptree->put (" Image size" , Image_dimensions.str ());
494
+ test_ptree->put (" Image type" , level_zero_tests::to_string (
495
+ (cl_uint)imageCopyLatency.clImagetype ));
496
+ test_ptree->put (" Image Channel order" ,
497
+ level_zero_tests::to_string (
498
+ (cl_uint)imageCopyLatency.clImageChannelOrder ));
499
+ } catch (const std::exception &e) {
500
+ std::cerr << " Error outputting latency host to device measurement:"
501
+ << e.what () << std::endl;
502
+ }
458
503
} else {
459
504
std::cout
460
505
<< " Host2Device: Measuring Bandwidth/Latency for copying the image "
@@ -471,10 +516,15 @@ void measure_latency_Host2Device(ClImageCopyLatency &imageCopyLatency,
471
516
imageCopyLatency.measureParallelHost2Device ();
472
517
473
518
if (imageCopyLatency.is_json_output_enabled ()) {
474
- test_ptree->put (" Latency" , imageCopyLatency.latency );
475
- if (imageCopyLatency.data_validation )
476
- test_ptree->put (" Result" ,
477
- (imageCopyLatency.validRet ? " PASSED" : " FAILED" ));
519
+ try {
520
+ test_ptree->put (" Latency" , imageCopyLatency.latency );
521
+ if (imageCopyLatency.data_validation )
522
+ test_ptree->put (" Result" ,
523
+ (imageCopyLatency.validRet ? " PASSED" : " FAILED" ));
524
+ } catch (const std::exception &e) {
525
+ std::cerr << " Error outputting parallel host to device measurement:"
526
+ << e.what () << std::endl;
527
+ }
478
528
}
479
529
}
480
530
@@ -484,14 +534,19 @@ void measure_latency_Device2Host(ClImageCopyLatency &imageCopyLatency,
484
534
std::stringstream Image_dimensions;
485
535
Image_dimensions << imageCopyLatency.width << " X" << imageCopyLatency.height
486
536
<< " X" << imageCopyLatency.depth ;
487
- test_ptree->put (" Name" ,
488
- " Device2Host: Measuring Latency for copying the image" );
489
- test_ptree->put (" Image size" , Image_dimensions.str ());
490
- test_ptree->put (" Image type" , level_zero_tests::to_string (
491
- (cl_uint)imageCopyLatency.clImagetype ));
492
- test_ptree->put (" Image Channel order" ,
493
- level_zero_tests::to_string (
494
- (cl_uint)imageCopyLatency.clImageChannelOrder ));
537
+ try {
538
+ test_ptree->put (" Name" ,
539
+ " Device2Host: Measuring Latency for copying the image" );
540
+ test_ptree->put (" Image size" , Image_dimensions.str ());
541
+ test_ptree->put (" Image type" , level_zero_tests::to_string (
542
+ (cl_uint)imageCopyLatency.clImagetype ));
543
+ test_ptree->put (" Image Channel order" ,
544
+ level_zero_tests::to_string (
545
+ (cl_uint)imageCopyLatency.clImageChannelOrder ));
546
+ } catch (const std::exception &e) {
547
+ std::cerr << " Error outputting latency device to host measurement:"
548
+ << e.what () << std::endl;
549
+ }
495
550
} else {
496
551
std::cout
497
552
<< " Device2Host: Measuring Bandwidth/Latency for copying the image "
@@ -508,10 +563,15 @@ void measure_latency_Device2Host(ClImageCopyLatency &imageCopyLatency,
508
563
imageCopyLatency.measureParallelDevice2Host ();
509
564
510
565
if (imageCopyLatency.is_json_output_enabled ()) {
511
- test_ptree->put (" Latency" , imageCopyLatency.latency );
512
- if (imageCopyLatency.data_validation )
513
- test_ptree->put (" Result" ,
514
- (imageCopyLatency.validRet ? " PASSED" : " FAILED" ));
566
+ try {
567
+ test_ptree->put (" Latency" , imageCopyLatency.latency );
568
+ if (imageCopyLatency.data_validation )
569
+ test_ptree->put (" Result" ,
570
+ (imageCopyLatency.validRet ? " PASSED" : " FAILED" ));
571
+ } catch (const std::exception &e) {
572
+ std::cerr << " Error outputting parallel device to host measurement:"
573
+ << e.what () << std::endl;
574
+ }
515
575
}
516
576
}
517
577
0 commit comments