-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1171 from LLNL/feature/kweiss/aws-tutorial
AWS tutorial
- Loading branch information
Showing
24 changed files
with
3,403 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
# Copyright (c) 2017-2024, Lawrence Livermore National Security, LLC and | ||
# other Axom Project Developers. See the top-level LICENSE file for details. | ||
# | ||
# SPDX-License-Identifier: (BSD-3-Clause) | ||
#------------------------------------------------------------------------------ | ||
# Tutorial that demonstrates the usage of several Axom components | ||
# in a BLT-based build system. | ||
# | ||
# Configuration variables are stored in a CMake cache file 'host-config.cmake' | ||
# which defines paths to blt, axom and possibly other TPLs. | ||
# It also contains information about the compiler used to build axom. | ||
#------------------------------------------------------------------------------ | ||
# | ||
# To build: | ||
# mkdir build | ||
# cd build | ||
# cmake -C ../host-config.cmake .. | ||
# make | ||
# ./bin/lesson_* | ||
# | ||
#------------------------------------------------------------------------------ | ||
|
||
cmake_minimum_required(VERSION 3.14) | ||
|
||
project(radiuss_tutorial) | ||
|
||
#------------------------------------------------------------------------------ | ||
# Set up BLT with validity checks | ||
#------------------------------------------------------------------------------ | ||
|
||
# Check that path to BLT is provided and valid | ||
if(NOT DEFINED BLT_SOURCE_DIR OR NOT EXISTS ${BLT_SOURCE_DIR}/SetupBLT.cmake) | ||
message(FATAL_ERROR "Missing required 'BLT_SOURCE_DIR' variable pointing to a valid blt") | ||
endif() | ||
include(${BLT_SOURCE_DIR}/SetupBLT.cmake) | ||
|
||
|
||
#------------------------------------------------------------------------------ | ||
# Check for AXOM_DIR and use CMake's find_package to import axom's targets | ||
#------------------------------------------------------------------------------ | ||
if(NOT DEFINED AXOM_DIR OR NOT EXISTS ${AXOM_DIR}/lib/cmake/axom-config.cmake) | ||
message(FATAL_ERROR "Missing required 'AXOM_DIR' variable pointing to an installed axom") | ||
endif() | ||
|
||
include(CMakeFindDependencyMacro) | ||
|
||
find_dependency(axom REQUIRED | ||
NO_DEFAULT_PATH | ||
PATHS ${AXOM_DIR}/lib/cmake) | ||
|
||
#------------------------------------------------------------------------------ | ||
# Set up target executables for the tutorial | ||
#------------------------------------------------------------------------------ | ||
set(tutorial_deps axom axom::fmt axom::cli11) | ||
blt_list_append(TO tutorial_deps ELEMENTS blt::openmp IF ENABLE_OPENMP) | ||
blt_list_append(TO tutorial_deps ELEMENTS blt::cuda IF ENABLE_CUDA) | ||
blt_list_append(TO tutorial_deps ELEMENTS blt::hip IF ENABLE_HIP) | ||
|
||
blt_add_executable(NAME lesson_00_check_axom_configuration | ||
SOURCES lesson_00/check_axom_configuration.cpp | ||
DEPENDS_ON ${tutorial_deps}) | ||
|
||
blt_add_executable(NAME lesson_01_load_stl_mesh | ||
SOURCES lesson_01/load_stl_mesh.cpp | ||
DEPENDS_ON ${tutorial_deps}) | ||
|
||
blt_add_executable(NAME lesson_02_naive_self_intersections | ||
SOURCES lesson_02/naive_self_intersections.cpp | ||
DEPENDS_ON ${tutorial_deps}) | ||
|
||
if(umpire_FOUND AND RAJA_FOUND) | ||
blt_list_append(TO tutorial_deps ELEMENTS RAJA IF RAJA_FOUND) | ||
blt_list_append(TO tutorial_deps ELEMENTS umpire IF umpire_FOUND) | ||
|
||
blt_add_executable(NAME lesson_03_device_self_intersections | ||
SOURCES lesson_03/device_self_intersections.cpp | ||
DEPENDS_ON ${tutorial_deps}) | ||
|
||
blt_add_executable(NAME lesson_04_device_spatial_indexes | ||
SOURCES lesson_04/device_spatial_indexes.cpp | ||
DEPENDS_ON ${tutorial_deps}) | ||
endif() | ||
|
||
#------------------------------------------------------------------------------ | ||
# Optionally, add tests to run the tutorial lessons | ||
#------------------------------------------------------------------------------ | ||
if(ENABLE_TESTS) | ||
blt_add_test(NAME lesson_00_check_axom_configuration | ||
COMMAND lesson_00_check_axom_configuration) | ||
|
||
set(_sphere_mesh "${AXOM_DATA_DIR}/quest/sphere_binary.stl") | ||
set(_plane_problem_mesh "${AXOM_DATA_DIR}/quest/plane_simp_problems.stl") | ||
|
||
if(EXISTS ${_sphere_mesh}) | ||
blt_add_test( | ||
NAME lesson_01_load_stl_mesh_sphere | ||
COMMAND lesson_01_load_stl_mesh -i ${_sphere_mesh}) | ||
|
||
blt_add_test( | ||
NAME lesson_02_naive_self_intersections_sphere | ||
COMMAND lesson_02_naive_self_intersections -i ${_sphere_mesh} --use-bounding-boxes) | ||
endif() | ||
|
||
set (_policies "seq") | ||
blt_list_append(TO _policies ELEMENTS "omp" IF ENABLE_OPENMP) | ||
blt_list_append(TO _policies ELEMENTS "cuda" IF ENABLE_CUDA) | ||
blt_list_append(TO _policies ELEMENTS "hip" IF ENABLE_HIP) | ||
|
||
# the plane_mesh can take too long on lesson 3 in Debug configs, so only use it in Release configs | ||
set(_lesson_03_mesh_name "sphere") | ||
set(_lesson_03_mesh_path ${_sphere_mesh}) | ||
if(${CMAKE_BUILD_TYPE} MATCHES "^[Rr]elease") | ||
set(_lesson_03_mesh_name "plane") | ||
set(_lesson_03_mesh_path ${_plane_problem_mesh}) | ||
endif() | ||
if(TARGET lesson_03_device_self_intersections AND EXISTS ${_lesson_03_mesh_path}) | ||
foreach(_pol ${_policies}) | ||
blt_add_test( | ||
NAME lesson_03_device_self_intersections_${_lesson_03_mesh_name}_${_pol} | ||
COMMAND lesson_03_device_self_intersections -i ${_lesson_03_mesh_path} --use-bounding-boxes -p ${_pol}) | ||
endforeach() | ||
endif() | ||
|
||
if(TARGET lesson_04_device_spatial_indexes AND EXISTS ${_plane_problem_mesh}) | ||
foreach(_pol ${_policies}) | ||
blt_add_test( | ||
NAME lesson_04_device_spatial_indexes_plane_${_pol} | ||
COMMAND lesson_04_device_spatial_indexes -i ${_plane_problem_mesh} -p ${_pol}) | ||
endforeach() | ||
endif() | ||
|
||
endif() | ||
|
||
|
||
#------------------------------------------------------------------------------ | ||
# Optionally, print out information about imported targets | ||
#------------------------------------------------------------------------------ | ||
if(EXAMPLE_VERBOSE_OUTPUT) | ||
blt_print_target_properties(TARGET axom CHILDREN TRUE) | ||
endif() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
## Axom tutorial | ||
|
||
This tutorial showcases several features of Axom by incrementally building up an application that checks for self-intersections and degeneracies among the triangles in a triangle mesh. The resulting application matches functionality from Axom's [mesh_tester utility](https://github.com/LLNL/axom/blob/develop/src/tools/mesh_tester.cpp). | ||
|
||
|
||
![Mesh with self-intersections](figs/porsche.png) | ||
<div style="text-align: center; font-style: italic;"> | ||
A triangle mesh of a car with intersecting triangles highlighted in red | ||
</div> | ||
<br /> | ||
|
||
* [Lesson 00](lesson_00/README.md) provides a brief overview of Axom and develops a simple application against an installed version of Axom | ||
* [Lesson 01](lesson_01/README.md) uses Axom to load an [STL triangle mesh](https://en.wikipedia.org/wiki/STL_(file_format)) and print out the number of triangles in the mesh. It uses Axom's logging component `slic` as well as functionality from its spatial querying component, `quest`. | ||
* [Lesson 02](lesson_02/README.md) adds a naive algorithm that checks every pair of triangles in the mesh for self-intersections, showcasing computational geometry primitives and operations from Axom's `primal` component. | ||
* [Lesson 03](lesson_03/README.md) ports this naive algorithm to [RAJA](https://github.com/llnl/raja) for performance-portable execution on available computing resources, using sequential (CPU), threaded (OpenMP) and GPU devices using `cuda` and `hip` backends. | ||
* [Lesson 04](lesson_04/README.md) uses a spatial index from Axom's `spin` component to further accelerate our self-intersection algorithm. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.