MCPcopy Create free account
hub / github.com/clMathLibraries/clFFT / main

Function main

src/tests/gtest_main.cpp:67–288  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65bool comparison_type = root_mean_square;
66
67int main( int argc, char **argv )
68{
69 // Define MEMORYREPORT on windows platfroms to enable debug memory heap checking
70#if defined( MEMORYREPORT ) && defined( _WIN32 )
71 TCHAR logPath[ MAX_PATH ];
72 ::GetCurrentDirectory( MAX_PATH, logPath );
73 ::_tcscat_s( logPath, _T( "\\MemoryReport.txt") );
74
75 // We leak the handle to this file, on purpose, so that the ::_CrtSetReportFile() can output it's memory
76 // statistics on app shutdown
77 HANDLE hLogFile;
78 hLogFile = ::CreateFile( logPath, GENERIC_WRITE,
79 FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL );
80
81 ::_CrtSetReportMode( _CRT_ASSERT, _CRTDBG_MODE_FILE | _CRTDBG_MODE_WNDW | _CRTDBG_MODE_DEBUG );
82 ::_CrtSetReportMode( _CRT_ERROR, _CRTDBG_MODE_FILE | _CRTDBG_MODE_WNDW | _CRTDBG_MODE_DEBUG );
83 ::_CrtSetReportMode( _CRT_WARN, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG );
84
85 ::_CrtSetReportFile( _CRT_ASSERT, hLogFile );
86 ::_CrtSetReportFile( _CRT_ERROR, hLogFile );
87 ::_CrtSetReportFile( _CRT_WARN, hLogFile );
88
89 int tmp = ::_CrtSetDbgFlag( _CRTDBG_REPORT_FLAG );
90 tmp |= _CRTDBG_LEAK_CHECK_DF | _CRTDBG_ALLOC_MEM_DF | _CRTDBG_CHECK_ALWAYS_DF;
91 ::_CrtSetDbgFlag( tmp );
92
93 // By looking at the memory leak report that is generated by this debug heap, there is a number with
94 // {} brackets that indicates the incremental allocation number of that block. If you wish to set
95 // a breakpoint on that allocation number, put it in the _CrtSetBreakAlloc() call below, and the heap
96 // will issue a bp on the request, allowing you to look at the call stack
97 // ::_CrtSetBreakAlloc( 997 );
98
99#endif /* MEMORYREPORT */
100
101 // Declare the supported options.
102 po::options_description desc( "clFFT Runtime Test command line options" );
103 desc.add_options()
104 ( "help,h", "produces this help message" )
105 ( "verbose,v", "print out detailed information for the tests" )
106 ( "noVersion", "Don't print version information from the clFFT library" )
107 ( "noInfoCL", "Don't print information from the OpenCL runtime" )
108 ( "cpu,c", "Run tests on a CPU device" )
109 ( "gpu,g", "Run tests on a GPU device" )
110 ( "all,a", "Run tests on any device type (default)" )
111 ( "platform", po::value< cl_int >( &g_platform_id )->default_value( 0 ), "Select a specific OpenCL platform id as it is reported by clinfo" )
112 ( "device", po::value< cl_int >( &g_device_id )->default_value( 0 ), "Select a specific OpenCL device id as it is reported by clinfo" )
113 ( "pointwise,p", "Do a pointwise comparison to determine test correctness (default: use root mean square)" )
114 ( "tolerance,t", po::value< float >( &tolerance )->default_value( 0.001f ), "tolerance level to use when determining test pass/fail" )
115 ( "numRandom,r", po::value< size_t >( &number_of_random_tests )->default_value( 2000 ), "number of random tests to run" )
116 ( "seed", po::value< time_t >( &random_test_parameter_seed )->default_value( time(NULL)%1308000000 ),
117 "seed to use for the random test. defaults to time(NULL)" )
118 // modulo lops off the first few digits of the time value to make the seed easier to type
119 // even without these digits, the seed value won't wrap around until 2036 or later
120 ( "short,s", "Run radix 2 tests; no random testing" )
121 ( "medium,m", "Run all radices; no random testing" )
122 ;
123
124 // this rmse_tolerance is not absolute; it is for a 4096-point single precision transform

Callers

nothing calls this directly

Calls 4

clfftGetVersionFunction · 0.85
sizeMethod · 0.80
initializeCLFunction · 0.50
cleanupCLFunction · 0.50

Tested by

no test coverage detected