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

Function main

src/callback-client/callback-client.cpp:11–65  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9namespace po = boost::program_options;
10
11int main(int argc, char **argv)
12{
13 size_t lengths[ 3 ] = {BATCH_LENGTH,1,1}; //For simplicity, assuming 1D fft with fixed batch length of BATCH_LENGTH
14 cl_uint profile_count = 0;
15 clfftPrecision precision = CLFFT_SINGLE; //Testing for single precision. Easily extendable for double
16
17 size_t batchSize = 1;
18
19 // Initialize flags for FFT library
20 std::auto_ptr< clfftSetupData > setupData( new clfftSetupData );
21 OPENCL_V_THROW( clfftInitSetupData( setupData.get( ) ),
22 "clfftInitSetupData failed" );
23
24 try
25 {
26 // Declare the supported options.
27 po::options_description desc( "clFFT client command line options" );
28 desc.add_options()
29 ( "help,h", "produces this help message" )
30 ( "dumpKernels,d", "FFT engine will dump generated OpenCL FFT kernels to disk (default: dump off)" )
31 ( "batchSize,b", po::value< size_t >( &batchSize )->default_value( 1 ), "If this value is greater than one, arrays will be used " )
32 ( "profile,p", po::value< cl_uint >( &profile_count )->default_value( 10 ), "Time and report the kernel speed of the FFT (default: profiling on)" )
33 ;
34
35 po::variables_map vm;
36 po::store( po::parse_command_line( argc, argv, desc ), vm );
37 po::notify( vm );
38
39 if( vm.count( "help" ) )
40 {
41 std::cout << desc << std::endl;
42 return 0;
43 }
44
45 if( vm.count( "dumpKernels" ) )
46 {
47 setupData->debugFlags |= CLFFT_DUMP_PROGRAMS;
48 }
49
50 clfftDim dim = CLFFT_1D;
51
52 tout << "\nRunning FFT for length " << BATCH_LENGTH << " and batch size " << batchSize << std::endl;
53
54 // Real-Complex cases, SP
55
56 R2C_transform<float>(setupData, lengths, batchSize, dim, precision, profile_count);
57
58 }
59 catch( std::exception& e )
60 {
61 terr << _T( "clFFT error condition reported:" ) << std::endl << e.what() << std::endl;
62 return 1;
63 }
64 return 0;
65}
66
67template < typename T >
68void R2C_transform(std::auto_ptr< clfftSetupData > setupData, size_t* inlengths, size_t batchSize,

Callers

nothing calls this directly

Calls 1

clfftInitSetupDataFunction · 0.85

Tested by

no test coverage detected