Skip to content

Commit

Permalink
Add signedVolume() to Polyhedron class, add intel oneAPI config (#1186)
Browse files Browse the repository at this point in the history
  • Loading branch information
bmhan12 committed Sep 19, 2023
1 parent 80889b6 commit 9a25422
Show file tree
Hide file tree
Showing 23 changed files with 342 additions and 142 deletions.
5 changes: 5 additions & 0 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ The Axom project release numbers follow [Semantic Versioning](http://semver.org/
- `DistributedClosestPoint::computeClosestPoints`
- `MarchingCubes::MarchingCubes`
- `MarchingCubesSingleDomain::MarchingCubesSingleDomain`
- Primal: `Polyhedron::volume()` function changed from returning a signed
volume to an unsigned volume. The added `Polyhedron::signedVolume()` function
returns the signed volume.
- Primal: `intersection_volume()` operators changed from returning a signed
volume to an unsigned volume.

### Fixed
- quest's `SamplingShaper` now properly handles material names containing underscores
Expand Down
110 changes: 110 additions & 0 deletions host-configs/rzwhippet-toss_4_x86_64_ib-intel@2022.1.0.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
#------------------------------------------------------------------------------
# !!!! This is a generated file, edit at own risk !!!!
#------------------------------------------------------------------------------
# CMake executable path: /usr/tce/bin/cmake
#------------------------------------------------------------------------------

set(CMAKE_PREFIX_PATH "/usr/WS1/axom/libs/toss_4_x86_64_ib/2023_08_30_10_09_12/intel-2022.1.0/umpire-2023.06.0-6wmifjy5c2er4kkfqw7m5s4in7esiln5;/usr/WS1/axom/libs/toss_4_x86_64_ib/2023_08_30_10_09_12/intel-2022.1.0/raja-2023.06.0-urtfojwbjummyvyev7k4zn2oix53f4up;/usr/WS1/axom/libs/toss_4_x86_64_ib/2023_08_30_10_09_12/intel-2022.1.0/camp-2023.06.0-ovewmmz43udq34jrdlokh2zuzgkzrum4;/usr/WS1/axom/libs/toss_4_x86_64_ib/2023_08_30_10_09_12/intel-2022.1.0/mfem-4.5.2-dbvjel6jhwnwf6wzm76w6ghbjpy3v4gj;/usr/WS1/axom/libs/toss_4_x86_64_ib/2023_08_30_10_09_12/intel-2022.1.0/hypre-2.24.0-qdjyl5ibcpl4nxb6t5godfgvi5bb6hac;/usr/WS1/axom/libs/toss_4_x86_64_ib/2023_08_30_10_09_12/intel-2022.1.0/conduit-0.8.8-22refnw4twba4zznewcuczky2udimj7i;/usr/WS1/axom/libs/toss_4_x86_64_ib/2023_08_30_10_09_12/intel-2022.1.0/parmetis-4.0.3-nqxoj5gqogj32hfo5ognkcb6vg24zdlc;/usr/WS1/axom/libs/toss_4_x86_64_ib/2023_08_30_10_09_12/intel-2022.1.0/metis-5.1.0-tb5bijmooj2d6d2npjpajcj4fyu4yd4y;/usr/WS1/axom/libs/toss_4_x86_64_ib/2023_08_30_10_09_12/intel-2022.1.0/hdf5-1.8.22-6oeginq7kyyix35utjgsfxeghcnujtpg;/usr/WS1/axom/libs/toss_4_x86_64_ib/2023_08_30_10_09_12/intel-2022.1.0/c2c-1.8.0-gvlftgplgmtput3k4fy2nssecldmmlsa;/usr/WS1/axom/libs/toss_4_x86_64_ib/2023_08_30_10_09_12/intel-2022.1.0/gmake-4.4.1-e3r4ry6vgi7zp4mbwfokypkutqwpctek;/usr/WS1/axom/libs/toss_4_x86_64_ib/2023_08_30_10_09_12/intel-2022.1.0/blt-0.5.3-i7qltms7ksyz4xltznzbtsafywrykq7b;/collab/usr/gapps/axom/devtools/toss_4_x86_64_ib/latest/python-3.10.10;/collab/usr/gapps/axom/devtools/toss_4_x86_64_ib/latest/python-3.10.10;/collab/usr/gapps/axom/devtools/toss_4_x86_64_ib/latest/python-3.10.10;/collab/usr/gapps/axom/devtools/toss_4_x86_64_ib/latest/llvm-10.0.0;/collab/usr/gapps/axom/devtools/toss_4_x86_64_ib/latest/doxygen-1.8.14;/collab/usr/gapps/axom/devtools/toss_4_x86_64_ib/latest/cppcheck-2.9;/usr/tce/packages/mvapich2/mvapich2-2.3.6-intel-2022.1.0;/usr/tce" CACHE PATH "")

set(CMAKE_BUILD_TYPE "Release" CACHE STRING "")

#------------------------------------------------------------------------------
# Compilers
#------------------------------------------------------------------------------
# Compiler Spec: intel@=2022.1.0
#------------------------------------------------------------------------------
if(DEFINED ENV{SPACK_CC})

set(CMAKE_C_COMPILER "/usr/WS1/axom/libs/toss_4_x86_64_ib/2023_08_30_10_09_12/spack/lib/spack/env/intel/icc" CACHE PATH "")

set(CMAKE_CXX_COMPILER "/usr/WS1/axom/libs/toss_4_x86_64_ib/2023_08_30_10_09_12/spack/lib/spack/env/intel/icpc" CACHE PATH "")

set(CMAKE_Fortran_COMPILER "/usr/WS1/axom/libs/toss_4_x86_64_ib/2023_08_30_10_09_12/spack/lib/spack/env/intel/ifort" CACHE PATH "")

else()

set(CMAKE_C_COMPILER "/usr/tce/packages/intel/intel-2022.1.0/compiler/2022.1.0/linux/bin/icx" CACHE PATH "")

set(CMAKE_CXX_COMPILER "/usr/tce/packages/intel/intel-2022.1.0/compiler/2022.1.0/linux/bin/icpx" CACHE PATH "")

set(CMAKE_Fortran_COMPILER "/usr/tce/packages/intel/intel-2022.1.0/compiler/2022.1.0/linux/bin/ifx" CACHE PATH "")

endif()

set(CMAKE_GENERATOR "Unix Makefiles" CACHE STRING "")

set(ENABLE_FORTRAN ON CACHE BOOL "")

#------------------------------------------------------------------------------
# MPI
#------------------------------------------------------------------------------

set(MPI_C_COMPILER "/usr/tce/packages/mvapich2/mvapich2-2.3.6-intel-2022.1.0/bin/mpicc" CACHE PATH "")

set(MPI_CXX_COMPILER "/usr/tce/packages/mvapich2/mvapich2-2.3.6-intel-2022.1.0/bin/mpicxx" CACHE PATH "")

set(MPI_Fortran_COMPILER "/usr/tce/packages/mvapich2/mvapich2-2.3.6-intel-2022.1.0/bin/mpif90" CACHE PATH "")

set(MPIEXEC_NUMPROC_FLAG "-n" CACHE STRING "")

set(ENABLE_MPI ON CACHE BOOL "")

set(MPIEXEC_EXECUTABLE "/usr/bin/srun" CACHE PATH "")

#------------------------------------------------------------------------------
# Hardware
#------------------------------------------------------------------------------

#------------------------------------------------
# Hardware Specifics
#------------------------------------------------

set(ENABLE_OPENMP ON CACHE BOOL "")

set(ENABLE_GTEST_DEATH_TESTS ON CACHE BOOL "")

#------------------------------------------------------------------------------
# TPLs
#------------------------------------------------------------------------------

set(TPL_ROOT "/usr/WS1/axom/libs/toss_4_x86_64_ib/2023_08_30_10_09_12/intel-2022.1.0" CACHE PATH "")

set(CONDUIT_DIR "${TPL_ROOT}/conduit-0.8.8-22refnw4twba4zznewcuczky2udimj7i" CACHE PATH "")

set(C2C_DIR "${TPL_ROOT}/c2c-1.8.0-gvlftgplgmtput3k4fy2nssecldmmlsa" CACHE PATH "")

set(MFEM_DIR "${TPL_ROOT}/mfem-4.5.2-dbvjel6jhwnwf6wzm76w6ghbjpy3v4gj" CACHE PATH "")

set(HDF5_DIR "${TPL_ROOT}/hdf5-1.8.22-6oeginq7kyyix35utjgsfxeghcnujtpg" CACHE PATH "")

set(LUA_DIR "/usr" CACHE PATH "")

set(RAJA_DIR "${TPL_ROOT}/raja-2023.06.0-urtfojwbjummyvyev7k4zn2oix53f4up" CACHE PATH "")

set(UMPIRE_DIR "${TPL_ROOT}/umpire-2023.06.0-6wmifjy5c2er4kkfqw7m5s4in7esiln5" CACHE PATH "")

set(CAMP_DIR "${TPL_ROOT}/camp-2023.06.0-ovewmmz43udq34jrdlokh2zuzgkzrum4" CACHE PATH "")

# scr not built

#------------------------------------------------------------------------------
# Devtools
#------------------------------------------------------------------------------

set(DEVTOOLS_ROOT "/collab/usr/gapps/axom/devtools/toss_4_x86_64_ib/2023_05_18_11_52_05/._view/btoxy5ovdbouub2brzxcmjwzdhvzatlc" CACHE PATH "")

set(CLANGFORMAT_EXECUTABLE "/collab/usr/gapps/axom/devtools/toss_4_x86_64_ib/latest/llvm-10.0.0/bin/clang-format" CACHE PATH "")

set(PYTHON_EXECUTABLE "${DEVTOOLS_ROOT}/python-3.10.10/bin/python3.10" CACHE PATH "")

set(ENABLE_DOCS ON CACHE BOOL "")

set(SPHINX_EXECUTABLE "${DEVTOOLS_ROOT}/python-3.10.10/bin/sphinx-build" CACHE PATH "")

set(SHROUD_EXECUTABLE "${DEVTOOLS_ROOT}/python-3.10.10/bin/shroud" CACHE PATH "")

set(CPPCHECK_EXECUTABLE "${DEVTOOLS_ROOT}/cppcheck-2.9/bin/cppcheck" CACHE PATH "")

set(DOXYGEN_EXECUTABLE "${DEVTOOLS_ROOT}/doxygen-1.8.14/bin/doxygen" CACHE PATH "")


4 changes: 2 additions & 2 deletions scripts/azure-pipelines/linux-build_and_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ if [[ "$DO_BUILD" == "yes" ]] ; then
or_die cd build-$HOST_CONFIG-${BUILD_TYPE,,}
echo "~~~~~~ BUILDING ~~~~~~~~"
if [[ ${CMAKE_EXTRA_FLAGS} == *COVERAGE* ]] ; then
or_die make -j 10
or_die make -j 8
else
or_die make -j 10 VERBOSE=1
or_die make -j 8 VERBOSE=1
fi
if [[ "${DO_TEST}" == "yes" ]] ; then
echo "~~~~~~ RUNNING TESTS ~~~~~~~~"
Expand Down
15 changes: 15 additions & 0 deletions scripts/spack/configs/toss_4_x86_64_ib/spack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,19 @@ spack:
fc: /usr/tce/packages/gcc/gcc-10.3.1/bin/gfortran
spec: gcc@10.3.1
target: x86_64
- compiler:
environment: {}
extra_rpaths: []
flags: {}
modules: []
operating_system: rhel8
paths:
cc: /usr/tce/packages/intel/intel-2022.1.0/compiler/2022.1.0/linux/bin/icx
cxx: /usr/tce/packages/intel/intel-2022.1.0/compiler/2022.1.0/linux/bin/icpx
f77: /usr/tce/packages/intel/intel-2022.1.0/compiler/2022.1.0/linux/bin/ifx
fc: /usr/tce/packages/intel/intel-2022.1.0/compiler/2022.1.0/linux/bin/ifx
spec: intel@2022.1.0
target: x86_64

packages:
all:
Expand Down Expand Up @@ -86,6 +99,8 @@ spack:
prefix: /usr/tce/packages/mvapich2/mvapich2-2.3.6-clang-14.0.6
- spec: mvapich2@2.3.6%gcc@10.3.1 process_managers=slurm arch=linux-rhel8-ivybridge
prefix: /usr/tce/packages/mvapich2/mvapich2-2.3.6-gcc-10.3.1
- spec: mvapich2@2.3.6%intel@2022.1.0 process_managers=slurm arch=linux-rhel8-ivybridge
prefix: /usr/tce/packages/mvapich2/mvapich2-2.3.6-intel-2022.1.0

netlib-lapack:
buildable: false
Expand Down
3 changes: 2 additions & 1 deletion scripts/spack/specs.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@

"toss_4_x86_64_ib":
[ "gcc@10.3.1+devtools+hdf5+mfem+c2c",
"clang@14.0.6+devtools+hdf5+mfem+c2c" ],
"clang@14.0.6+devtools+hdf5+mfem+c2c",
"intel@2022.1.0+devtools+hdf5+mfem+c2c" ],

"__comment__":"# Use amdgpu_target=gfx90a for tioga/rzvernal; and gfx908 for rznevada",
"__comment__":"# -Wno-int-conversion flag needed for building HDF5",
Expand Down
66 changes: 30 additions & 36 deletions src/axom/primal/geometry/Polyhedron.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -501,16 +501,18 @@ class Polyhedron
}

