Skip to content

Commit d2baaed

Browse files
authored
Merge pull request #13 from TensoriumCore/CUDA_GPU_Support
## Summary This update merges the `moving-puncture-regrid` work into the current CUDA GPU support branch. ## Highlights - Added the new Z4c-oriented moving puncture workflow, replacing the older BSSN test layout with `z4c` test targets and runners. - Added moving-puncture regridding support, including nested and BBH split fixed mesh refinement layouts. - Added FMR memory pooling utilities to reduce allocation pressure during moving puncture evolutions. - Added optional HDF5 export support for simulation and diagnostic output. - Improved moving puncture boundary handling, including Sommerfeld/radiative boundary configuration and sponge support. - Preserved and integrated the CUDA backend path for Z4c/BSSN RK stepping, CUDA RHS kernels, and CUDA- related regression tests. - Added/updated Python bindings and Python-side Z4c helpers. - Updated CMake targets and test organization around the new `z4c` naming. ## Validation Built successfully with: - `cmake --build build-codex-cuda -- -j8` - `cmake --build build-codex-check -- -j8` Both CUDA and non-CUDA builds compile successfully.
2 parents 768b9da + 1648aa8 commit d2baaed

107 files changed

Lines changed: 13997 additions & 3436 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
dist/
44
__pycache__/
55
.venv/
6-
6+
*.h5
77
# Build / CMake
88
build/
99
build-*/

