| 432 | } |
| 433 | |
| 434 | void |
| 435 | clsparseDeviceTimer::Print( cl_ulong flopCount, std::string unit ) |
| 436 | { |
| 437 | const int tableWidth = 60; |
| 438 | const int tableHalf = tableWidth / 2; |
| 439 | const int tableThird = tableWidth / 3; |
| 440 | const int tableFourth = tableWidth / 4; |
| 441 | const int tableFifth = tableWidth / 5; |
| 442 | |
| 443 | for( cl_uint id = 0; id < labelID.size( ); ++id ) |
| 444 | { |
| 445 | size_t halfString = labelID[ id ].first.size( ) / 2; |
| 446 | |
| 447 | // Print label of timer, in a header |
| 448 | std::cout << std::endl << std::setw( tableHalf + halfString ) << std::setfill( '=' ) << labelID[ id ].first |
| 449 | << std::setw( tableHalf - halfString ) << "=" << std::endl; |
| 450 | std::cout << std::setfill( ' ' ); |
| 451 | |
| 452 | std::vector< StatData > mean = getMean( id ); |
| 453 | |
| 454 | // Print each individual dimension |
| 455 | std::stringstream catLengths; |
| 456 | for( cl_uint t = 0; t < mean.size( ); ++t ) |
| 457 | { |
| 458 | cl_double time = mean[ t ].doubleNanoSec; |
| 459 | cl_double gFlops = flopCount / time; |
| 460 | |
| 461 | if( mean[ t ].outEvents.size( ) != 0 ) |
| 462 | { |
| 463 | std::cout << std::setw( tableFourth ) << "OutEvents:" << std::setw( tableThird ); |
| 464 | for( size_t i = 0; i < mean[ t ].outEvents.size( ); ++i ) |
| 465 | { |
| 466 | std::cout << mean[ t ].outEvents[ i ]( ); |
| 467 | if( i < ( mean[ t ].outEvents.size( ) - 1 ) ) |
| 468 | { |
| 469 | std::cout << "," << std::endl; |
| 470 | std::cout << std::setw( tableFourth + tableThird ); |
| 471 | } |
| 472 | } |
| 473 | std::cout << std::endl; |
| 474 | } |
| 475 | |
| 476 | |
| 477 | std::cout << std::setw( tableFourth ) << unit << ":" |
| 478 | << std::setw( 2 * tableFourth ) << gFlops << std::endl; |
| 479 | std::cout << std::setw( tableFourth ) << "Time (ns):" |
| 480 | << std::setw( 3 * tableFourth ) << commatize( static_cast<cl_ulong>( time ) ) << std::endl; |
| 481 | std::cout << std::endl; |
| 482 | } |
| 483 | } |
| 484 | } |
| 485 | |
| 486 | // Defining an output print operator |
| 487 | std::ostream& |