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

Initial MIR component #1438

Open
wants to merge 298 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
298 commits
Select commit Hold shift + click to select a range
ee25b3a
Merged from develop
BradWhitlock Jun 4, 2024
dcd008a
Updated mir so it builds.
BradWhitlock Jun 5, 2024
fa23d15
Merged from feature/weiss27/3D-zoo-rebase
BradWhitlock Jun 7, 2024
b78570d
Bring back up to date with develop changes.
BradWhitlock Jun 7, 2024
5307644
some incomplete code
BradWhitlock Jun 11, 2024
23b9087
Added shapes
BradWhitlock Jun 12, 2024
a41d42d
cmake fixes, added clipping stuff
BradWhitlock Jun 12, 2024
101cb94
Starting material views
BradWhitlock Jun 15, 2024
e076902
Added some other material views.
BradWhitlock Jun 24, 2024
f3e904c
start to make it compile
BradWhitlock Jun 25, 2024
1b6f23d
work on compiling
BradWhitlock Jun 26, 2024
5a3a893
compiled
BradWhitlock Jun 26, 2024
7f3681f
Moved some indexing logic to StructuredIndexing. Added for_selected_z…
BradWhitlock Jun 26, 2024
7bd693a
Working on some node to zone relation stuff
BradWhitlock Jun 28, 2024
a5d2d3a
Separated out some dispatch functions
BradWhitlock Jun 28, 2024
4b025ee
Exclude dimensions in topology dispatch.
BradWhitlock Jun 28, 2024
4a9984c
Added nodal relation code for PH zones
BradWhitlock Jun 28, 2024
1dc7fec
rename
BradWhitlock Jun 28, 2024
cfed8a3
strided structure indexing
BradWhitlock Jun 29, 2024
845685e
Started adding test
BradWhitlock Jul 1, 2024
c695583
Moved StaticArray
BradWhitlock Jul 2, 2024
cfe5255
Start of ElementFieldToVertexField.hpp
BradWhitlock Jul 2, 2024
e0164e7
Made more general
BradWhitlock Jul 2, 2024
c628a6f
Renamed
BradWhitlock Jul 2, 2024
fe229f2
undef
BradWhitlock Jul 2, 2024
b4662ca
rename
BradWhitlock Jul 2, 2024
2f401a7
compilation fixes
BradWhitlock Jul 2, 2024
58340e4
rename
BradWhitlock Jul 2, 2024
63a0b9a
StridedStructuredIndexing test
BradWhitlock Jul 2, 2024
e7b3e25
Create clip table in mir algorithm.
BradWhitlock Jul 3, 2024
c553f30
starting to add some matset view code to mir algorithm
BradWhitlock Jul 3, 2024
32486b7
refactoring
BradWhitlock Jul 4, 2024
911aa6c
progress adapting clipfield
BradWhitlock Jul 11, 2024
74bc4ee
Moved functions to BitUtilities
BradWhitlock Jul 12, 2024
5b82731
Added some operators to Point.
BradWhitlock Jul 12, 2024
9f3fe77
Changed some edges
BradWhitlock Jul 12, 2024
1959dd7
accumulation_traits
BradWhitlock Jul 12, 2024
bdc5833
cpp2conduit
BradWhitlock Jul 12, 2024
426d97c
blender/slicer classes
BradWhitlock Jul 12, 2024
d947251
Refactor clip table. Move CLipField out to its own.
BradWhitlock Jul 12, 2024
fe3fc56
Fix static_assert
BradWhitlock Jul 12, 2024
52d03ef
Fix compilation
BradWhitlock Jul 12, 2024
9a92055
Fixing some compilation errors
BradWhitlock Jul 13, 2024
6deefe6
Tests for bit utilities
BradWhitlock Jul 15, 2024
4d573b9
starting to add a test
BradWhitlock Jul 15, 2024
154ec49
Add mit to axom-config.cmake.in
BradWhitlock Jul 15, 2024
9b143d1
Compilation fixes
BradWhitlock Jul 16, 2024
a2fa467
Change accessing edges
BradWhitlock Jul 16, 2024
0930c1c
Fixed some coordset views. Added distance field
BradWhitlock Jul 16, 2024
fc240cb
SLIC errors
BradWhitlock Jul 16, 2024
eefee2b
Fix bit functions
BradWhitlock Jul 17, 2024
6af4fa2
Added mechanism for Conduit to allocate through Axom.
BradWhitlock Jul 17, 2024
7f0d095
Added mechanism for making Conduit allocate through Axom. Fixed a few…
BradWhitlock Jul 17, 2024
719329b
Debugging ClipField
BradWhitlock Jul 18, 2024
72d3240
Populate slice data so we can map element fields to new mesh
BradWhitlock Jul 19, 2024
7b293b0
Added ClipOptions
BradWhitlock Jul 20, 2024
a5ff0ac
More testing
BradWhitlock Jul 22, 2024
07bdecf
templated
BradWhitlock Jul 22, 2024
395c37c
Changes that let ClipField run on GPU with HIP
BradWhitlock Jul 23, 2024
24a78d5
Initial mixed topo support
BradWhitlock Jul 24, 2024
41e6a46
Try out the mixed shape view
BradWhitlock Jul 24, 2024
4ba2c84
Some cleanup/refactoring
BradWhitlock Jul 24, 2024
6ff5327
code cleanup
BradWhitlock Jul 25, 2024
721e970
Adjust 3D shapes
BradWhitlock Jul 25, 2024
6db7e4b
debugging
BradWhitlock Jul 26, 2024
39b3e33
Some refactoring to see if that helps for debugging.
BradWhitlock Jul 27, 2024
8cd51b2
wedge is bad too
BradWhitlock Jul 27, 2024
acf1ac2
Added a test for explicit coordset view
BradWhitlock Jul 29, 2024
5331c0a
Fix typo
BradWhitlock Jul 29, 2024
b46d992
Fixed a clip bug from incorrect shape traversal
BradWhitlock Jul 29, 2024
40152ce
Fixed wedge edges
BradWhitlock Jul 30, 2024
43d9c47
Fixes for wedge clip
BradWhitlock Jul 30, 2024
e8c8474
start trying to work around OMP issue
BradWhitlock Jul 30, 2024
2f39c3e
Broke ClipField::execute into methods.
BradWhitlock Jul 30, 2024
a7d9e1e
code cleanup
BradWhitlock Jul 30, 2024
dd75375
Attempts to work around OMP problems.
BradWhitlock Jul 31, 2024
41dd065
Debug prints, etc
BradWhitlock Jul 31, 2024
e817b07
Changed conduit memory allocation. Fix view usage in one place.
BradWhitlock Jul 31, 2024
18f3026
Debugging
BradWhitlock Aug 1, 2024
5634141
Fix for HIP
BradWhitlock Aug 1, 2024
3418c07
Always use wrapped scan
BradWhitlock Aug 1, 2024
f45ebb7
Disable formatting in some borrowed data tables
BradWhitlock Aug 1, 2024
5fd8a62
clang-format is the worst! clang-ugly is more like it.
BradWhitlock Aug 1, 2024
e5dd66d
Move some name generation to NamingPolicy.
BradWhitlock Aug 1, 2024
7ece514
make style
BradWhitlock Aug 1, 2024
d85270f
A test for a mixed mesh
BradWhitlock Aug 1, 2024
b3ce4e0
make style
BradWhitlock Aug 1, 2024
d9150f3
Moved methods for better linking
BradWhitlock Aug 1, 2024
7b981ce
Better VTK file saving
BradWhitlock Aug 1, 2024
c7f50f3
save/load/compare baselines
BradWhitlock Aug 1, 2024
1e73a44
make style
BradWhitlock Aug 1, 2024
1a5a120
Added tests for rectilinear clipping
BradWhitlock Aug 1, 2024
eabf434
Moved some functions into a header.
BradWhitlock Aug 2, 2024
bbfb600
More consistent naming, make some view creation functions.
BradWhitlock Aug 2, 2024
4e9b17c
make style
BradWhitlock Aug 2, 2024
23aa1f7
progress on strided structured
BradWhitlock Aug 3, 2024
817fc1d
Improvements for strided structured.
BradWhitlock Aug 6, 2024
1bf8fcd
Improved strided structure support
BradWhitlock Aug 7, 2024
21fc10d
make style
BradWhitlock Aug 7, 2024
1dd88a4
Try selecting a few zones. Remove a method from views.
BradWhitlock Aug 7, 2024
11c0135
make style
BradWhitlock Aug 7, 2024
90ab9c2
fix macro
BradWhitlock Aug 7, 2024
15fdbf5
Fix types
BradWhitlock Aug 7, 2024
a5cfcc8
fix recenter
BradWhitlock Aug 7, 2024
4d0addd
Fixes
BradWhitlock Aug 7, 2024
6a78310
Adding ClipFieldFilter
BradWhitlock Aug 7, 2024
2069e10
Cut down code size
BradWhitlock Aug 7, 2024
7c5eb91
make style
BradWhitlock Aug 7, 2024
64c6024
Combined some structured topo dispatch
BradWhitlock Aug 8, 2024
60bd3cd
make style
BradWhitlock Aug 8, 2024
5c51478
Separate out options
BradWhitlock Aug 8, 2024
b708890
Separate some code
BradWhitlock Aug 8, 2024
35616f2
make style
BradWhitlock Aug 8, 2024
0207e14
Changed how options work, separated out selected zones. Starting a MI…
BradWhitlock Aug 9, 2024
84d3514
in progress
BradWhitlock Aug 9, 2024
642a218
Fixes for a matset view
BradWhitlock Aug 9, 2024
06e3eb9
make style
BradWhitlock Aug 9, 2024
db64fac
wrote a test for NodeToZoneRelationBuilder.
BradWhitlock Aug 10, 2024
284f9e2
make style
BradWhitlock Aug 10, 2024
e143dc8
Fix for NodetoZoneRelationBuilder tests
BradWhitlock Aug 12, 2024
52ec6fe
Changed namespace
BradWhitlock Aug 12, 2024
c294717
moved some tests
BradWhitlock Aug 12, 2024
47c55bf
Added test for RecenterField
BradWhitlock Aug 12, 2024
3d12af0
make style
BradWhitlock Aug 12, 2024
087b33b
Working on a MIR algorithm
BradWhitlock Aug 13, 2024
ebe2c46
Debugging MIR
BradWhitlock Aug 13, 2024
4f8e359
MIR improvements. Started some new helper classes that can replace pa…
BradWhitlock Aug 14, 2024
09dfb43
Abstract out Intersector code from ClipField so I can template on an …
BradWhitlock Aug 14, 2024
c8d84c6
make style
BradWhitlock Aug 14, 2024
b71a743
MIR improvements
BradWhitlock Aug 14, 2024
68f9b3f
debugging
BradWhitlock Aug 15, 2024
dfff7dc
MIR checkpoint - switching machines
BradWhitlock Aug 16, 2024
b0c9a5b
progress but not quite right
BradWhitlock Aug 19, 2024
389cb1b
Better result
BradWhitlock Aug 19, 2024
c9c5ee8
code cleanup
BradWhitlock Aug 20, 2024
b0dc1a8
make style
BradWhitlock Aug 20, 2024
44e75d4
Added timers
BradWhitlock Aug 20, 2024
d645a4f
Replaced timer with annotation so it will instead use Caliper.
BradWhitlock Aug 20, 2024
61e0ec0
make style
BradWhitlock Aug 20, 2024
393fe77
Minor fixes
BradWhitlock Aug 22, 2024
189b3c3
code cleanup
BradWhitlock Aug 22, 2024
aa51d5a
I renumbered clipping table symbol values to reduce the size of a sta…
BradWhitlock Aug 23, 2024
ac4aea5
make style
BradWhitlock Aug 23, 2024
e82a13e
Added more timers, some code renaming
BradWhitlock Aug 23, 2024
4b863be
porting MeshTester.
BradWhitlock Aug 24, 2024
f29c26f
Emit edge points using endpoint ids in blend groups if close to start…
BradWhitlock Aug 27, 2024
e2ab64e
make style
BradWhitlock Aug 27, 2024
0249309
Add degenerate zone filtering. Enable multiple policies in concentric…
BradWhitlock Aug 29, 2024
da2d547
make style
BradWhitlock Aug 29, 2024
f58b7bc
More timings
BradWhitlock Aug 29, 2024
4d86bb4
Sorting
BradWhitlock Aug 29, 2024
5b74ac2
timers
BradWhitlock Aug 29, 2024
3c319fc
Change to naming policy - could be faster in 3D
BradWhitlock Aug 30, 2024
28493fa
make style
BradWhitlock Aug 30, 2024
2fbe418
Changes to unique and n2z relation builder.
BradWhitlock Sep 3, 2024
45415b2
make style
BradWhitlock Sep 3, 2024
b8d3c1c
Some speedup for serial NodeToZoneRelationBuilder.
BradWhitlock Sep 4, 2024
85b6dc4
Skip a little work with 1 blend value.
BradWhitlock Sep 5, 2024
3ee18ae
Start of algorithm change to reduce blend group count. Not enabled ri…
BradWhitlock Sep 6, 2024
1bfbd24
make style
BradWhitlock Sep 6, 2024
064588e
Adding some new components for slicing matsets and extracting zones f…
BradWhitlock Sep 10, 2024
79144cc
Added some tests
BradWhitlock Sep 10, 2024
bd8fe95
Added more tests, other improvements.
BradWhitlock Sep 11, 2024
28f3c8a
Changed ZoneListBuilder to atomics instead of requiring node to zone …
BradWhitlock Sep 11, 2024
449f16a
Added selected zones to zone list builder.
BradWhitlock Sep 11, 2024
00b5305
make style
BradWhitlock Sep 11, 2024
98fcf66
Fixed problem in ClipField
BradWhitlock Sep 12, 2024
17ec665
Reset node
BradWhitlock Sep 12, 2024
4f43bbe
Added test for selecting zones in clipfield
BradWhitlock Sep 12, 2024
5a0a8ec
Fixed some tests on HIP
BradWhitlock Sep 13, 2024
d86f2f2
Updated data
BradWhitlock Sep 13, 2024
6250b37
Broken topo merging - WIP
BradWhitlock Sep 14, 2024
d237448
Add Ninja
BradWhitlock Sep 17, 2024
c8c00c4
Progress on MergeMeshes
BradWhitlock Sep 17, 2024
6b3468b
Progress on MergeMeshes
BradWhitlock Sep 18, 2024
c1f6fba
Merge is working for coordsets/topo.
BradWhitlock Sep 19, 2024
954df19
Fixed bug in NodeArrayView.
BradWhitlock Sep 19, 2024
3b91266
Added a test
BradWhitlock Sep 19, 2024
fb7ff8b
Initial stab at merging fields.
BradWhitlock Sep 19, 2024
0cae1d2
Added material merging in MergeMeshes.
BradWhitlock Sep 20, 2024
2225bf5
Fix timers
BradWhitlock Sep 20, 2024
debe458
make style
BradWhitlock Sep 20, 2024
e52d1bd
More timings
BradWhitlock Sep 20, 2024
b6325e0
Merged develop to branch
BradWhitlock Sep 20, 2024
e25cf83
remove warning
BradWhitlock Sep 20, 2024
99596ff
Fix build
BradWhitlock Sep 20, 2024
d6ea691
Some progress on adjusting for CUDA
BradWhitlock Sep 21, 2024
0a1d705
Changed comment format
BradWhitlock Sep 21, 2024
ef1fb76
possible CUDA solution
BradWhitlock Sep 21, 2024
1a6c6df
Progress on nvcc compatibility.
BradWhitlock Sep 24, 2024
e5bc818
nvcc compatibility
BradWhitlock Sep 24, 2024
8340505
nvcc progress
BradWhitlock Sep 24, 2024
27ecc84
nvcc progress
BradWhitlock Sep 24, 2024
9409974
testing fixes
BradWhitlock Sep 25, 2024
cef6203
Added a note in the docs.
BradWhitlock Sep 25, 2024
c723789
good changes
BradWhitlock Sep 26, 2024
d9a3595
GPU porting doc
BradWhitlock Sep 26, 2024
cf8b987
Added test for MakeUnstructured
BradWhitlock Sep 26, 2024
fc5763a
Adding zone function to topology views. Removing some c++17.
BradWhitlock Sep 27, 2024
4f8e751
Added getAllocatorIDForAddress
BradWhitlock Sep 27, 2024
c216e1d
Added StackArray::data method.
BradWhitlock Sep 27, 2024
95517c9
nvcc compatibility changes
BradWhitlock Sep 28, 2024
7f19ba7
Merged develop to branch.
BradWhitlock Sep 28, 2024
32e5f5e
Removed for_all_zones.
BradWhitlock Sep 28, 2024
583b3da
Removed for_all_zones from views.
BradWhitlock Sep 28, 2024
8e7fb09
make style
BradWhitlock Sep 28, 2024
6011470
Do not default construct on host if memory was device-allocated.
BradWhitlock Sep 29, 2024
ad20d9b
nvcc compatibility
BradWhitlock Sep 29, 2024
e976930
make style
BradWhitlock Sep 29, 2024
d5bfe00
Moved some files to future and removed from build.
BradWhitlock Sep 30, 2024
048eb1b
cleanup
BradWhitlock Sep 30, 2024
d935dad
fix warning
BradWhitlock Sep 30, 2024
49725ec
New GPU porting tips
BradWhitlock Sep 30, 2024
d3282af
Removed some old tests
BradWhitlock Sep 30, 2024
a147431
Added more GPU tips
BradWhitlock Sep 30, 2024
f459f3d
Array fixes
BradWhitlock Oct 1, 2024
aae8269
Removing some if constexpr
BradWhitlock Oct 1, 2024
ab2c73f
Working on docs
BradWhitlock Oct 1, 2024
c0b9e02
Removed empty file
BradWhitlock Oct 1, 2024
90a41ab
Remove more if constexpr
BradWhitlock Oct 1, 2024
6718215
Guard RAJA better
BradWhitlock Oct 1, 2024
2271300
fieldslicer test
BradWhitlock Oct 1, 2024
40eea7e
Added some docs
BradWhitlock Oct 2, 2024
524df5f
Added doc
BradWhitlock Oct 2, 2024
8f73ed0
More doc
BradWhitlock Oct 2, 2024
5429ff4
doc edits
BradWhitlock Oct 2, 2024
cb12815
Ported mir_tutorial_simple
BradWhitlock Oct 2, 2024
fc8626e
Merged from develop.
BradWhitlock Oct 2, 2024
bbc1e46
Fix 3D equiz test
BradWhitlock Oct 3, 2024
73f1307
Added ph topo view example in docs
BradWhitlock Oct 3, 2024
fd268ae
small fix
BradWhitlock Oct 3, 2024
40660ea
Move some files
BradWhitlock Oct 3, 2024
ac04c0d
Moved reference files
BradWhitlock Oct 3, 2024
54037c3
Moved files
BradWhitlock Oct 3, 2024
d7ef289
Moved files to clipping
BradWhitlock Oct 3, 2024
7d27fed
Moved files
BradWhitlock Oct 3, 2024
9a0aa0a
Split template instantiation up in concentric_circles example
BradWhitlock Oct 3, 2024
f637473
make style
BradWhitlock Oct 3, 2024
e03b481
fix
BradWhitlock Oct 3, 2024
2f82aa3
Break up compilation into more files
BradWhitlock Oct 3, 2024
5e780a1
Split tests into more files
BradWhitlock Oct 3, 2024
9f9bbdc
Removed reference mesh generation routines from MeshTester
BradWhitlock Oct 3, 2024
e864ec1
CUDA fixes. Doc fixes.
BradWhitlock Oct 3, 2024
bdcc302
make style
BradWhitlock Oct 3, 2024
233b0fe
Small doc correction.
BradWhitlock Oct 3, 2024
83a7ec6
Fix build and warnings for no-RAJA case.
BradWhitlock Oct 3, 2024
2433ca6
Warnings. Fix some int/IndexType usage. Loosen equiz_3d tolerance a l…
BradWhitlock Oct 4, 2024
03d00d0
Code changes
BradWhitlock Oct 4, 2024
259b8df
make style on rzwhippet
BradWhitlock Oct 4, 2024
98f9c0b
Merge branch 'develop' into feature/whitlock/mir_update
BradWhitlock Oct 7, 2024
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
7 changes: 7 additions & 0 deletions config-build.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ def parse_arguments():
help="Create an eclipse project file.",
)