/*!
* \brief Finds the volume of the polyhedron.
* \brief Computes the signed volume of the polyhedron.
*
* \return The volume of the polyhedron
* \return The signed volume of the polyhedron
*
* \note Function is based off moments() in Mike Owen's PolyClipper.
*
* \pre polyhedron vertex neighbors are defined, and polyhedron is 3D
*
* \sa volume()
*/
AXOM_HOST_DEVICE
double volume() const
double signedVolume() const
{
double retVol = 0.0;

Expand All @@ -519,13 +521,13 @@ class Polyhedron
return retVol;
}

// Finds the volume of tetrahedrons formed from vertices of the Polyhedron
// faces and an arbitrary origin (the first vertex)
// Computes the signed volume of tetrahedra formed from vertices of the
// Polyhedron faces and an arbitrary origin (the first vertex)
else
{
SLIC_CHECK_MSG(
hasNeighbors(),
"Polyhedron::volume() is only valid with vertex neighbors.");
"Polyhedron::signedVolume() is only valid with vertex neighbors.");

// faces is an overestimation
int faces[MAX_VERTS * MAX_VERTS];
Expand Down Expand Up @@ -555,6 +557,13 @@ class Polyhedron
return retVol / 6.;
}

/*!
* \brief Returns the absolute (unsigned) volume of the polyhedron
* \sa signedVolume()
*/
AXOM_HOST_DEVICE
double volume() const { return axom::utilities::abs(signedVolume()); }

