Download testing/unittest/runtime_static_assert.h from camenduru/thrust: direct link, hf CLI and curl.
- Browser
- Download file 2.85 kB
-
https://huggingface.co/camenduru/thrust/resolve/main/testing/unittest/runtime_static_assert.h
- Command line
-
hf download hf://camenduru/thrust/testing/unittest/runtime_static_assert.h
-
curl -L -o runtime_static_assert.h https://huggingface.co/camenduru/thrust/resolve/main/testing/unittest/runtime_static_assert.h
2.85 kB
| namespace unittest | |
| { | |
| __host__ __device__ | |
| void assert_static(bool condition, const char * filename, int lineno); | |
| } | |
| namespace unittest | |
| { | |
| class static_assert_exception | |
| { | |
| public: | |
| __host__ __device__ | |
| static_assert_exception() : triggered(false) | |
| { | |
| } | |
| __host__ __device__ | |
| static_assert_exception(const char * filename, int lineno) | |
| : triggered(true), filename(filename), lineno(lineno) | |
| { | |
| } | |
| bool triggered; | |
| const char * filename; | |
| int lineno; | |
| }; | |
| namespace detail | |
| { | |
| __attribute__((used)) | |
| __device__ static static_assert_exception* device_exception = NULL; | |
| } | |
| __host__ __device__ | |
| void assert_static(bool condition, const char * filename, int lineno) | |
| { | |
| if (!condition) | |
| { | |
| static_assert_exception ex(filename, lineno); | |
| NV_IF_TARGET(NV_IS_DEVICE, | |
| (*detail::device_exception = ex;), | |
| (throw ex;)); | |
| } | |
| } | |
| } | |