Created
April 8, 2018 13:33
-
-
Save not522/6782112e94749d16353c4d9ec1a8b8ec to your computer and use it in GitHub Desktop.
cuFFT
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
/usr/local/cuda/bin/nvcc fft.cu -I/user/local/cuda/inc -L/usr/local/cuda/lib -lcufft | |
*/ | |
#include <iostream> | |
#include <cufft.h> | |
int main() { | |
int nx = (1 << 26) + 1; | |
cufftHandle plan; | |
cufftComplex *data; | |
cufftResult stat; | |
size_t workSize[1]; | |
cudaMalloc((void**)&data, sizeof(cufftComplex)*nx); | |
cufftCreate(&plan); | |
cufftSetAutoAllocation(plan, false); | |
cudaDeviceSynchronize(); | |
std::cout << "before cufftMakePlan1d" << std::endl; | |
system("nvidia-smi"); | |
stat = cufftMakePlan1d(plan, nx, CUFFT_C2C, 1, workSize); | |
if (stat != CUFFT_SUCCESS) { | |
std::cerr << "CUFFT error: cufftMakePlan1d failed : " << stat << std::endl; | |
return 0; | |
} | |
cudaDeviceSynchronize(); | |
std::cout << "\nafter cufftMakePlan1d" << std::endl; | |
system("nvidia-smi"); | |
cufftDestroy(plan); | |
cudaFree(data); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
before cufftMakePlan1d | |
Sun Apr 8 22:31:34 2018 | |
+-----------------------------------------------------------------------------+ | |
| NVIDIA-SMI 387.34 Driver Version: 387.34 | | |
|-------------------------------+----------------------+----------------------+ | |
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC | | |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. | | |
|===============================+======================+======================| | |
| 0 GeForce GTX 108... Off | 00000000:01:00.0 On | N/A | | |
| 39% 36C P2 59W / 250W | 858MiB / 11169MiB | 0% Default | | |
+-------------------------------+----------------------+----------------------+ | |
+-----------------------------------------------------------------------------+ | |
| Processes: GPU Memory | | |
| GPU PID Type Process name Usage | | |
|=============================================================================| | |
| 0 1158 G /usr/lib/xorg/Xorg 139MiB | | |
| 0 1936 G compiz 41MiB | | |
| 0 2582 C ./a.out 665MiB | | |
+-----------------------------------------------------------------------------+ | |
after cufftMakePlan1d | |
Sun Apr 8 22:31:38 2018 | |
+-----------------------------------------------------------------------------+ | |
| NVIDIA-SMI 387.34 Driver Version: 387.34 | | |
|-------------------------------+----------------------+----------------------+ | |
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC | | |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. | | |
|===============================+======================+======================| | |
| 0 GeForce GTX 108... Off | 00000000:01:00.0 On | N/A | | |
| 39% 36C P2 85W / 250W | 2432MiB / 11169MiB | 92% Default | | |
+-------------------------------+----------------------+----------------------+ | |
+-----------------------------------------------------------------------------+ | |
| Processes: GPU Memory | | |
| GPU PID Type Process name Usage | | |
|=============================================================================| | |
| 0 1158 G /usr/lib/xorg/Xorg 139MiB | | |
| 0 1936 G compiz 41MiB | | |
| 0 2582 C ./a.out 2239MiB | | |
+-----------------------------------------------------------------------------+ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment