From 5049dadc1cb95bc95dbee2ba0a4b1e124ff6bac9 Mon Sep 17 00:00:00 2001 From: jpekkila Date: Thu, 4 Jul 2019 16:31:16 +0300 Subject: [PATCH] Implemented acIntegrateStepWithOffset --- src/core/astaroth.cu | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/core/astaroth.cu b/src/core/astaroth.cu index b6ba82c..e361c90 100644 --- a/src/core/astaroth.cu +++ b/src/core/astaroth.cu @@ -266,14 +266,19 @@ acIntegrateStep(const int& isubstep, const AcReal& dt) AcResult acIntegrateStepWithOffset(const int& isubstep, const AcReal& dt, const int3& start, const int3& end) { - /* - // A skeleton function for computing integrations with arbitrary subblocks - // Uncommenting the following should work with a single GPU. - const int3 start = (int3){NGHOST, NGHOST, NGHOST}; - const int3 end = (int3){NGHOST + subgrid.n.x, NGHOST + subgrid.n.y, - NGHOST + subgrid.n.z}; - */ - rkStep(devices[0], STREAM_PRIMARY, isubstep, start, end, dt); + WARNING("acIntegrateStepWithOffset called. This function has not been tested for correctness!"); + for (int i = 0; i < num_devices; ++i) { + // DECOMPOSITION OFFSET HERE + const int3 d0 = (int3){NGHOST, NGHOST, NGHOST + i * subgrid.n.z}; + const int3 d1 = d0 + (int3){subgrid.n.x, subgrid.n.y, subgrid.n.z}; + + const int3 da = max(start, d0); + const int3 db = min(end, d1); + + if (db.z >= da.z) { + rkStep(devices[i], STREAM_PRIMARY, isubstep, da, db, dt); + } + } return AC_SUCCESS; }