acIntegrateStepWithOffset corrected and confirmed to work on 1-4 GPUs

This commit is contained in:
jpekkila
2019-07-04 16:58:24 +03:00
parent 01437411b6
commit d1a93b7d4e

View File

@@ -254,7 +254,6 @@ acStore(AcMesh* host_mesh)
AcResult AcResult
acIntegrateStepWithOffset(const int& isubstep, const AcReal& dt, const int3& start, const int3& end) acIntegrateStepWithOffset(const int& isubstep, const AcReal& dt, const int3& start, const int3& end)
{ {
WARNING("acIntegrateStepWithOffset called. This function has not been tested for correctness!");
for (int i = 0; i < num_devices; ++i) { for (int i = 0; i < num_devices; ++i) {
// DECOMPOSITION OFFSET HERE // DECOMPOSITION OFFSET HERE
// Same naming here (d0, d1, da, db) as in acLoadWithOffset // Same naming here (d0, d1, da, db) as in acLoadWithOffset
@@ -265,7 +264,9 @@ acIntegrateStepWithOffset(const int& isubstep, const AcReal& dt, const int3& sta
const int3 db = min(end, d1); const int3 db = min(end, d1);
if (db.z >= da.z) { if (db.z >= da.z) {
rkStep(devices[i], STREAM_PRIMARY, isubstep, da, db, dt); const int3 da_local = da - (int3){0, 0, i * subgrid.n.z};
const int3 db_local = db - (int3){0, 0, i * subgrid.n.z};
rkStep(devices[i], STREAM_PRIMARY, isubstep, da_local, db_local, dt);
} }
} }
return AC_SUCCESS; return AC_SUCCESS;
@@ -275,12 +276,7 @@ AcResult
acIntegrateStep(const int& isubstep, const AcReal& dt) acIntegrateStep(const int& isubstep, const AcReal& dt)
{ {
const int3 start = (int3){NGHOST, NGHOST, NGHOST}; const int3 start = (int3){NGHOST, NGHOST, NGHOST};
const int3 end = start + subgrid.n; const int3 end = start + grid.n;
/* Deprecated block, TODO remove when acIntegrateStepWithOffset confirmed to work
for (int i = 0; i < num_devices; ++i) {
rkStep(devices[i], STREAM_PRIMARY, isubstep, start, end, dt);
}
*/
acIntegrateStepWithOffset(isubstep, dt, start, end); acIntegrateStepWithOffset(isubstep, dt, start, end);
return AC_SUCCESS; return AC_SUCCESS;