Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update support for CUDA arch in CMake and convertSMVer2Cores #4748

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmake/pcl_find_cuda.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ if(CUDA_FOUND)
# https://docs.nvidia.com/cuda/cuda-toolkit-release-notes/index.html#deprecated-features

if(NOT ${CUDA_VERSION_STRING} VERSION_LESS "11.0")
set(__cuda_arch_bin "3.5 3.7 5.0 5.2 5.3 6.0 6.1 6.2 7.0 7.2 7.5 8.0")
set(__cuda_arch_bin "3.5 3.7 5.0 5.2 5.3 6.0 6.1 6.2 7.0 7.2 7.5 8.0 8.6")
elseif(NOT ${CUDA_VERSION_STRING} VERSION_LESS "10.0")
set(__cuda_arch_bin "3.0 3.2 3.5 3.7 5.0 5.2 5.3 6.0 6.1 6.2 7.0 7.2 7.5")
elseif(NOT ${CUDA_VERSION_STRING} VERSION_LESS "9.0")
Expand Down
19 changes: 9 additions & 10 deletions gpu/containers/src/initialization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@

#include "cuda.h"
#include <cstdio>
#include <array> // replace c-style array with std::array

#define HAVE_CUDA
//#include <pcl_config.h>
Expand Down Expand Up @@ -115,16 +116,14 @@ namespace
int Cores;
};

SMtoCores gpuArchCoresPerSM[] = {
{0x10, 8}, {0x11, 8}, {0x12, 8}, {0x13, 8}, {0x20, 32}, {0x21, 48}, {0x30, 192},
{0x35, 192}, {0x50, 128}, {0x52, 128}, {0x53, 128}, {0x60, 64}, {0x61, 128}, {-1, -1}
};
int index = 0;
while (gpuArchCoresPerSM[index].SM != -1)
{
if (gpuArchCoresPerSM[index].SM == ((major << 4) + minor) )
return gpuArchCoresPerSM[index].Cores;
index++;
std::array<SMtoCores, 15> gpuArchCoresPerSM = {{
{0x30, 192}, {0x32, 192}, {0x35, 192}, {0x37, 192}, {0x50, 128}, {0x52, 128},
{0x53, 128}, {0x60, 64}, {0x61, 128}, {0x62, 128}, {0x70, 64}, {0x72, 64},
{0x75, 64}, {0x80, 64}, {0x86, 128}
}};
for (const auto& sm2cores : gpuArchCoresPerSM) {
if (sm2cores.SM == ((major << 4) + minor) )
return sm2cores.Cores;
}
printf("\nCan't determine number of cores. Unknown SM version %d.%d!\n", major, minor);
return 0;
Expand Down