Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
123 commits
Select commit Hold shift + click to select a range
58ca99f
deposit test pgens
haykh Mar 15, 2025
9fcca0b
output domain shapes
haykh Mar 15, 2025
1e18874
i+di coord push for cart
haykh Mar 27, 2025
6967490
match.ds is now array
haykh Apr 3, 2025
e75f7e0
generalized uniform injector
haykh Apr 3, 2025
c340200
diff match boundaries in diff directions
haykh Apr 3, 2025
a3ed051
const specifier added to mesh methods
haykh Apr 3, 2025
83dad19
match.ds is now array
haykh Apr 3, 2025
62759fb
generalized uniform injector
haykh Apr 3, 2025
395e670
diff match boundaries in diff directions
haykh Apr 3, 2025
e535365
const specifier added to mesh methods
haykh Apr 3, 2025
0606afc
Merge branch 'dev/pgens' of github.com:entity-toolkit/entity into dev…
haykh Apr 4, 2025
98f5626
more general uniforminject class
haykh Apr 4, 2025
eab6f78
match.ds is now array
haykh Apr 3, 2025
b91268f
generalized uniform injector
haykh Apr 3, 2025
aaba83c
diff match boundaries in diff directions
haykh Apr 3, 2025
b4a79b7
const specifier added to mesh methods
haykh Apr 3, 2025
e879ca5
more general uniforminject class
haykh Apr 4, 2025
0feb1db
generalized uniform injector
haykh Apr 3, 2025
8be0487
merging
haykh Apr 5, 2025
85ae1d8
keepconst injector ready (untested)
haykh Apr 5, 2025
ddb706f
removed redundant piston distribution
LudwigBoess Apr 6, 2025
895ead3
updated injection to new UniformInjector behavior and use global doma…
LudwigBoess Apr 6, 2025
877f459
minor problem with flags
haykh Apr 7, 2025
45a1df0
i_edge passed in conduct BC
haykh Apr 7, 2025
cba889d
Merge branch 'dev/pgens' of github.com:entity-toolkit/entity into dev…
haykh Apr 7, 2025
8fb4b9f
fix global extent access
LudwigBoess Apr 7, 2025
8e0747b
mpi fixed
haykh Apr 7, 2025
2e3ae6b
safeguards for Dim
haykh Apr 7, 2025
b232265
fix bug in reading BC selection
LudwigBoess Apr 7, 2025
0ee06ce
new deposit scheme
haykh Apr 9, 2025
9a17030
keepconstinjector works
haykh Apr 9, 2025
7674780
keepconstinjector works
haykh Apr 9, 2025
6bb457b
cleanup before refactor
LudwigBoess Apr 10, 2025
1eb1e26
consistent type spidx_t & idx_t & dim_t
haykh Apr 12, 2025
3529036
better tests for pushers + extforce
haykh Apr 12, 2025
28f9d18
device compile flag passed + accuracy in pusher test
haykh Apr 14, 2025
a4ff094
(RUNTEST)
haykh Apr 14, 2025
63b848c
ROCm version in engine printer
haykh Apr 14, 2025
88800e2
alternative BC fields for testing
LudwigBoess Apr 14, 2025
124923e
README contribs
haykh Apr 16, 2025
ffe7045
turbulence setup
Apr 16, 2025
a2688b2
Merge branch 'dev/pgens' of github.com:entity-toolkit/entity into dev…
Apr 16, 2025
839ef20
Merge branch 'dev/pgens' of github.com:entity-toolkit/entity into dev…
haykh Apr 16, 2025
bf73008
deposit with ext curr + fix bug in current output
haykh Apr 16, 2025
2aabb1d
minor fix
haykh Apr 16, 2025
fdb07fd
shock
haykh Apr 17, 2025
7244912
bugfixes + ASCII comments
LudwigBoess Apr 17, 2025
503d46c
2temp maxwellian
haykh Apr 18, 2025
5d4d4ec
Merge branch 'dev/pgens' of github.com:entity-toolkit/entity into dev…
haykh Apr 18, 2025
7be845c
2temp maxwellian (fixed)
haykh Apr 18, 2025
5148488
added option for temperature ratio between electrons and protons
LudwigBoess Apr 18, 2025
28ccd7d
updated example shock parameters
LudwigBoess Apr 18, 2025
ec09669
removed redundant BC fields
LudwigBoess Apr 18, 2025
d9a39a6
stats output (kernels not finished)
haykh Apr 19, 2025
fdc9716
Merge branch 'dev/pgens' of github.com:entity-toolkit/entity into dev…
haykh Apr 19, 2025
bfbef1c
Merge branch 'dev/pgens' into dev/integerdeposit
haykh Apr 19, 2025
c2d44a2
bugfixes
LudwigBoess Apr 19, 2025
a8a3206
bugfix in temp calculation
LudwigBoess Apr 19, 2025
62d1ce4
change BCs routine
haykh Apr 20, 2025
c0361b0
Merge branch 'dev/integerdeposit' into bug/mpideposit
haykh Apr 21, 2025
5896e13
Merge pull request #101 from entity-toolkit/bug/mpideposit
haykh Apr 21, 2025
e0a7b18
rec setup BC + tested with MPI
haykh Apr 21, 2025
ec5c65c
inlined writer
haykh Apr 21, 2025
1f8db6c
minor print rm
haykh Apr 21, 2025
f82b681
new deposit scheme
haykh Apr 9, 2025
23822d2
Merge branch 'dev/integerdeposit' of github.com:entity-toolkit/entity…
haykh Apr 21, 2025
9b1d03e
2D turb almost done
Apr 21, 2025
67db7c4
2D turb almost done
Apr 21, 2025
496492f
Merge branch 'dev/pgens' of github.com:entity-toolkit/entity into dev…
Apr 21, 2025
d66c2b5
(RUNTEST)
haykh Apr 21, 2025
9bc0f2c
minor bug in enum test (RUNTEST)
haykh Apr 21, 2025
9c58aa4
accuracy in deposit test (RUNTEST)
haykh Apr 21, 2025
4794254
long double -> simtime_t
haykh Apr 21, 2025
e1ae598
acc in dep test
haykh Apr 21, 2025
ab85454
(RUNTEST)
haykh Apr 21, 2025
f609fb2
explicitly copying mpi buffers from GPU to CPU to solve GPU pinning i…
LudwigBoess Apr 21, 2025
d9a2e7f
turb done fully
Apr 21, 2025
d64dcee
bugfix
LudwigBoess Apr 21, 2025
ead3c51
ExternalCurrent rename to ext_current
Apr 22, 2025
d5cdbd9
proper comm test
haykh Apr 22, 2025
9b262e3
deptest fixed
haykh Apr 23, 2025
5602adf
turb
haykh Apr 23, 2025
561a3ff
turb escape
haykh Apr 23, 2025
e2c2b51
compile-time flag: mpi_device_copy
haykh Apr 23, 2025
b1ebdf1
higher order Faraday kernel implemented by @vanthieg
LudwigBoess Apr 23, 2025
0515a9d
example settings for higher order field solver
LudwigBoess Apr 23, 2025
4b670b4
bugfix
LudwigBoess Apr 23, 2025
88050f2
deposit test pgens
haykh Apr 24, 2025
37c5613
Merge branch 'dev/integerdeposit' of github.com:entity-toolkit/entity…
haykh Apr 24, 2025
1952708
added quotes
haykh Apr 24, 2025
30d0afd
mpi_device_copy default to OFF
haykh Apr 24, 2025
d71883c
rm coeff in match bcs
haykh Apr 24, 2025
5d7c254
reformat comm
haykh Apr 24, 2025
1eccfa4
Revert "example settings for higher order field solver"
LudwigBoess Apr 24, 2025
82cf56b
Revert "higher order Faraday kernel implemented by @vanthieg"
LudwigBoess Apr 24, 2025
d9f96f0
return older explicit copy for flds
haykh Apr 24, 2025
2b0c64a
patch for print size
haykh Apr 24, 2025
802916b
mpi flag bug in cmake
haykh Apr 24, 2025
e104c2e
Merge pull request #98 from entity-toolkit/dev/integerdeposit
haykh Apr 24, 2025
4db8033
mv pgens
haykh Apr 24, 2025
c375dce
Merge pull request #102 from entity-toolkit/dev/cpu_mpi_pointers
haykh Apr 25, 2025
d6558e6
gpu-aware-mpi flag added cmake + comms
haykh Apr 28, 2025
86ae954
weibel->streaming + experimental injector
haykh Apr 28, 2025
9175994
experimental maxwellian
haykh Apr 29, 2025
71e7799
weibel toml
haykh Apr 29, 2025
1f55143
pusher=none support
haykh Apr 29, 2025
deaf19a
turb bug fix
Apr 30, 2025
26a5658
Merge branch 'dev/pgens' of github.com:entity-toolkit/entity into dev…
Apr 30, 2025
d558d26
Merge branch 'dev/pgens' into dev/gpu-aware-mpi
haykh May 1, 2025
af74825
Merge pull request #105 from entity-toolkit/dev/gpu-aware-mpi
haykh May 1, 2025
82fc5d8
mag toml
haykh May 1, 2025
9ae1415
minimal samples added for external lib testing
haykh May 1, 2025
c7e6405
minimal mpi compile
haykh May 1, 2025
f8550dd
gpuawarempi added to minimal
haykh May 1, 2025
a4a3987
minor bug
haykh May 1, 2025
03d9f23
added simpler mpi test
haykh May 1, 2025
86d18ac
substep reports in minimal
haykh May 1, 2025
1d8c6c2
minor bug when output=OFF
haykh May 1, 2025
bed9c37
dev/nix for cuda
haykh May 2, 2025
ea6f71f
minimial simplified
haykh May 5, 2025
d3772bb
4.5.1->4.6.1 for kokkos
haykh May 5, 2025
5391a94
4.5.1->4.6.1 for kokkos
haykh May 5, 2025
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
39 changes: 37 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ set(mpi
${default_mpi}
CACHE BOOL "Use MPI")