CMakeLists.txt

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@ option(AVX2 "Enable AVX2+FMA codegen" OFF)
88
option(AVX512 "Enable AVX-512" OFF)
99
option(VERBOSE "Verbose runtime logs" OFF)
1010
option(DEBUG "Build with debug symbols" OFF)
11-
option(BUILD_PLUGINS "Build Clang/LLVM plugins" ON)
11+
option(BUILD_PLUGINS "Build Clang/LLVM plugins" OFF)
1212
option(BUILD_TESTS "Build test executables" ON)
1313
option(BUILD_PYBIND "Build Python bindings" OFF)
1414
option(USE_CUDA "Enable CUDA kernels (requires nvcc)" OFF)
1515
option(USE_CBLAS "Enable BLAS" ON)
16+
option(USE_HDF5 "Enable HDF5 export support when HDF5 is available" ON)
1617
option(TENSORIUM_BSSN_PROFILE_KERNELS "Enable BSSN RHS timing instrumentation" OFF)
1718
option(TENSORIUM_BSSN_VALIDATE_TILDE_GAMMA_SYMBOLS "Validate on-the-fly Γ̃ symbols" OFF)
1819
option(TENSORIUM_ENABLE_COMPILER_OPT_REPORTS
@@ -104,24 +105,42 @@ if (USE_CUDA)
104105

105106
add_compile_definitions(TENSORIUM_CUDA)
106107

108+
if (CUDAToolkit_NVCC_EXECUTABLE AND NOT CMAKE_CUDA_COMPILER)
109+
set(CMAKE_CUDA_COMPILER "${CUDAToolkit_NVCC_EXECUTABLE}" CACHE FILEPATH "CUDA compiler" FORCE)
110+
endif()
111+
107112
enable_language(CUDA)
108-
set(CMAKE_CUDA_COMPILER "${CUDAToolkit_NVCC_EXECUTABLE}")
109113

110-
set(CMAKE_CUDA_ARCHITECTURES 61 70 75 80 86 90)
111-
add_compile_definitions(TENSORIUM_CUDA_ARCH=${CMAKE_CUDA_ARCHITECTURES})
114+
set(CMAKE_CUDA_ARCHITECTURES 60 61 70 75 80 86 90)
115+
string(JOIN "_" TENSORIUM_CUDA_ARCH_LIST ${CMAKE_CUDA_ARCHITECTURES})
116+
add_compile_definitions(TENSORIUM_CUDA_ARCH_LIST="${TENSORIUM_CUDA_ARCH_LIST}")
112117

113118
set(CMAKE_CUDA_STANDARD 17)
114119
set(CMAKE_CUDA_STANDARD_REQUIRED ON)
115120
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -O3 -Xcompiler=-fPIC --use_fast_math -lineinfo -Wno-deprecated-gpu-targets")
116121

117122
include_directories(${CUDAToolkit_INCLUDE_DIRS})
118-
link_directories(${CUDAToolkit_LIBRARY_DIR})
119123
else()
120124
add_compile_definitions(TENSORIUM_NO_CUDA)
121125
endif()
122126

123127
include_directories(${CMAKE_SOURCE_DIR}/includes)
124128

129+
set(TENSORIUM_HDF5_FOUND FALSE)
130+
set(TENSORIUM_HDF5_LIBRARIES "")
131+
if(USE_HDF5)
132+
find_package(HDF5 QUIET COMPONENTS C)
133+
if(HDF5_FOUND)
134+
set(TENSORIUM_HDF5_FOUND TRUE)
135+
set(TENSORIUM_HDF5_LIBRARIES ${HDF5_LIBRARIES})
136+
include_directories(${HDF5_INCLUDE_DIRS})
137+
add_compile_definitions(TENSORIUM_USE_HDF5)
138+
message(STATUS "HDF5 export support enabled")
139+
else()
140+
message(STATUS "HDF5 not found; export support disabled")
141+
endif()
142+
endif()
143+
125144
if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64" OR CMAKE_SYSTEM_PROCESSOR MATCHES "amd64")
126145
if(USE_KNL)
127146
set(BASE_FLAGS "-O3 -march=knl -mtune=knl -Wno-ignored-attributes")

Plugins/TensoriumLLVM_IRCheck.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include "llvm/IR/Module.h"
55
#include "llvm/IR/PassManager.h"
66
#include "llvm/Passes/PassBuilder.h"
7-
#include "llvm/Passes/PassPlugin.h"
7+
#include "llvm/Plugins/PassPlugin.h"
88
#include "llvm/Support/raw_ostream.h"
99
#include <iostream>
1010

Plugins/TensoriumLLVM_ML_IR_GPU.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#include "llvm/IR/Module.h"
44
#include "llvm/IR/PassManager.h"
55
#include "llvm/Passes/PassBuilder.h"
6-
#include "llvm/Passes/PassPlugin.h"
6+
#include "llvm/Plugins/PassPlugin.h"
77

88
using namespace llvm;
99

Pybind/README.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -73,25 +73,25 @@ PY
7373
- `tns.compute_christoffel`
7474
- `tns.compute_riemann_tensor`
7575
- Ricci contraction/scalar helpers
76-
- BSSN grid initial-data bindings:
77-
- `bssn.BSSNGrid`
78-
- `bssn.minkowski`
79-
- `bssn.schwarzschild_isotropic`
80-
- `bssn.kerr_schild_single`
81-
- `bssn.binary_bowen_york_puncture_init`
82-
- `bssn.binary_bowen_york_puncture_interpolated_init`
83-
- `bssn.binary_bowen_york_puncture_twopunctures_c_init`
76+
- Z4c grid initial-data bindings:
77+
- `z4c.Z4cGrid`
78+
- `z4c.minkowski`
79+
- `z4c.schwarzschild_isotropic`
80+
- `z4c.kerr_schild_single`
81+
- `z4c.binary_bowen_york_puncture_init`
82+
- `z4c.binary_bowen_york_puncture_interpolated_init`
83+
- `z4c.binary_bowen_york_puncture_twopunctures_c_init`
8484
- NumPy conversion helpers are available on bound classes via
8585
- `Class.from_numpy(...)`
8686
- `instance.to_numpy()`
8787

88-
## BSSN quick start
88+
## Z4c quick start
8989

9090
```bash
9191
python3 - <<'PY'
9292
import tensorium
93-
g = tensorium.bssn.BSSNGrid(24, 24, 24, 4, 0.25, 0.25, 0.25)
94-
tensorium.bssn.minkowski(g)
93+
g = tensorium.z4c.Z4cGrid(24, 24, 24, 4, 0.25, 0.25, 0.25)
94+
tensorium.z4c.minkowski(g)
9595
alpha = g.alpha()
9696
print(alpha.shape, alpha.min(), alpha.max())
9797
PY
@@ -109,7 +109,7 @@ Runtime check:
109109
```bash
110110
python3 - <<'PY'
111111
import tensorium
112-
print("two_punctures_c:", tensorium.bssn.has_twopunctures_c())
112+
print("two_punctures_c:", tensorium.z4c.has_twopunctures_c())
113113
PY
114114
```
115115

@@ -118,8 +118,8 @@ Explicit TwoPuncturesC init:
118118
```bash
119119
python3 - <<'PY'
120120
import tensorium
121-
g = tensorium.bssn.BSSNGrid(64, 64, 64, 4, 0.125, 0.125, 0.125)
122-
tensorium.bssn.binary_bowen_york_puncture_twopunctures_c_init(
121+
g = tensorium.z4c.Z4cGrid(64, 64, 64, 4, 0.125, 0.125, 0.125)
122+
tensorium.z4c.binary_bowen_york_puncture_twopunctures_c_init(
123123
g,
124124
0.5, -1.0, 0.0, 0.0, [0.1, 0.0, 0.0], [0.0, 0.0, 0.0],
125125
0.5, 1.0, 0.0, 0.0, [-0.1, 0.0, 0.0], [0.0, 0.0, 0.0],
@@ -152,6 +152,6 @@ PY
152152

153153
## Not Yet Exposed
154154

155-
- `BSSN_Grid` steppers and gauge runtime controls
155+
- `Z4c` steppers and gauge runtime controls
156156
- MPI-distributed paths and CUDA backends
157157
- High-level Python orchestration APIs for full NR runs

0 commit comments

Comments
 (0)