Skip to content

Commit

Permalink
removed undefined behavior, return to test
Browse files Browse the repository at this point in the history
  • Loading branch information
PrestonH2O committed Aug 10, 2023
1 parent 2ffa7ad commit 617bede
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ jobs:
shell: bash
run: |
make
ctest -V -R CabanaTests
make coverage
# How will we display the results?
# Html files should be created, there are a number of ways to do this
14 changes: 6 additions & 8 deletions test/testCabana.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,16 @@ void testParallelReduceCabana() {
MeshField::MeshField<Ctrl> cabanaMeshField(c);

{
double result, verify;
double result = 0, verify = 0;
auto reduce_kernel = KOKKOS_LAMBDA( const int &i, double& lsum ) {
lsum += i * 1.0;
};
cabanaMeshField.parallel_reduce("CabanaReduceTest1", {0}, {N}, reduce_kernel, result );
for( int i = 0; i < N; i++ ) verify+=i*1.0;
assert( verify == result );
assert(doubleCompare(verify, result));
}
{
double result, verify;
double result = 0, verify = 0;
auto reduce_kernel = KOKKOS_LAMBDA( const int &i, const int& j, double& lsum ) {
lsum += i * j;
};
Expand All @@ -72,7 +72,7 @@ void testParallelReduceCabana() {
verify += i * j;
}
}
assert( verify == result );
assert(doubleCompare(verify, result));
}
{
double result = 0, verify = 0;
Expand All @@ -88,12 +88,10 @@ void testParallelReduceCabana() {
}
}

fprintf(stderr, "verify %.15f result %.15f\n", verify, result);
assert(doubleCompare(verify, result));
assert( verify == result );
}
{
double result, verify;
double result = 0, verify = 0;
auto reduce_kernel = KOKKOS_LAMBDA( const int &i, const int& j, const int& k, const int& l, double& lsum ) {
lsum += i * j * k * l;
};
Expand All @@ -107,7 +105,7 @@ void testParallelReduceCabana() {
}
}
}
assert( verify == result );
assert(doubleCompare(verify, result));
}
printf("== END testParallelReduceCabana ==\n");
}
Expand Down

0 comments on commit 617bede

Please sign in to comment.