Created
July 28, 2020 15:52
-
-
Save shadiakiki1986/e2e4612ec62da3e53b639631da7dd43a to your computer and use it in GitHub Desktop.
show gpu devices with CUDA C++
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
// from https://github.com/FBerendsen/niftireg/blob/fc526c152fd5eaced271d1d6de7c16661b2abd3e/reg-lib/cuda/checkCudaCard.cpp | |
// | |
// rm test | |
// g++ -I/usr/local/cuda/include -L/usr/local/cuda/lib64 -lcuda test.cpp # undefined reference to cudaGetDeviceCount | |
// PATH=$PATH:/usr/local/cuda/bin/ | |
// nvcc -x cu test.cpp --std=c++11 -lineinfo -o test | |
#include <cuda_runtime.h> | |
//#include <cuda.h> | |
//#include <stdio.h> | |
#include <iostream> | |
int main() { | |
int deviceCount = 0; | |
cudaGetDeviceCount(&deviceCount); | |
std::cout<<"Devices: "<<deviceCount<<std::endl; | |
return 1; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment