Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use double precision for stdpar and avoid division by zero in RelDiff computation #25

Open
wants to merge 1 commit into
base: 2.0.2-dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion stdpar/src/lulesh-util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ void VerifyAndWriteFinalOutput(Real_t elapsed_time,

if (MaxAbsDiff <AbsDiff) MaxAbsDiff = AbsDiff;

Real_t RelDiff = AbsDiff / locDom.e(k*nx+j);
Real_t RelDiff = FABS(locDom.e(k*nx+j)) > 1e-8 ? AbsDiff / locDom.e(k*nx+j) : 0.0;

if (MaxRelDiff <RelDiff) MaxRelDiff = RelDiff;
}
Expand Down
2 changes: 1 addition & 1 deletion stdpar/src/lulesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ typedef long double real10 ; // 10 bytes on x86
typedef int32_t Int4_t ;
typedef int64_t Int8_t ;
typedef Int4_t Index_t ; // array subscript and loop index
typedef real4 Real_t ; // floating point representation
typedef real8 Real_t ; // floating point representation
typedef Int4_t Int_t ; // integer representation

enum { VolumeError = -1, QStopError = -2 } ;
Expand Down