Skip to content
Snippets Groups Projects
Commit 87f6e3e5 authored by Jan David Mol's avatar Jan David Mol
Browse files

Task #11547: Tie compute target checks to specific CUDA versions

parent ef9c0890
No related branches found
No related tags found
No related merge requests found
...@@ -53,8 +53,10 @@ namespace LOFAR ...@@ -53,8 +53,10 @@ namespace LOFAR
unsigned major = device.getComputeCapabilityMajor(); unsigned major = device.getComputeCapabilityMajor();
unsigned minor = device.getComputeCapabilityMinor(); unsigned minor = device.getComputeCapabilityMinor();
#if CUDA_VERSION >= 8000 // possibly holds for 6.x and 7.x as well
return (CUjit_target)(major * 10 + minor);
#else
switch (major) { switch (major) {
#ifdef CU_TARGET_COMPUTE_10
case 0: case 0:
return CU_TARGET_COMPUTE_10; return CU_TARGET_COMPUTE_10;
...@@ -71,7 +73,7 @@ namespace LOFAR ...@@ -71,7 +73,7 @@ namespace LOFAR
default: default:
return CU_TARGET_COMPUTE_13; return CU_TARGET_COMPUTE_13;
} }
#endif
case 2: case 2:
switch (minor) { switch (minor) {
case 0: case 0:
...@@ -96,8 +98,8 @@ namespace LOFAR ...@@ -96,8 +98,8 @@ namespace LOFAR
default: default:
return CU_TARGET_COMPUTE_30; return CU_TARGET_COMPUTE_30;
#endif #endif
} }
#endif
} }
// Return the highest compute target supported by all the given devices // Return the highest compute target supported by all the given devices
...@@ -124,11 +126,13 @@ namespace LOFAR ...@@ -124,11 +126,13 @@ namespace LOFAR
// the .cu file is written in). // the .cu file is written in).
string get_virtarch(CUjit_target target) string get_virtarch(CUjit_target target)
{ {
#if CUDA_VERSION >= 8000 // possibly holds for 6.x and 7.x as well
return str(format("compute_%d") % target);
#else
switch (target) { switch (target) {
default: default:
return "compute_unknown"; return "compute_unknown";
#ifdef CU_TARGET_COMPUTE_10
case CU_TARGET_COMPUTE_10: case CU_TARGET_COMPUTE_10:
return "compute_10"; return "compute_10";
...@@ -140,7 +144,6 @@ namespace LOFAR ...@@ -140,7 +144,6 @@ namespace LOFAR
case CU_TARGET_COMPUTE_13: case CU_TARGET_COMPUTE_13:
return "compute_13"; return "compute_13";
#endif
case CU_TARGET_COMPUTE_20: case CU_TARGET_COMPUTE_20:
case CU_TARGET_COMPUTE_21: case CU_TARGET_COMPUTE_21:
...@@ -155,17 +158,20 @@ namespace LOFAR ...@@ -155,17 +158,20 @@ namespace LOFAR
return "compute_35"; return "compute_35";
#endif #endif
} }
#endif
} }
// Translate a compute target to a GPU architecture (= the instruction // Translate a compute target to a GPU architecture (= the instruction
// set supported by the actual GPU). // set supported by the actual GPU).
string get_gpuarch(CUjit_target target) string get_gpuarch(CUjit_target target)
{ {
#if CUDA_VERSION >= 8000 // possibly holds for 6.x and 7.x as well
return str(format("sm_%d") % target);
#else
switch (target) { switch (target) {
default: default:
return "sm_unknown"; return "sm_unknown";
#ifdef CU_TARGET_COMPUTE_10
case CU_TARGET_COMPUTE_10: case CU_TARGET_COMPUTE_10:
return "sm_10"; return "sm_10";
...@@ -177,7 +183,6 @@ namespace LOFAR ...@@ -177,7 +183,6 @@ namespace LOFAR
case CU_TARGET_COMPUTE_13: case CU_TARGET_COMPUTE_13:
return "sm_13"; return "sm_13";
#endif
case CU_TARGET_COMPUTE_20: case CU_TARGET_COMPUTE_20:
return "sm_20"; return "sm_20";
...@@ -193,6 +198,7 @@ namespace LOFAR ...@@ -193,6 +198,7 @@ namespace LOFAR
return "sm_35"; return "sm_35";
#endif #endif
} }
#endif
} }
string lofarRoot() string lofarRoot()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment