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

Fix mesh tester example and add tests #1142

Merged
merged 7 commits into from
Jul 21, 2023
Merged

Conversation

bmhan12
Copy link
Contributor

@bmhan12 bmhan12 commented Jul 19, 2023

This PR:

@bmhan12 bmhan12 added the Testing Issues related to testing Axom label Jul 19, 2023
@bmhan12 bmhan12 force-pushed the bugfix/han12/debug_mesh_tester branch from c1e8492 to f1421f2 Compare July 19, 2023 23:01
Copy link
Member

@rhornung67 rhornung67 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @bmhan12

@agcapps
Copy link
Member

agcapps commented Jul 20, 2023

Thanks for the fixes, @bmhan12 . I see you test RAJA_FOUND. I think we may also want to test && AXOM_USE_RAJA to allow a user to manually turn off RAJA for Axom even though it's there. Thoughts?

Copy link
Member

@agcapps agcapps left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved, but perhaps we also want to test against AXOM_USE_RAJA.

@rhornung67
Copy link
Member

@agcapps doesn't RAJA_FOUND imply that AXOM_USE_RAJA is true/defined?

@bmhan12
Copy link
Contributor Author

bmhan12 commented Jul 20, 2023

I think we may also want to test && AXOM_USE_RAJA to allow a user to manually turn off RAJA for Axom even though it's there. Thoughts?

Hm, this might make things confusing, at least in terms of separation of defines for source code (AXOM_USE_XXX), and ones for CMake (XXX_FOUND , ENABLE_XXX, AXOM_ENABLE_XXX).

In these cases AXOM_USE_RAJA is not currently defined for CMake, so the checks fail.

@bmhan12
Copy link
Contributor Author

bmhan12 commented Jul 20, 2023

doesn't RAJA_FOUND imply that AXOM_USE_RAJA is true/defined?

Yes, relevant CMake configuration:

## Add a definition to the generated config file for each library dependency
## (optional and built-in) that we might need to know about in the code. We
## check for vars of the form <DEP>_FOUND or ENABLE_<DEP>
set(TPL_DEPS C2C CAMP CLI11 CONDUIT CUDA FMT HIP HDF5 LUA MFEM MPI OPENMP RAJA SCR SOL SPARSEHASH UMPIRE )
foreach(dep ${TPL_DEPS})
if( ${dep}_FOUND OR ENABLE_${dep} )
set(AXOM_USE_${dep} TRUE )
endif()
endforeach()

@rhornung67
Copy link
Member

@bmhan12 I looks like we use AXOM_USE_RAJA in the source code, but RAJA_FOUND in the CMakeLists.txt files. So I think what you have done makes sense. @agcapps do you agree? We should confirm with @white238

@agcapps
Copy link
Member

agcapps commented Jul 20, 2023

@agcapps doesn't RAJA_FOUND imply that AXOM_USE_RAJA is true/defined?

OK, so in https://github.com/LLNL/axom/blob/develop/src/cmake/AxomConfig.cmake#L16-L21, AXOM_USE_RAJA gets set if RAJA_FOUND is true or the user passed in ENABLE_RAJA. Looking at source code, header and source files seem to test AXOM_USE_RAJA, but CMakeLists.txt files (which is what you're working on, Brian) seem to test RAJA_FOUND.

Looks like you are doing the right thing. Sorry for the noise.

@rhornung67
Copy link
Member

rhornung67 commented Jul 20, 2023

An occasional round of confusion is cleansing.... 😄

Copy link
Member

@kennyweiss kennyweiss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @bmhan12 !

Comment on lines 220 to 233
axom::for_all<ExecSpace>(
curr_lvl_count,
AXOM_LAMBDA(axom::IndexType i) {
out[next_lvl + i * lvl_factor + 0] =
new_inscribed_prism(out[curr_lvl + i], Q, T, S, R, pa, pb);
out[next_lvl + i * lvl_factor + 1] =
new_inscribed_prism(out[curr_lvl + i], U, R, Q, P, pa, pb);
OctType *out_ptr = out.data();
out_ptr[next_lvl + i * lvl_factor + 0] =
new_inscribed_prism(out_ptr[curr_lvl + i], Q, T, S, R, pa, pb);
out_ptr[next_lvl + i * lvl_factor + 1] =
new_inscribed_prism(out_ptr[curr_lvl + i], U, R, Q, P, pa, pb);
if(level == 0)
{
out[next_lvl + i * lvl_factor + 2] =
new_inscribed_prism(out[curr_lvl + i], S, P, U, T, pa, pb);
out_ptr[next_lvl + i * lvl_factor + 2] =
new_inscribed_prism(out_ptr[curr_lvl + i], S, P, U, T, pa, pb);
}
});
Copy link
Member

@kennyweiss kennyweiss Jul 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm surprised it's necessary to grab a pointer to out, via out.ptr() before changing values in the array.
That's not how we'd want to have to use ArrayView.

Would it help if we add the mutable keyword? E.g.

AXOM_LAMBDA(axom::IndexType i) mutable {
    out[ <some_index> ] = new_inscribed_prism(out[ <other_index> ], <params> );
    ...
}

We do that in a few places in axom, e.g.:

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kennyweiss Thanks! mutable works here!

Comment on lines 73 to 103
# Add unit tests
if(AXOM_ENABLE_TESTS AND AXOM_DATA_DIR AND RAJA_FOUND AND UMPIRE_FOUND)

# Run the mesh_tester with the plane_simp_problems.stl example and
# different spatial indexes, raja policies

set(plane_data_dir ${AXOM_DATA_DIR}/quest/plane_simp_problems.stl)

set(_methods "bvh" "implicit" "uniform")

set (_policies "raja_seq")
blt_list_append(TO _policies ELEMENTS "raja_omp" IF AXOM_ENABLE_OPENMP)
blt_list_append(TO _policies ELEMENTS "raja_cuda" IF AXOM_ENABLE_CUDA)

foreach(_method ${_methods})
foreach(_policy ${_policies})

set(_testname "mesh_tester_${_method}_${_policy}")
axom_add_test(
NAME ${_testname}
COMMAND mesh_tester
--infile ${plane_data_dir}
--method ${_method}
--policy ${_policy}
)

set_tests_properties(${_testname} PROPERTIES
PASS_REGULAR_EXPRESSION "5 intersecting tri pairs")
endforeach()
endforeach()
endif()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

src/tools/CMakeLists.txt Outdated Show resolved Hide resolved
Co-authored-by: Chris White <white238@llnl.gov>
@bmhan12 bmhan12 merged commit a3000a3 into develop Jul 21, 2023
10 checks passed
@bmhan12 bmhan12 deleted the bugfix/han12/debug_mesh_tester branch July 21, 2023 20:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Testing Issues related to testing Axom
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants