aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Kummerlaender2019-11-04 23:50:41 +0100
committerAdrian Kummerlaender2019-11-04 23:50:41 +0100
commit8285173fa9c69de72020962506eb080a49be0ce5 (patch)
treecee30fbe66f690d8cc0d89458d8122fc82bff111
parentb708361bf722b2c19f47699ceb931c6efeb8c9d9 (diff)
downloadboltzgen_examples-8285173fa9c69de72020962506eb080a49be0ce5.tar
boltzgen_examples-8285173fa9c69de72020962506eb080a49be0ce5.tar.gz
boltzgen_examples-8285173fa9c69de72020962506eb080a49be0ce5.tar.bz2
boltzgen_examples-8285173fa9c69de72020962506eb080a49be0ce5.tar.lz
boltzgen_examples-8285173fa9c69de72020962506eb080a49be0ce5.tar.xz
boltzgen_examples-8285173fa9c69de72020962506eb080a49be0ce5.tar.zst
boltzgen_examples-8285173fa9c69de72020962506eb080a49be0ce5.zip
Adapt to upstream changes
-rw-r--r--lid_driven_cavity/cpp/ldc.cpp.mako2
-rw-r--r--lid_driven_cavity/opencl/ldc_2d.py13
-rw-r--r--lid_driven_cavity/opencl/simulation.py6
-rw-r--r--shell.nix4
4 files changed, 14 insertions, 11 deletions
diff --git a/lid_driven_cavity/cpp/ldc.cpp.mako b/lid_driven_cavity/cpp/ldc.cpp.mako
index 5d480de..c66679f 100644
--- a/lid_driven_cavity/cpp/ldc.cpp.mako
+++ b/lid_driven_cavity/cpp/ldc.cpp.mako
@@ -132,8 +132,10 @@ void simulate(std::size_t nStep)
std::cout << "#steps : " << nStep << std::endl;
std::cout << std::endl;
+#pragma omp parallel for
for (std::size_t iCell = 0; iCell < ${geometry.volume}; ++iCell) {
equilibrilize(f_prev, f_next, iCell);
+ equilibrilize(f_next, f_prev, iCell);
}
const auto start = std::chrono::high_resolution_clock::now();
diff --git a/lid_driven_cavity/opencl/ldc_2d.py b/lid_driven_cavity/opencl/ldc_2d.py
index 755ace0..c080284 100644
--- a/lid_driven_cavity/opencl/ldc_2d.py
+++ b/lid_driven_cavity/opencl/ldc_2d.py
@@ -48,18 +48,19 @@ generator = Generator(
kernel_src = generator.kernel(geometry, functions, extras)
kernel_src += generator.custom(geometry, """
-__kernel void equilibrilize(__global ${float_type}* f_next,
- __global ${float_type}* f_prev)
+__kernel void equilibrilize_all(__global ${float_type}* f_next,
+ __global ${float_type}* f_prev)
{
const unsigned int gid = ${index.gid('get_global_id(0)', 'get_global_id(1)')};
- equilibrilize_gid(f_next, f_prev, gid);
+ equilibrilize(f_next, f_prev, gid);
+ equilibrilize(f_prev, f_next, gid);
}
-__kernel void collect_moments(__global ${float_type}* f,
- __global ${float_type}* moments)
+__kernel void collect_moments_all(__global ${float_type}* f,
+ __global ${float_type}* moments)
{
const unsigned int gid = ${index.gid('get_global_id(0)', 'get_global_id(1)')};
- collect_moments_gid(f, moments, gid);
+ collect_moments(f, gid, moments);
}
""")
diff --git a/lid_driven_cavity/opencl/simulation.py b/lid_driven_cavity/opencl/simulation.py
index 7625609..37aab5b 100644
--- a/lid_driven_cavity/opencl/simulation.py
+++ b/lid_driven_cavity/opencl/simulation.py
@@ -66,7 +66,7 @@ class Lattice:
self.build_kernel(kernel_src)
- self.program.equilibrilize(
+ self.program.equilibrilize_all(
self.queue, self.geometry.size(), self.layout, self.memory.cl_pop_a, self.memory.cl_pop_b).wait()
self.tasks = []
@@ -94,10 +94,10 @@ class Lattice:
moments = numpy.ndarray(shape=(self.memory.volume*(self.descriptor.d+1),1), dtype=self.float_type[0])
if self.tick:
- self.program.collect_moments(
+ self.program.collect_moments_all(
self.queue, self.geometry.size(), self.layout, self.memory.cl_pop_b, self.memory.cl_moments)
else:
- self.program.collect_moments(
+ self.program.collect_moments_all(
self.queue, self.geometry.size(), self.layout, self.memory.cl_pop_a, self.memory.cl_moments)
cl.enqueue_copy(self.queue, moments, self.memory.cl_moments).wait();
diff --git a/shell.nix b/shell.nix
index b229e2e..8bdf2e5 100644
--- a/shell.nix
+++ b/shell.nix
@@ -12,8 +12,8 @@ pkgs.stdenvNoCC.mkDerivation rec {
src = pkgs.fetchFromGitHub {
owner = "KnairdA";
repo = "boltzgen";
- rev = "v0.1.2";
- sha256 = "1amsp45iq36vn63x7xqzj498hr5k9c4yj40wjccylwp9m2w14s8f";
+ rev = "78f5edec8151db38ebf933e915fcca5f65b1cad5";
+ sha256 = "1cyp5b5v8r24ih2dxhjhlp7frnqlwzslah2pzfi745f3ii370r42";
};
propagatedBuildInputs = with pkgs.python37Packages; [