Fix GPU RK4 boundary and sync correctness
This commit is contained in:
@@ -83,6 +83,9 @@ struct CachedInterpPlanEntry
|
||||
{
|
||||
bool valid;
|
||||
InterpPlanKey key;
|
||||
vector<double> xvals;
|
||||
vector<double> yvals;
|
||||
vector<double> zvals;
|
||||
CachedInterpPlan plan;
|
||||
|
||||
CachedInterpPlanEntry() : valid(false) {}
|
||||
@@ -286,14 +289,28 @@ CachedInterpPlanEntry &interp_plan_cache_entry()
|
||||
bool same_interp_plan_key(const InterpPlanKey &lhs, const InterpPlanKey &rhs)
|
||||
{
|
||||
return lhs.patch == rhs.patch &&
|
||||
lhs.x == rhs.x &&
|
||||
lhs.y == rhs.y &&
|
||||
lhs.z == rhs.z &&
|
||||
lhs.NN == rhs.NN &&
|
||||
lhs.Symmetry == rhs.Symmetry &&
|
||||
lhs.myrank == rhs.myrank;
|
||||
}
|
||||
|
||||
bool same_interp_plan_points(const CachedInterpPlanEntry &cache, int NN, double **XX)
|
||||
{
|
||||
if (static_cast<int>(cache.xvals.size()) != NN ||
|
||||
static_cast<int>(cache.yvals.size()) != NN ||
|
||||
static_cast<int>(cache.zvals.size()) != NN)
|
||||
return false;
|
||||
|
||||
for (int j = 0; j < NN; ++j)
|
||||
{
|
||||
if (cache.xvals[j] != XX[0][j] ||
|
||||
cache.yvals[j] != XX[1][j] ||
|
||||
cache.zvals[j] != XX[2][j])
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
CachedInterpPlan &get_cached_interp_plan(Patch *patch,
|
||||
int NN, double **XX,
|
||||
int Symmetry, int myrank,
|
||||
@@ -314,11 +331,15 @@ CachedInterpPlan &get_cached_interp_plan(Patch *patch,
|
||||
CachedInterpPlanEntry &cache = interp_plan_cache_entry();
|
||||
if (cache.valid &&
|
||||
same_interp_plan_key(cache.key, key) &&
|
||||
same_interp_plan_points(cache, NN, XX) &&
|
||||
cache.plan.nblocks == static_cast<int>(block_index.views.size()))
|
||||
return cache.plan;
|
||||
|
||||
cache.valid = true;
|
||||
cache.key = key;
|
||||
cache.xvals.assign(XX[0], XX[0] + NN);
|
||||
cache.yvals.assign(XX[1], XX[1] + NN);
|
||||
cache.zvals.assign(XX[2], XX[2] + NN);
|
||||
cache.plan = CachedInterpPlan();
|
||||
CachedInterpPlan &plan = cache.plan;
|
||||
plan.nblocks = static_cast<int>(block_index.views.size());
|
||||
@@ -412,6 +433,9 @@ void release_interp_plan_cache_internal()
|
||||
{
|
||||
CachedInterpPlanEntry &cache = interp_plan_cache_entry();
|
||||
cache.valid = false;
|
||||
cache.xvals.clear();
|
||||
cache.yvals.clear();
|
||||
cache.zvals.clear();
|
||||
cache.plan = CachedInterpPlan();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user