Skip to content

Commit

Permalink
Add static_assert when sm_arch mismatches TCNN_MIN_GPU_ARCH
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom94 committed Feb 22, 2022
1 parent ef26ff4 commit f32361e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions include/tiny-cuda-nn/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,10 @@ class ScopeGuard {
#define TCNN_HOST
#endif

#if defined(__CUDA_ARCH__)
static_assert(__CUDA_ARCH__ >= MIN_GPU_ARCH * 10, "MIN_GPU_ARCH=" STR(TCNN_MIN_GPU_ARCH) "0 must bound __CUDA_ARCH__=" STR(__CUDA_ARCH__) " from below, but doesn't.");
#endif

template <typename T>
TCNN_HOST_DEVICE T clamp(T val, T lower, T upper) {
return val < lower ? lower : (upper < val ? upper : val);
Expand Down

0 comments on commit f32361e

Please sign in to comment.