From 32dd41a728ce10113032e20955ba08f8de449857 Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Sun, 12 Sep 2021 14:01:55 +0200 Subject: Start using C++ cuda-api-wrapper instead of raw CUDA --- tangle/ldc-3d.cu | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'tangle/ldc-3d.cu') diff --git a/tangle/ldc-3d.cu b/tangle/ldc-3d.cu index e9b42f2..c70b12e 100644 --- a/tangle/ldc-3d.cu +++ b/tangle/ldc-3d.cu @@ -15,7 +15,11 @@ using T = float; using DESCRIPTOR = descriptor::D3Q19; int main() { -cudaSetDevice(0); +if (cuda::device::count() == 0) { + std::cerr << "No CUDA devices on this system" << std::endl; + return -1; +} +auto current = cuda::device::current::get(); const descriptor::Cuboid cuboid(100, 100, 100); Lattice lattice(cuboid); @@ -34,7 +38,7 @@ auto bulk_mask = materials.mask_of_material(1); auto wall_mask = materials.mask_of_material(2); auto lid_mask = materials.mask_of_material(3); -cudaDeviceSynchronize(); +cuda::synchronize(current); auto none = [] __device__ (float3) -> float { return 1; }; VolumetricExample renderer(cuboid); -- cgit v1.2.3