diff --git a/source/dcompute/driver/cuda/runtime.d b/source/dcompute/driver/cuda/runtime.d index 9dce1b3..4fcbf9f 100644 --- a/source/dcompute/driver/cuda/runtime.d +++ b/source/dcompute/driver/cuda/runtime.d @@ -38,7 +38,9 @@ private static bool _threadReady = false; // safety-net flag // in module-dependency order. No locking needed here. shared static this() { - _initPlatform(); + if (__dcompute_reflect(ReflectTarget.CUDA,0)) { + _initPlatform(); + } } // Per-thread init: thread-local static constructor @@ -46,7 +48,9 @@ shared static this() // that thread begins. For the main thread it runs after shared static this(). static this() { - _initThread(); + if (__dcompute_reflect(ReflectTarget.CUDA,0)) { + _initThread(); + } } // Public API diff --git a/source/dcompute/tests/main.d b/source/dcompute/tests/main.d index 271c213..c32d33d 100644 --- a/source/dcompute/tests/main.d +++ b/source/dcompute/tests/main.d @@ -18,13 +18,14 @@ import std.typecons; import std.conv : to; import std.math.traits : isNaN; -import dcompute.driver.cuda.unified_buffer; import dcompute.tests.dummykernels : saxpy; version(DComputeTestOpenCL) import dcompute.driver.ocl; -else version(DComputeTestCUDA) +else version(DComputeTestCUDA) { + import dcompute.driver.cuda.unified_buffer; import dcompute.driver.cuda; +} else static assert(false, "Need to test something!");