Skip to content

Commit

Permalink
Safe Compile Time: Available Arenas
Browse files Browse the repository at this point in the history
  • Loading branch information
ax3l committed Feb 8, 2023
1 parent b310260 commit 9a4d7d8
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 7 deletions.
4 changes: 3 additions & 1 deletion src/Base/PODVector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,12 @@ void make_PODVector(py::module &m, std::string typestr)
// see Src/Base/AMReX_GpuContainers.H
make_PODVector<T, std::allocator<T>> (m, typestr, "std");
make_PODVector<T, amrex::ArenaAllocator<T>> (m, typestr, "arena");
make_PODVector<T, amrex::PinnedArenaAllocator<T>> (m, typestr, "pinned");
#ifdef AMREX_USE_GPU
make_PODVector<T, amrex::DeviceArenaAllocator<T>> (m, typestr, "device");
make_PODVector<T, amrex::ManagedArenaAllocator<T>> (m, typestr, "managed");
make_PODVector<T, amrex::PinnedArenaAllocator<T>> (m, typestr, "pinned");
make_PODVector<T, amrex::AsyncArenaAllocator<T>> (m, typestr, "async");
#endif
}

void init_PODVector(py::module& m) {
Expand Down
4 changes: 3 additions & 1 deletion src/Particle/ArrayOfStructs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,12 @@ void make_ArrayOfStructs(py::module &m)
// see Src/Base/AMReX_GpuContainers.H
make_ArrayOfStructs<NReal, NInt, std::allocator> (m, "std");
make_ArrayOfStructs<NReal, NInt, amrex::ArenaAllocator> (m, "arena");
make_ArrayOfStructs<NReal, NInt, amrex::PinnedArenaAllocator> (m, "pinned");
#ifdef AMREX_USE_GPU
make_ArrayOfStructs<NReal, NInt, amrex::DeviceArenaAllocator> (m, "device");
make_ArrayOfStructs<NReal, NInt, amrex::ManagedArenaAllocator> (m, "managed");
make_ArrayOfStructs<NReal, NInt, amrex::PinnedArenaAllocator> (m, "pinned");
make_ArrayOfStructs<NReal, NInt, amrex::AsyncArenaAllocator> (m, "async");
#endif
}

void init_ArrayOfStructs(py::module& m) {
Expand Down
6 changes: 4 additions & 2 deletions src/Particle/ParticleContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -352,14 +352,16 @@ void make_ParticleContainer_and_Iterators (py::module &m)
std::allocator>(m, "std");
make_ParticleContainer_and_Iterators<T_NStructReal, T_NStructInt, T_NArrayReal, T_NArrayInt,
amrex::ArenaAllocator>(m, "arena");
make_ParticleContainer_and_Iterators<T_NStructReal, T_NStructInt, T_NArrayReal, T_NArrayInt,
amrex::PinnedArenaAllocator>(m, "pinned");
#ifdef AMREX_USE_GPU
make_ParticleContainer_and_Iterators<T_NStructReal, T_NStructInt, T_NArrayReal, T_NArrayInt,
amrex::DeviceArenaAllocator>(m, "device");
make_ParticleContainer_and_Iterators<T_NStructReal, T_NStructInt, T_NArrayReal, T_NArrayInt,
amrex::ManagedArenaAllocator>(m, "managed");
make_ParticleContainer_and_Iterators<T_NStructReal, T_NStructInt, T_NArrayReal, T_NArrayInt,
amrex::PinnedArenaAllocator>(m, "pinned");
make_ParticleContainer_and_Iterators<T_NStructReal, T_NStructInt, T_NArrayReal, T_NArrayInt,
amrex::AsyncArenaAllocator>(m, "async");
#endif
}

void init_ParticleContainer(py::module& m) {
Expand Down
6 changes: 4 additions & 2 deletions src/Particle/ParticleTile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,16 @@ void make_ParticleTile(py::module &m)
std::allocator>(m, "std");
make_ParticleTile<NStructReal, NStructInt, NArrayReal, NArrayInt,
amrex::ArenaAllocator>(m, "arena");
make_ParticleTile<NStructReal, NStructInt, NArrayReal, NArrayInt,
amrex::PinnedArenaAllocator>(m, "pinned");
#ifdef AMREX_USE_GPU
make_ParticleTile<NStructReal, NStructInt, NArrayReal, NArrayInt,
amrex::DeviceArenaAllocator>(m, "device");
make_ParticleTile<NStructReal, NStructInt, NArrayReal, NArrayInt,
amrex::ManagedArenaAllocator>(m, "managed");
make_ParticleTile<NStructReal, NStructInt, NArrayReal, NArrayInt,
amrex::PinnedArenaAllocator>(m, "pinned");
make_ParticleTile<NStructReal, NStructInt, NArrayReal, NArrayInt,
amrex::AsyncArenaAllocator>(m, "async");
#endif
}

void init_ParticleTile(py::module& m) {
Expand Down
4 changes: 3 additions & 1 deletion src/Particle/StructOfArrays.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,12 @@ void make_StructOfArrays(py::module &m)
// see Src/Base/AMReX_GpuContainers.H
make_StructOfArrays<NReal, NInt, std::allocator>(m, "std");
make_StructOfArrays<NReal, NInt, amrex::ArenaAllocator>(m, "arena");
make_StructOfArrays<NReal, NInt, amrex::PinnedArenaAllocator>(m, "pinned");
#ifdef AMREX_USE_GPU
make_StructOfArrays<NReal, NInt, amrex::DeviceArenaAllocator>(m, "device");
make_StructOfArrays<NReal, NInt, amrex::ManagedArenaAllocator>(m, "managed");
make_StructOfArrays<NReal, NInt, amrex::PinnedArenaAllocator>(m, "pinned");
make_StructOfArrays<NReal, NInt, amrex::AsyncArenaAllocator>(m, "async");
#endif
}

void init_StructOfArrays(py::module& m) {
Expand Down

0 comments on commit 9a4d7d8

Please sign in to comment.