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 --- CMakeLists.txt | 2 +- default.nix | 24 ++- lbm.org | 371 +++++++++++++++++++++--------------------- tangle/LLBM/kernel/executor.h | 37 ----- tangle/LLBM/lattice.h | 73 ++++----- tangle/LLBM/materials.h | 2 +- tangle/LLBM/memory.h | 29 ++-- tangle/LLBM/propagate.h | 32 ++-- tangle/benchmark-ldc.cu | 12 +- tangle/channel-with-sphere.cu | 8 +- tangle/ldc-2d.cu | 8 +- tangle/ldc-3d.cu | 8 +- tangle/magnus.cu | 10 +- tangle/nozzle.cu | 8 +- tangle/taylor-couette.cu | 8 +- 15 files changed, 320 insertions(+), 312 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ddd0b47..4c3bcbc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,7 +14,7 @@ set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --expt-relaxed-constexpr --default-stream per-thread --extended-lambda") -set(CMAKE_CUDA_ARCHITECTURES 62) +set(CMAKE_CUDA_ARCHITECTURES 86) include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/tangle diff --git a/default.nix b/default.nix index fccf558..1fd61a1 100644 --- a/default.nix +++ b/default.nix @@ -7,6 +7,23 @@ }, ... }: let + cuda-api-wrappers = pkgs.stdenv.mkDerivation rec { + name = "cuda-api-wrappers"; + version = "0.4.3"; + + src = pkgs.fetchFromGitHub { + owner = "eyalroz"; + repo = "cuda-api-wrappers"; + rev = "v${version}"; + sha256 = "plsjzIeNjgOoJJCbrSVQp7TK30Bh/ka1SWAakYgQR2s="; + }; + + buildInputs = with pkgs; [ + cmake + cudatoolkit_11 + ]; + }; + cuda-samples-common-headers = pkgs.stdenv.mkDerivation rec { name = "cuda-samples-common-headers"; version = "11.1"; @@ -25,7 +42,7 @@ let cp -r $src/Common/* $out/include/cuda-samples/Common ''; }; - + imgui-sfml = pkgs.stdenv.mkDerivation rec { name = "imgui-sfml"; version = "2.1"; @@ -35,7 +52,7 @@ let repo = "imgui-sfml"; rev = "v${version}"; sha256 = "1g8gqly156miv12ajapnhmxfcv9i3fqhdmdy45gmdw47kh8ly5zj"; - }; + }; buildInputs = with pkgs; [ cmake @@ -82,8 +99,9 @@ in pkgs.stdenv.mkDerivation rec { in with pkgs; [ local-python cudatoolkit_11 + cuda-api-wrappers cuda-samples-common-headers - linuxPackages.nvidia_x11 + linuxPackages.nvidia_x11 libGL sfml imgui-sfml diff --git a/lbm.org b/lbm.org index 059a579..168427b 100644 --- a/lbm.org +++ b/lbm.org @@ -16,7 +16,7 @@ to a set of interesting examples. All of this runs on GPUs using CUDA near the m *This document is a [[*Open tasks][work in progress]].* #+BEGIN_EXPORT html -