/*!
* \brief Simple formatted print of a polyhedron instance
*
Expand Down Expand Up @@ -661,9 +670,9 @@ class Polyhedron
* \brief Creates a Polyhedron from a given Hexahedron's vertices.
*
* \param [in] hex The hexahedron
* \param [in] checkSign If true (default is false), checks the volume of the
* Polyhedron is positive. If volume is negative, order of some
* vertices will be swapped.
* \param [in] checkSign If true (default is false), checks if the
* signed volume of the Polyhedron is positive. If signed volume
* is negative, order of some vertices will be swapped.
*
* \return A Polyhedron with the Hexahedron's vertices and added
* vertex neighbors
Expand Down Expand Up @@ -714,10 +723,10 @@ class Polyhedron
poly.addNeighbors(6, {2, 7, 5});
poly.addNeighbors(7, {3, 4, 6});

// Reverses order of vertices 1,3 and 5,7 if volume is negative
// Reverses order of vertices 1,3 and 5,7 if signed volume is negative
if(checkSign)
{
if(poly.volume() < 0)
if(poly.signedVolume() < 0)
{
axom::utilities::swap<Point<T, NDIMS>>(poly[1], poly[3]);
axom::utilities::swap<Point<T, NDIMS>>(poly[5], poly[7]);
Expand All @@ -731,9 +740,9 @@ class Polyhedron
* \brief Creates a Polyhedron from a given Octahedron's vertices.
*
* \param [in] oct The octahedron
* \param [in] checkSign If true (default is false), checks the volume of the
* Polyhedron is positive. If volume is negative, order of some
* vertices will be swapped.
* \param [in] checkSign If true (default is false), checks if the
* signed volume of the Polyhedron is positive. If signed volume
* is negative, order of some vertices will be swapped.
*
* \return A Polyhedron with the Octahedron's vertices and added
* vertex neighbors
Expand Down Expand Up @@ -781,27 +790,12 @@ class Polyhedron
poly.addNeighbors(5, {0, 1, 3, 4});

// Reverses order of vertices 1,2 and 4,5 if volume is negative.
// Expanded swap operations for HIP workaround.
if(checkSign)
{
double vol = poly.volume();
if(vol < 0)
if(poly.signedVolume() < 0)
{
PointType p2({poly[4][0], poly[4][1], poly[4][2]});
poly[4][0] = poly[5][0];
poly[4][1] = poly[5][1];
poly[4][2] = poly[5][2];
poly[5][0] = p2[0];
poly[5][1] = p2[1];
poly[5][2] = p2[2];

PointType p1({poly[1][0], poly[1][1], poly[1][2]});
poly[1][0] = poly[2][0];
poly[1][1] = poly[2][1];
poly[1][2] = poly[2][2];
poly[2][0] = p1[0];
poly[2][1] = p1[1];
poly[2][2] = p1[2];
axom::utilities::swap<PointType>(poly[1], poly[2]);
axom::utilities::swap<PointType>(poly[4], poly[5]);
}
}

Expand All @@ -812,9 +806,9 @@ class Polyhedron
* \brief Creates a Polyhedron from a given Tetrahedron's vertices.
*
* \param [in] tet The tetrahedron
* \param [in] checkSign If true (default is false), checks the volume of the
* Polyhedron is positive. If volume is negative, order of some
* vertices will be swapped.
* \param [in] checkSign If true (default is false), checks if the
* signed volume of the Polyhedron is positive. If signed volume
* is negative, order of some vertices will be swapped.
*
* \return A Polyhedron with the Tetrahedron's vertices and added
* vertex neighbors
Expand Down Expand Up @@ -858,7 +852,7 @@ class Polyhedron
poly.addNeighbors(2, {0, 3, 1});
poly.addNeighbors(3, {0, 1, 2});

// Reverses order of vertices 1 and 2 if volume is negative
// Reverses order of vertices 1 and 2 if signed volume is negative
if(checkSign)
{
if(tet.signedVolume() < 0)
Expand Down
35 changes: 20 additions & 15 deletions src/axom/primal/operators/clip.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,10 @@ Polygon<T, 3> clip(const Triangle<T, 3>& tri, const BoundingBox<T, 3>& bbox)
* \param [in] hex The hexahedron to clip
* \param [in] tet The tetrahedron to clip against
* \param [in] eps The epsilon value
* \param [in] checkSign If true (default is false), checks the volume of the
* shapes are positive. If volume is negative, order of some
* vertices will be swapped.
* \param [in] checkSign If true (default is false), checks if the
* signed volume of each shape is positive. If the signed volume
* of that shape is negative, order of some vertices will be
* swapped for that shape.
*
* \return A polyhedron of the hexahedron clipped against the tetrahedron.
*
Expand Down Expand Up @@ -157,9 +158,10 @@ AXOM_HOST_DEVICE Polyhedron<T, 3> clip(const Hexahedron<T, 3>& hex,
* \param [in] tet The tetrahedron to clip against
* \param [in] hex The hexahedron to clip
* \param [in] eps The epsilon value
* \param [in] checkSign If true (default is false), checks the volume of the
* shapes are positive. If volume is negative, order of some
* vertices will be swapped.
* \param [in] checkSign If true (default is false), checks if the
* signed volume of each shape is positive. If the signed volume
* of that shape is negative, order of some vertices will be
* swapped for that shape.
*
* \return A polyhedron of the hexahedron clipped against the tetrahedron.
*
Expand Down Expand Up @@ -197,9 +199,10 @@ AXOM_HOST_DEVICE Polyhedron<T, 3> clip(const Tetrahedron<T, 3>& tet,
* \param [in] oct The octahedron to clip
* \param [in] tet The tetrahedron to clip against
* \param [in] eps The epsilon value
* \param [in] checkSign If true (default is false), checks the volume of the
* shapes are positive. If volume is negative, order of some
* vertices will be swapped.
* \param [in] checkSign If true (default is false), checks if the
* signed volume of each shape is positive. If the signed volume
* of that shape is negative, order of some vertices will be
* swapped for that shape.
*
* \return A polyhedron of the octahedron clipped against the tetrahedron.
*
Expand Down Expand Up @@ -238,9 +241,10 @@ AXOM_HOST_DEVICE Polyhedron<T, 3> clip(const Octahedron<T, 3>& oct,
* \param [in] oct The octahedron to clip
* \param [in] tet The tetrahedron to clip against
* \param [in] eps The epsilon value
* \param [in] checkSign If true (default is false), checks the volume of the
* shapes are positive. If volume is negative, order of some
* vertices will be swapped.
* \param [in] checkSign If true (default is false), checks if the
* signed volume of each shape is positive. If the signed volume
* of that shape is negative, order of some vertices will be
* swapped for that shape.
*
* \return A polyhedron of the octahedron clipped against the tetrahedron.
*
Expand Down Expand Up @@ -277,9 +281,10 @@ AXOM_HOST_DEVICE Polyhedron<T, 3> clip(const Tetrahedron<T, 3>& tet,
* \param [in] tet1 The tetrahedron to clip
* \param [in] tet2 The tetrahedron to clip against
* \param [in] eps The epsilon value
* \param [in] checkSign If true (default is false), checks the volume of the
* shapes are positive. If volume is negative, order of some
* vertices will be swapped.
* \param [in] checkSign If true (default is false), checks if the
* signed volume of each shape is positive. If the signed volume
* of that shape is negative, order of some vertices will be
* swapped for that shape.
*
* \return A polyhedron of the tetrahedron clipped against
* the other tetrahedron.
Expand Down

0 comments on commit 9a25422

Please sign in to comment.