multiply_main.c 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. // See LICENSE for license details.
  2. // *************************************************************************
  3. // multiply filter bencmark
  4. // -------------------------------------------------------------------------
  5. //
  6. // This benchmark tests the software multiply implemenation. The
  7. // input data (and reference data) should be generated using the
  8. // multiply_gendata.pl perl script and dumped to a file named
  9. // dataset1.h You should not change anything except the
  10. // HOST_DEBUG and VERIFY macros for your timing run.
  11. #include "util.h"
  12. #include "multiply.h"
  13. //--------------------------------------------------------------------------
  14. // Input/Reference Data
  15. #include "dataset1.h"
  16. //--------------------------------------------------------------------------
  17. // Main
  18. int main( int argc, char* argv[] )
  19. {
  20. int i;
  21. int results_data[DATA_SIZE];
  22. // Output the input arrays
  23. printArray( "input1", DATA_SIZE, input_data1 );
  24. printArray( "input2", DATA_SIZE, input_data2 );
  25. printArray( "verify", DATA_SIZE, verify_data );
  26. #if PREALLOCATE
  27. for (i = 0; i < DATA_SIZE; i++)
  28. {
  29. results_data[i] = multiply( input_data1[i], input_data2[i] );
  30. }
  31. #endif
  32. setStats(1);
  33. for (i = 0; i < DATA_SIZE; i++)
  34. {
  35. results_data[i] = multiply( input_data1[i], input_data2[i] );
  36. }
  37. setStats(0);
  38. // Print out the results
  39. printArray( "results", DATA_SIZE, results_data );
  40. // Check the results
  41. return verify( DATA_SIZE, results_data, verify_data );
  42. }