set(gpu_aware_mpi
${default_gpu_aware_mpi}
CACHE BOOL "Enable GPU-aware MPI")

# -------------------------- Compilation settings -------------------------- #
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
Expand All @@ -57,8 +61,7 @@ if(${DEBUG} STREQUAL "OFF")
set(CMAKE_BUILD_TYPE
Release
CACHE STRING "CMake build type")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNDEBUG "
"-Wno-unused-local-typedefs -Wno-unknown-cuda-version")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNDEBUG")
else()
set(CMAKE_BUILD_TYPE
Debug
Expand Down Expand Up @@ -89,13 +92,45 @@ include_directories(${plog_SRC}/include)

# -------------------------------- Main code ------------------------------- #
set_precision(${precision})
if("${Kokkos_DEVICES}" MATCHES "CUDA")
add_compile_options("-D CUDA_ENABLED")
set(DEVICE_ENABLED ON)
add_compile_options("-D DEVICE_ENABLED")
elseif("${Kokkos_DEVICES}" MATCHES "HIP")
add_compile_options("-D HIP_ENABLED")
set(DEVICE_ENABLED ON)
add_compile_options("-D DEVICE_ENABLED")
elseif("${Kokkos_DEVICES}" MATCHES "SYCL")
add_compile_options("-D SYCL_ENABLED")
set(DEVICE_ENABLED ON)
add_compile_options("-D DEVICE_ENABLED")
else()
set(DEVICE_ENABLED OFF)
endif()

if(("${Kokkos_DEVICES}" MATCHES "CUDA")
OR ("${Kokkos_DEVICES}" MATCHES "HIP")
OR ("${Kokkos_DEVICES}" MATCHES "SYCL"))
set(DEVICE_ENABLED ON)
else()
set(DEVICE_ENABLED OFF)
endif()

# MPI
if(${mpi})
find_or_fetch_dependency(MPI FALSE REQUIRED)
include_directories(${MPI_CXX_INCLUDE_PATH})
add_compile_options("-D MPI_ENABLED")
set(DEPENDENCIES ${DEPENDENCIES} MPI::MPI_CXX)
if(${DEVICE_ENABLED})
if(${gpu_aware_mpi})
add_compile_options("-D GPU_AWARE_MPI")
endif()
else()
set(gpu_aware_mpi
OFF
CACHE BOOL "Use explicit copy when using MPI + GPU")
endif()
endif()

# Output
Expand Down
37 changes: 12 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,33 +10,20 @@ Our [detailed documentation](https://entity-toolkit.github.io/) includes everyth

[![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)

## Lead developers

☕ __Hayk Hakobyan__ {[@haykh](https://github.com/haykh)}

🥔 __Jens Mahlmann__ {[@jmahlmann](https://github.com/jmahlmann)}

💁‍♂️ __Alexander Chernoglazov__ {[@SChernoglazov](https://github.com/SChernoglazov)}

🧋 __Alisa Galishnikova__ {[@alisagk](https://github.com/alisagk)}

🐬 __Sasha Philippov__ {[@sashaph](https://github.com/sashaph)}

## Contributors (alphabetical)

🎸 __Ludwig Böss__ {[@LudwigBoess](https://github.com/LudwigBoess): PIC, framework}

👀 __Yangyang Cai__ {[@StaticObserver](https://github.com/StaticObserver): GRPIC}

🍵 __Benjamin Crinquand__ {[@bcrinquand](https://github.com/bcrinquand): GRPIC, cubed-sphere}

🚂 __Evgeny Gorbunov__ {[@Alcauchy](https://github.com/Alcauchy): PIC, framework}

:radio: __Siddhant Solanki__ {[@sidruns30](https://github.com/sidruns30): framework}

🤷 __Arno Vanthieghem__ {[@vanthieg](https://github.com/vanthieg): framework, PIC}

😺 __Muni Zhou__ {[@munizhou](https://github.com/munizhou): PIC}
* :guitar: Ludwig Böss {[@LudwigBoess](https://github.com/LudwigBoess)}
* :eyes: Yangyang Cai {[@StaticObserver](https://github.com/StaticObserver)}
* :person_tipping_hand: Alexander Chernoglazov {[@SChernoglazov](https://github.com/SChernoglazov)}
* :tea: Benjamin Crinquand {[@bcrinquand](https://github.com/bcrinquand)}
* :bubble_tea: Alisa Galishnikova {[@alisagk](https://github.com/alisagk)}
* :locomotive: Evgeny Gorbunov {[@Alcauchy](https://github.com/Alcauchy)}
* :coffee: Hayk Hakobyan {[@haykh](https://github.com/haykh)}
* :potato: Jens Mahlmann {[@jmahlmann](https://github.com/jmahlmann)}
* :dolphin: Sasha Philippov {[@sashaph](https://github.com/sashaph)}
* :radio: Siddhant Solanki {[@sidruns30](https://github.com/sidruns30)}
* :shrug: Arno Vanthieghem {[@vanthieg](https://github.com/vanthieg)}
* :cat: Muni Zhou {[@munizhou](https://github.com/munizhou)}

## Branch policy

Expand Down
22 changes: 22 additions & 0 deletions cmake/defaults.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,26 @@ else()
CACHE INTERNAL "Default flag for MPI")
endif()

if(DEFINED ENV{Entity_MPI_DEVICE_COPY})
set(default_mpi_device_copy
$ENV{Entity_MPI_DEVICE_COPY}
CACHE INTERNAL "Default flag for copying from device to host for MPI")
else()
set(default_mpi_device_copy
OFF
CACHE INTERNAL "Default flag for copying from device to host for MPI")
endif()

set_property(CACHE default_mpi PROPERTY TYPE BOOL)

if(DEFINED ENV{Entity_ENABLE_GPU_AWARE_MPI})
set(default_gpu_aware_mpi
$ENV{Entity_ENABLE_GPU_AWARE_MPI}
CACHE INTERNAL "Default flag for GPU-aware MPI")
else()
set(default_gpu_aware_mpi
ON
CACHE INTERNAL "Default flag for GPU-aware MPI")
endif()

set_property(CACHE default_gpu_aware_mpi PROPERTY TYPE BOOL)
2 changes: 1 addition & 1 deletion cmake/dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ function(find_or_fetch_dependency package_name header_only mode)
FetchContent_Declare(
${package_name}
GIT_REPOSITORY ${${package_name}_REPOSITORY}
GIT_TAG 4.5.01)
GIT_TAG 4.6.01)
else()
FetchContent_Declare(${package_name}
GIT_REPOSITORY ${${package_name}_REPOSITORY})
Expand Down
36 changes: 28 additions & 8 deletions cmake/report.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ printchoices(
${default_precision}
"${Blue}"
PRECISION_REPORT
36)
46)
printchoices(
"Output"
"output"
Expand All @@ -45,7 +45,7 @@ printchoices(
${default_output}
"${Green}"
OUTPUT_REPORT
36)
46)
printchoices(
"MPI"
"mpi"
Expand All @@ -54,7 +54,18 @@ printchoices(
OFF
"${Green}"
MPI_REPORT
36)
46)
if(${mpi} AND ${DEVICE_ENABLED})
printchoices(
"GPU-aware MPI"
"gpu_aware_mpi"
"${ON_OFF_VALUES}"
${gpu_aware_mpi}
OFF
"${Green}"
GPU_AWARE_MPI_REPORT
46)
endif()
printchoices(
"Debug mode"
"DEBUG"
Expand All @@ -63,7 +74,7 @@ printchoices(
OFF
"${Green}"
DEBUG_REPORT
36)
46)

if(NOT ${PROJECT_VERSION_TWEAK} EQUAL 0)
set(VERSION_SYMBOL "v${PROJECT_VERSION_MAJOR}." "${PROJECT_VERSION_MINOR}.")
Expand Down Expand Up @@ -111,13 +122,23 @@ string(REPLACE ";" "+" Kokkos_DEVICES "${Kokkos_DEVICES}")
string(
APPEND
REPORT_TEXT
" - ARCH [${Magenta}Kokkos_ARCH_***${ColorReset}]: ${Kokkos_ARCH}"
" - ARCH [${Magenta}Kokkos_ARCH_***${ColorReset}]: "
"${Kokkos_ARCH}"
"\n"
" - DEVICES [${Magenta}Kokkos_ENABLE_***${ColorReset}]: ${Kokkos_DEVICES}"
" - DEVICES [${Magenta}Kokkos_ENABLE_***${ColorReset}]: "
"${Kokkos_DEVICES}"
"\n"
" "
${MPI_REPORT}
"\n"
"\n")

if(${mpi} AND ${DEVICE_ENABLED})
string(APPEND REPORT_TEXT " " ${GPU_AWARE_MPI_REPORT} "\n")
endif()

string(
APPEND
REPORT_TEXT
" "
${DEBUG_REPORT}
"\n"
Expand Down Expand Up @@ -155,7 +176,6 @@ if(${Kokkos_DEVICES} MATCHES "CUDA")
COMMAND bash -c ${cmd}
OUTPUT_VARIABLE CUDACOMP_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE)
message(STATUS "CUDACOMP: ${CUDACOMP_VERSION}")
string(
APPEND
REPORT_TEXT
Expand Down
9 changes: 7 additions & 2 deletions cmake/styling.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,6 @@ function(
if(${Padding} EQUAL 0)
list(LENGTH "${Choices}" nchoices)
math(EXPR lastchoice "${nchoices} - 1")
set(ncols 4)
math(EXPR lastcol "${ncols} - 1")

set(longest 0)
foreach(ch IN LISTS Choices)
Expand All @@ -97,6 +95,13 @@ function(
endif()
endforeach()

if(longest GREATER 20)
set(ncols 3)
else()
set(ncols 4)
endif()
math(EXPR lastcol "${ncols} - 1")

set(counter 0)
foreach(ch IN LISTS Choices)
if(NOT ${Value} STREQUAL "")
Expand Down
5 changes: 3 additions & 2 deletions cmake/tests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ add_subdirectory(${SRC_DIR}/metrics ${CMAKE_CURRENT_BINARY_DIR}/metrics)
add_subdirectory(${SRC_DIR}/kernels ${CMAKE_CURRENT_BINARY_DIR}/kernels)
add_subdirectory(${SRC_DIR}/archetypes ${CMAKE_CURRENT_BINARY_DIR}/archetypes)
add_subdirectory(${SRC_DIR}/framework ${CMAKE_CURRENT_BINARY_DIR}/framework)
add_subdirectory(${SRC_DIR}/output ${CMAKE_CURRENT_BINARY_DIR}/output)
if(${output})
add_subdirectory(${SRC_DIR}/output ${CMAKE_CURRENT_BINARY_DIR}/output)
add_subdirectory(${SRC_DIR}/checkpoint ${CMAKE_CURRENT_BINARY_DIR}/checkpoint)
endif()

Expand All @@ -25,8 +25,9 @@ elseif(${mpi} AND ${output})
list(APPEND TEST_DIRECTORIES framework)
endif()

list(APPEND TEST_DIRECTORIES output)

if(${output})
list(APPEND TEST_DIRECTORIES output)
list(APPEND TEST_DIRECTORIES checkpoint)
endif()

Expand Down
70 changes: 55 additions & 15 deletions dev/nix/kokkos.nix
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
{
pkgs ? import <nixpkgs> { },
stdenv,
arch,
gpu,
}:

let
name = "kokkos";
version = "4.5.01";
pversion = "4.6.01";
compilerPkgs = {
"HIP" = with pkgs.rocmPackages; [
rocm-core
Expand All @@ -16,15 +17,26 @@ let
rocminfo
rocm-smi
];
"CUDA" = with pkgs.cudaPackages; [
cudatoolkit
cuda_cudart
];
"NONE" = [
pkgs.gcc13
];
};
cmakeFlags = {
cmakeExtraFlags = {
"HIP" = [
"-D Kokkos_ENABLE_HIP=ON"
"-D Kokkos_ARCH_${getArch { }}=ON"
"-D CMAKE_C_COMPILER=hipcc"
"-D CMAKE_CXX_COMPILER=hipcc"
];
"CUDA" = [
"-D Kokkos_ENABLE_CUDA=ON"
"-D Kokkos_ARCH_${getArch { }}=ON"
"-D CMAKE_CXX_COMPILER=$WRAPPER_PATH"
];
"NONE" = [ ];
};
getArch =
Expand All @@ -35,13 +47,13 @@ let
arch;

in
pkgs.stdenv.mkDerivation {
pkgs.stdenv.mkDerivation rec {
pname = "${name}";
version = "${version}";
version = "${pversion}";
src = pkgs.fetchgit {
url = "https://github.com/kokkos/kokkos/";
rev = "${version}";
sha256 = "sha256-cI2p+6J+8BRV5fXTDxxHTfh6P5PeeLUiF73o5zVysHQ=";
rev = "${pversion}";
sha256 = "sha256-+yszUbdHqhIkJZiGLZ9Ln4DYUosuJWKhO8FkbrY0/tY=";
};

nativeBuildInputs = with pkgs; [
Expand All @@ -50,14 +62,42 @@ pkgs.stdenv.mkDerivation {

propagatedBuildInputs = compilerPkgs.${gpu};

cmakeFlags = [
"-D CMAKE_CXX_STANDARD=17"
"-D CMAKE_CXX_EXTENSIONS=OFF"
"-D CMAKE_POSITION_INDEPENDENT_CODE=TRUE"
"-D Kokkos_ARCH_${getArch { }}=ON"
(if gpu != "none" then "-D Kokkos_ENABLE_${gpu}=ON" else "")
"-D CMAKE_BUILD_TYPE=Release"
] ++ cmakeFlags.${gpu};
patchPhase =
if gpu == "CUDA" then
''
export WRAPPER_PATH="$(mktemp -d)/nvcc_wrapper"
cp ${src}/bin/nvcc_wrapper $WRAPPER_PATH
substituteInPlace $WRAPPER_PATH --replace-fail "#!/usr/bin/env bash" "#!${stdenv.shell}"
chmod +x "$WRAPPER_PATH"
''
else
"";

configurePhase = ''
cmake -B build -D CMAKE_BUILD_TYPE=Release \
-D CMAKE_CXX_STANDARD=17 \
-D CMAKE_CXX_EXTENSIONS=OFF \
-D CMAKE_POSITION_INDEPENDENT_CODE=TRUE \
${pkgs.lib.concatStringsSep " " cmakeExtraFlags.${gpu}} \
-D CMAKE_INSTALL_PREFIX=$out
'';

buildPhase = ''
cmake --build build -j
'';

installPhase = ''
cmake --install build
'';

# cmakeFlags = [
# "-D CMAKE_CXX_STANDARD=17"
# "-D CMAKE_CXX_EXTENSIONS=OFF"
# "-D CMAKE_POSITION_INDEPENDENT_CODE=TRUE"
# "-D Kokkos_ARCH_${getArch { }}=ON"
# (if gpu != "none" then "-D Kokkos_ENABLE_${gpu}=ON" else "")
# "-D CMAKE_BUILD_TYPE=Release"
# ] ++ (cmakeExtraFlags.${gpu} src);

enableParallelBuilding = true;
# enableParallelBuilding = true;
}
Loading