| 82 | } |
| 83 | |
| 84 | double calcFlops( ) |
| 85 | { |
| 86 | size_t fftLength = 0; |
| 87 | size_t dimIndex = 0; |
| 88 | |
| 89 | if( dim == CLFFT_1D ) |
| 90 | { |
| 91 | fftLength = lengths.at( 0 ); |
| 92 | dimIndex = 1; |
| 93 | } |
| 94 | else if( dim == CLFFT_2D ) |
| 95 | { |
| 96 | fftLength = lengths.at( 0 ) * lengths.at( 1 ); |
| 97 | dimIndex = 2; |
| 98 | } |
| 99 | else if( dim == CLFFT_3D ) |
| 100 | { |
| 101 | fftLength = lengths.at( 0 ) * lengths.at( 1 ) * lengths.at( 2 ); |
| 102 | dimIndex = 3; |
| 103 | } |
| 104 | |
| 105 | size_t cumulativeBatch = 1; |
| 106 | for( ; dimIndex < lengths.size(); ++dimIndex ) |
| 107 | { |
| 108 | cumulativeBatch *= std::max< size_t >( 1, lengths[ dimIndex ] ); |
| 109 | } |
| 110 | cumulativeBatch *= batchSize; |
| 111 | |
| 112 | double flops = cumulativeBatch * 5 * fftLength * ( log( static_cast< double >( fftLength ) ) / log( 2.0 ) ); |
| 113 | |
| 114 | return flops; |
| 115 | } |
| 116 | |
| 117 | }; |
| 118 | |