Skip to content

Commit

Permalink
Fixed DR-OpenMP offloading version (#662)
Browse files Browse the repository at this point in the history
Co-authored-by: ravil <ravil.dorozhinskii@tum.de>
  • Loading branch information
ravil-mobile and ravil committed Aug 31, 2022
1 parent 731f2b5 commit 80a266e
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/DynamicRupture/FrictionLaws/FrictionSolverCommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,16 @@ inline void precomputeStressFromQInterpolated(

using namespace dr::misc::quantity_indices;

#ifndef ACL_DEVICE_OFFLOAD
checkAlignmentPreCompute(qIPlus, qIMinus, faultStresses);
#endif

for (unsigned o = 0; o < CONVERGENCE_ORDER; ++o) {
#ifdef ACL_DEVICE_OFFLOAD
#pragma omp loop bind(parallel)
#else
#pragma omp simd
#endif // ACL_DEVICE_OFFLOAD
#endif
for (unsigned i = 0; i < misc::numPaddedPoints; ++i) {
faultStresses.normalStress[o][i] =
etaP * (qIMinus[o][U][i] - qIPlus[o][U][i] + qIPlus[o][N][i] * invZp +
Expand Down Expand Up @@ -174,7 +176,7 @@ inline void postcomputeImposedStateFromNewStress(
// set imposed state to zero
#ifdef ACL_DEVICE_OFFLOAD
#pragma omp loop bind(parallel)
#endif // ACL_DEVICE_OFFLOAD
#endif
for (unsigned int i = 0; i < tensor::QInterpolated::size(); i++) {
imposedStatePlus[i] = static_cast<real>(0.0);
imposedStateMinus[i] = static_cast<real>(0.0);
Expand All @@ -195,8 +197,10 @@ inline void postcomputeImposedStateFromNewStress(

using namespace dr::misc::quantity_indices;

#ifndef ACL_DEVICE_OFFLOAD
checkAlignmentPostCompute(
qIPlus, qIMinus, imposedStateP, imposedStateM, faultStresses, tractionResults);
#endif

for (unsigned o = 0; o < CONVERGENCE_ORDER; ++o) {
auto weight = timeWeights[o];
Expand All @@ -205,7 +209,7 @@ inline void postcomputeImposedStateFromNewStress(
#pragma omp loop bind(parallel)
#else
#pragma omp simd
#endif // ACL_DEVICE_OFFLOAD
#endif
for (unsigned i = 0; i < misc::numPaddedPoints; ++i) {
const auto normalStress = faultStresses.normalStress[o][i];
const auto traction1 = tractionResults.traction1[o][i];
Expand Down Expand Up @@ -248,7 +252,7 @@ inline void saveRuptureFrontOutput(bool ruptureTimePending[misc::numPaddedPoints
#pragma omp loop bind(parallel)
#else
#pragma omp simd
#endif // ACL_DEVICE_OFFLOAD
#endif
for (unsigned pointIndex = 0; pointIndex < misc::numPaddedPoints; pointIndex++) {
constexpr real ruptureFrontThreshold = 0.001;
if (ruptureTimePending[pointIndex] && slipRateMagnitude[pointIndex] > ruptureFrontThreshold) {
Expand All @@ -271,7 +275,7 @@ inline void savePeakSlipRateOutput(real slipRateMagnitude[misc::numPaddedPoints]
#pragma omp loop bind(parallel)
#else
#pragma omp simd
#endif // ACL_DEVICE_OFFLOAD
#endif
for (unsigned pointIndex = 0; pointIndex < misc::numPaddedPoints; pointIndex++) {
peakSlipRate[pointIndex] = std::max(peakSlipRate[pointIndex], slipRateMagnitude[pointIndex]);
}
Expand Down

0 comments on commit 80a266e

Please sign in to comment.