aboutsummaryrefslogtreecommitdiff
path: root/shell.nix
diff options
context:
space:
mode:
authorAdrian Kummerlaender2019-10-28 23:07:44 +0100
committerAdrian Kummerlaender2019-10-28 23:08:39 +0100
commit42f4ae5f67f17ff37b3e95cab3c905668816eee8 (patch)
treedc8e69680d876d00ea739ccedfda83325e1ce24f /shell.nix
downloadboltzgen_examples-42f4ae5f67f17ff37b3e95cab3c905668816eee8.tar
boltzgen_examples-42f4ae5f67f17ff37b3e95cab3c905668816eee8.tar.gz
boltzgen_examples-42f4ae5f67f17ff37b3e95cab3c905668816eee8.tar.bz2
boltzgen_examples-42f4ae5f67f17ff37b3e95cab3c905668816eee8.tar.lz
boltzgen_examples-42f4ae5f67f17ff37b3e95cab3c905668816eee8.tar.xz
boltzgen_examples-42f4ae5f67f17ff37b3e95cab3c905668816eee8.tar.zst
boltzgen_examples-42f4ae5f67f17ff37b3e95cab3c905668816eee8.zip
Basic 2D LDC using boltzgen for kernel generation
Using cell lists as parameters for multiple non-branching kernels seems to reduce performance by ~50 MLUPS (for single precision D2Q9). This might be alleviated by padding the cell lists to enable thread layout control or by improved kernel dispatching. On the upside this OpenCL program runs not only on GPUs but is also vectorized on Intel CPUs yielding about 180 MLUPS (single precision) and - anticlimactically - 85 MLUPS for double precision on a i7-4790K. However both these values compare well to the performance of established CPU LBM codes.
Diffstat (limited to 'shell.nix')
-rw-r--r--shell.nix43
1 files changed, 43 insertions, 0 deletions
diff --git a/shell.nix b/shell.nix
new file mode 100644
index 0000000..99d794b
--- /dev/null
+++ b/shell.nix
@@ -0,0 +1,43 @@
+{ pkgs ? import <nixpkgs> { }, ... }:
+
+pkgs.stdenvNoCC.mkDerivation rec {
+ name = "pycl-env";
+ env = pkgs.buildEnv { name = name; paths = buildInputs; };
+
+ buildInputs = let
+ boltzgen = pkgs.python3.pkgs.buildPythonPackage rec {
+ pname = "boltzgen";
+ version = "0.1";
+
+ src = pkgs.fetchFromGitHub {
+ owner = "KnairdA";
+ repo = "boltzgen";
+ rev = "v0.1";
+ sha256 = "072kx4jrzd0g9rn63hjb0yic7qhbga47lp2vbz7rq3gvkqv1hz4d";
+ };
+
+ propagatedBuildInputs = with pkgs.python37Packages; [
+ sympy
+ numpy
+ Mako
+ ];
+ };
+
+ local-python = pkgs.python3.withPackages (python-packages: with python-packages; [
+ boltzgen
+ numpy
+ pyopencl setuptools
+ matplotlib
+ ]);
+
+ in [
+ local-python
+ pkgs.opencl-info
+ ];
+
+ shellHook = ''
+ export NIX_SHELL_NAME="${name}"
+ export PYOPENCL_COMPILER_OUTPUT=1
+ export PYTHONPATH="$PWD:$PYTHONPATH"
+ '';
+}