voxcraft / voxcraft-sim

a GPU-accelerated voxel-based physics engine
Creative Commons Zero v1.0 Universal
43 stars 10 forks source link

Is there a way to automatically determine the architecture of the GPU? #7

Closed liusida closed 4 years ago

liusida commented 4 years ago

Modify the instances of "compute_70" and "sm_70" in the CMakeLists.txt file to your compute capability represented as an integer. For example if you had a 6.1 GPU you would have a compute capability of 61. To figure out your compute capability see Wikipedia's CUDA

Can this be done automatically? It is not neat to change this every time when I clone a new repo.

liusida commented 4 years ago

In CMake, CUDA_SELECT_NVCC_ARCH_FLAGS(ARCH_FLAGS) can do the detection.

How ever, on DeepGreen, one needs to compile with at least one GPU allocated. otherwise, the detection will fail. Because this function is basically calling CUDA's function cudaGetDeviceCount and cudaGetDeviceProperties to get the architecture version.

so if you saw:

-- Automatic GPU detection failed. Building for common architectures.
-- Autodetected CUDA architecture(s): 3.0;3.5;5.0;5.2;6.0;6.1;7.0;7.0+PTX;7.5;7.5+PTX

while doing cmake .., please allocate some GPU first.

liusida commented 4 years ago

https://github.com/voxcraft/voxcraft-sim/commit/d87367bf3320130fff4c62230fe454130339ba2e