parser.add_argument(
"-n", "--ninja", action="store_true", help="Create a Ninja project."
)

parser.add_argument(
"-x", "--xcode", action="store_true", help="Create an xcode project."
)
Expand Down Expand Up @@ -270,6 +274,9 @@ def create_cmake_command_line(
if args.eclipse:
cmakeline += ' -G "Eclipse CDT4 - Unix Makefiles"'

if args.ninja:
cmakeline += ' -G "Ninja"'

if args.xcode:
cmakeline += ' -G "Xcode"'

Expand Down
9 changes: 9 additions & 0 deletions src/axom/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@ axom_add_component(COMPONENT_NAME klee DEFAULT_STATE ${AXOM_ENABLE_ALL_COMPONE
axom_add_component(COMPONENT_NAME quest DEFAULT_STATE ${AXOM_ENABLE_ALL_COMPONENTS})
axom_add_component(COMPONENT_NAME multimat DEFAULT_STATE ${AXOM_ENABLE_ALL_COMPONENTS})

# Add MIR if the prerequisites are found.
if(RAJA_FOUND AND UMPIRE_FOUND AND CONDUIT_FOUND)
axom_add_component(COMPONENT_NAME mir
DEFAULT_STATE ${AXOM_ENABLE_ALL_COMPONENTS})
else()
message(STATUS "Axom Component MIR turned off due to missing RAJA, UMPIRE, or Conduit.")
set(AXOM_ENABLE_MIR OFF CACHE BOOL "")
endif()

install(TARGETS ${AXOM_COMPONENTS_ENABLED}
EXPORT axom-targets
DESTINATION lib)
Expand Down
1 change: 1 addition & 0 deletions src/axom/config.hpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@
#cmakedefine AXOM_USE_KLEE
#cmakedefine AXOM_USE_LUMBERJACK
#cmakedefine AXOM_USE_MINT
#cmakedefine AXOM_USE_MIR
#cmakedefine AXOM_USE_PRIMAL
#cmakedefine AXOM_USE_QUEST
#cmakedefine AXOM_USE_SIDRE
Expand Down
4 changes: 2 additions & 2 deletions src/axom/core/ArrayView.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class ArrayView : public ArrayBase<T, DIM, ArrayView<T, DIM, SPACE>>
typename... Args,
typename Enable = typename std::enable_if<
sizeof...(Args) == DIM && detail::all_types_are_integral<Args...>::value>::type>
ArrayView(T* data, Args... args);
AXOM_HOST_DEVICE ArrayView(T* data, Args... args);

/*!
* \brief Generic constructor for an ArrayView of arbitrary dimension with external data
Expand Down Expand Up @@ -232,7 +232,7 @@ using MCArrayView = ArrayView<T, 2>;
//------------------------------------------------------------------------------
template <typename T, int DIM, MemorySpace SPACE>
template <typename... Args, typename Enable>
ArrayView<T, DIM, SPACE>::ArrayView(T* data, Args... args)
AXOM_HOST_DEVICE ArrayView<T, DIM, SPACE>::ArrayView(T* data, Args... args)
: ArrayView(data,
StackArray<IndexType, DIM> {{static_cast<IndexType>(args)...}})
{
Expand Down
2 changes: 2 additions & 0 deletions src/axom/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ set(core_headers
utilities/CommandLineUtilities.hpp
utilities/FileUtilities.hpp
utilities/RAII.hpp
utilities/Sorting.hpp
utilities/StringUtilities.hpp
utilities/System.hpp
utilities/Timer.hpp
Expand Down Expand Up @@ -73,6 +74,7 @@ set(core_headers
execution/for_all.hpp
execution/nested_for_exec.hpp
execution/runtime_policy.hpp
execution/scans.hpp
execution/synchronize.hpp

execution/internal/seq_exec.hpp
Expand Down
35 changes: 35 additions & 0 deletions src/axom/core/StackArray.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#include "axom/core/Macros.hpp" // for axom macros
#include "axom/core/Types.hpp" // for axom types

#include <iostream>

namespace axom
{
/*!
Expand All @@ -27,6 +29,14 @@ namespace axom
template <typename T, int N>
struct StackArray
{
using value_type = T;

/*!
* \brief Return size of the array.
*/
AXOM_HOST_DEVICE
constexpr static int size() { return N; }

/*!
* \brief Accessor, returns a reference to the value at the given index.
*
Expand Down Expand Up @@ -55,6 +65,9 @@ struct StackArray
AXOM_HOST_DEVICE
constexpr operator const T*() const noexcept { return &m_data[0]; }

AXOM_HOST_DEVICE T* data() noexcept { return &m_data[0]; }
AXOM_HOST_DEVICE const T* data() const noexcept { return &m_data[0]; }

/// @}

/*!
Expand Down Expand Up @@ -135,6 +148,28 @@ AXOM_HOST_DEVICE bool operator<(const StackArray<T, N>& lhs,
return false;
}

/**
* \brief Print the StackArray to a stream.
* \param os The stream to use.
* \param obj The StackArray to print.
* \return The input stream.
*/
template <typename T, int N>
std::ostream& operator<<(std::ostream& os, const StackArray<T, N>& obj)
{
os << "(";
for(int i = 0; i < N; i++)
{
if(i > 0)
{
os << ", ";
}
os << obj.m_data[i];
}
os << ")";
return os;
}

} /* namespace axom */

#endif /* AXOM_STACKARRAY_HPP_ */
58 changes: 47 additions & 11 deletions src/axom/core/StaticArray.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ namespace axom
* \accelerated
* \class StaticArray
*
* \brief Provides a wrapper for a StackArray with an additional size member.
* \brief This class extends StackArray with some std::vector-like convenience methods.
*
*
* \tparam T the type of the values to hold.
* \tparam N the number of values in the array.
Expand All @@ -25,14 +26,27 @@ namespace axom
* execution.
*/
template <typename T, int N>
struct StaticArray : public StackArray<T, N>
class StaticArray : public StackArray<T, N>
{
public:
/*!
* \brief Returns the capacity of the static array
*
* \return The capacity of the static array
*/
AXOM_HOST_DEVICE
constexpr axom::IndexType capacity() const
{
return static_cast<axom::IndexType>(N);
}

/*!
* \brief Returns the size of the static array
*
* \return The size of the static array
*/
AXOM_HOST_DEVICE int size() const { return m_size; }
AXOM_HOST_DEVICE
axom::IndexType size() const { return m_size; }

/*!
* \brief Pushes an object to the back of the static array
Expand All @@ -45,29 +59,51 @@ struct StaticArray : public StackArray<T, N>
* \note If the static array is full, push_back
* will not modify the static array.
*/
AXOM_HOST_DEVICE void push_back(const T& obj)
AXOM_HOST_DEVICE
void push_back(const T &obj)
{
assert(m_size < N);
if(m_size < N)
assert(m_size < capacity());
if(m_size < capacity())
{
StackArray<T, N>::m_data[m_size++] = obj;
}
}

/*!
* \brief Pops the last element off the list.
*/
AXOM_HOST_DEVICE
void pop_back() { m_size = (m_size > 0) ? (m_size - 1) : 0; }

/*!
* \brief Clears the data from the static array
*/
AXOM_HOST_DEVICE void clear()
AXOM_HOST_DEVICE
void clear() { m_size = 0; }

/**
* \brief Determines whether the container is empty.
* \return True if empty, false otherwise.
*/
AXOM_HOST_DEVICE
bool empty() const { return m_size == 0; }

/*!
* \brief Fills the container with the supplied value.
*
* \param fill_value The fill value.
*/
AXOM_HOST_DEVICE
void fill(const T &fill_value)
{
for(T& datum : StackArray<T, N>::m_data)
for(T &datum : StackArray<T, N>::m_data)
{
datum = T();
datum = fill_value;
}
m_size = 0;
}

private:
int m_size {0};
axom::IndexType m_size {0};
};

} /* namespace axom */
Expand Down
126 changes: 126 additions & 0 deletions src/axom/core/execution/scans.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
// 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)

#ifndef AXOM_CORE_EXECUTION_SCANS_HPP_
#define AXOM_CORE_EXECUTION_SCANS_HPP_

#include "axom/config.hpp"
#include "axom/core/execution/execution_space.hpp"
#include "axom/core/Macros.hpp"
#include "axom/core/Types.hpp"

// C/C++ includes
#include <type_traits>
#include <utility>

namespace axom
{
/// \name Scans
/// @{

/*!
* \brief Performs exclusive scan over \a input view and stores result in \a output.
*
* \param [in] input The input container to be scanned.
* \param [out] output The container that will contain the output scan data. This
* must have the same number of elements as \a input.
*
* \tparam ExecSpace the execution space where to run the supplied kernel
* \tparam ContiguousMemoryContainer The container type that holds the data
*
* \see axom::execution_space
*
* Usage Example:
* \code
*
* axom::ArrayView<int> sizesView = sizes.view();
* axom::ArrayView<int> offsetsView = offsets.view();
*
* // Compute the scan for all elements in sizesView, store scan in offsetsView.
* axom::exclusive_scan<ExecSpace>(sizesView, offsetsView);
*
* \endcode
*
*/
template <typename ExecSpace, typename ContiguousMemoryContainer>
inline void exclusive_scan(const ContiguousMemoryContainer &input,
ContiguousMemoryContainer &output)
{
assert(input.size() == output.size());

#ifdef AXOM_USE_RAJA

using loop_policy = typename axom::execution_space<ExecSpace>::loop_policy;
RAJA::exclusive_scan<loop_policy>(
RAJA::make_span(input.data(), input.size()),
RAJA::make_span(output.data(), output.size()));

#else
constexpr bool is_serial = std::is_same<ExecSpace, SEQ_EXEC>::value;
AXOM_STATIC_ASSERT(is_serial);

typename ContiguousMemoryContainer::value_type total {0};
for(IndexType i = 0; i < input.size(); ++i)
{
output[i] = total;
total += input[i];
}
#endif
}

/*!
* \brief Performs inclusive scan over \a input view and stores result in \a output.
*
* \param [in] input The input container to be scanned.
* \param [out] output The container that will contain the output scan data. This
* must have the same number of elements as \a input.
*
* \tparam ExecSpace the execution space where to run the supplied kernel
* \tparam ContiguousMemoryContainer The container type that holds the data
*
* \see axom::execution_space
*
* Usage Example:
* \code
*
* axom::ArrayView<int> sizesView = sizes.view();
* axom::ArrayView<int> totalView = totals.view();
*
* // Compute the scan for all elements in sizesView, store scan in totalView.
* axom::inclusive_scan<ExecSpace>(sizesView, totalView);
*
* \endcode
*
*/
template <typename ExecSpace, typename ContiguousMemoryContainer>
inline void inclusive_scan(const ContiguousMemoryContainer &input,
ContiguousMemoryContainer &output)
{
assert(input.size() == output.size());

#ifdef AXOM_USE_RAJA

using loop_policy = typename axom::execution_space<ExecSpace>::loop_policy;
RAJA::inclusive_scan<loop_policy>(
RAJA::make_span(input.data(), input.size()),
RAJA::make_span(output.data(), output.size()));

#else
constexpr bool is_serial = std::is_same<ExecSpace, SEQ_EXEC>::value;
AXOM_STATIC_ASSERT(is_serial);

typename ContiguousMemoryContainer::value_type total {0};
for(IndexType i = 0; i < input.size(); ++i)
{
total += input[i];
output[i] = total;
}
#endif
}
/// @}

} // namespace axom

#endif // AXOM_CORE_EXECUTION_FOR_ALL_HPP_
Loading