forked from NVIDIA/CUDALibrarySamples
-
Notifications
You must be signed in to change notification settings - Fork 1
/
block_fft_performance_many.cu
82 lines (64 loc) · 4.08 KB
/
block_fft_performance_many.cu
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#include <iostream>
#include <vector>
#include <chrono>
#include <cmath>
#include "block_fft_performance.hpp"
template<unsigned int Arch,
unsigned int FFTSize,
cufftdx::fft_type FFTType,
class PrecisionType,
cufftdx::fft_direction FFTDirection = cufftdx::fft_direction::forward,
bool UseSuggested = true,
unsigned int ElementsPerThread = 8,
unsigned int FFTsPerBlock = 1>
void block_fft_performance(const cudaStream_t& stream, bool verbose) {
using namespace cufftdx;
using FFT_base = decltype(Block() + Type<FFTType>() + Precision<PrecisionType>() + SM<Arch>());
using FFT_with_direction = typename std::
conditional<FFTType == fft_type::c2c, decltype(FFT_base() + Direction<FFTDirection>()), FFT_base>::type;
benchmark_block_fft<FFT_with_direction, FFTSize, ElementsPerThread, FFTsPerBlock, UseSuggested>(stream, verbose);
if (verbose)
std::cout << std::endl;
}
template<unsigned int Arch>
struct block_fft_performance_functor {
void operator()() {
using namespace cufftdx;
cudaStream_t stream;
CUDA_CHECK_AND_EXIT(cudaStreamCreate(&stream))
bool default_verbose = false;
// To specify EPT and FPB values, set UsedSuggested to false.
// FFTDirection is used if and only if FFTType is C2C.
// Below is an example of a test run with specified EPT and FPB values.
block_fft_performance<Arch, 137, fft_type::c2c, float, fft_direction::forward, false, 8, 1>(stream,
default_verbose);
block_fft_performance<Arch, 137, fft_type::c2c, float>(stream, default_verbose);
block_fft_performance<Arch, 251, fft_type::c2c, float>(stream, default_verbose);
block_fft_performance<Arch, 512, fft_type::c2c, float>(stream, default_verbose);
block_fft_performance<Arch, 1024, fft_type::c2c, float>(stream, default_verbose);
block_fft_performance<Arch, 2048, fft_type::c2c, float>(stream, default_verbose);
block_fft_performance<Arch, 4096, fft_type::c2c, float>(stream, default_verbose);
block_fft_performance<Arch, 137, fft_type::c2c, float, fft_direction::inverse>(stream, default_verbose);
block_fft_performance<Arch, 251, fft_type::c2c, float, fft_direction::inverse>(stream, default_verbose);
block_fft_performance<Arch, 512, fft_type::c2c, float, fft_direction::inverse>(stream, default_verbose);
block_fft_performance<Arch, 1024, fft_type::c2c, float, fft_direction::inverse>(stream, default_verbose);
block_fft_performance<Arch, 2048, fft_type::c2c, float, fft_direction::inverse>(stream, default_verbose);
block_fft_performance<Arch, 4096, fft_type::c2c, float, fft_direction::inverse>(stream, default_verbose);
block_fft_performance<Arch, 137, fft_type::r2c, float>(stream, default_verbose);
block_fft_performance<Arch, 251, fft_type::r2c, float>(stream, default_verbose);
block_fft_performance<Arch, 512, fft_type::r2c, float>(stream, default_verbose);
block_fft_performance<Arch, 1024, fft_type::r2c, float>(stream, default_verbose);
block_fft_performance<Arch, 2048, fft_type::r2c, float>(stream, default_verbose);
block_fft_performance<Arch, 4096, fft_type::r2c, float>(stream, default_verbose);
block_fft_performance<Arch, 137, fft_type::c2r, float>(stream, default_verbose);
block_fft_performance<Arch, 251, fft_type::c2r, float>(stream, default_verbose);
block_fft_performance<Arch, 512, fft_type::c2r, float>(stream, default_verbose);
block_fft_performance<Arch, 1024, fft_type::c2r, float>(stream, default_verbose);
block_fft_performance<Arch, 2048, fft_type::c2r, float>(stream, default_verbose);
block_fft_performance<Arch, 4096, fft_type::c2r, float>(stream, default_verbose);
CUDA_CHECK_AND_EXIT(cudaStreamDestroy(stream));
}
};
int main(int, char**) {
return example::sm_runner<block_fft_performance_functor>();
}