Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
180 commits
Select commit Hold shift + click to select a range
3e1848a
prep for conductor boundaries
LudwigBoess Feb 21, 2025
bacbe24
first stubborn attempt at conductor boundaries (broken)
LudwigBoess Feb 21, 2025
2081a39
first attempt at ConductorBoundaries_kernel
LudwigBoess Feb 21, 2025
b7a863c
bugfix
LudwigBoess Feb 21, 2025
f383e49
first attempt at Kokkos::parallel_for loop (broken)
LudwigBoess Feb 21, 2025
7666918
Ongoing.
Feb 22, 2025
af06544
Ongoing.
Feb 22, 2025
0d3cc1c
Ongoing.
Feb 22, 2025
4a57c38
Ongoing.
Feb 22, 2025
ff5a3ee
Ongoing.
Feb 22, 2025
d6b2b1c
Ongoing.
Feb 22, 2025
f0ed6c7
Ongoing.
Feb 22, 2025
79d3237
Ongoing.
Feb 22, 2025
17b469b
Ongoing.
Feb 22, 2025
e234173
Ongoing.
Feb 22, 2025
de510ea
Ongoing.
Feb 22, 2025
0524d78
Ongoing.
Feb 23, 2025
9d78b9e
Ongoing.
Feb 23, 2025
cec22b0
Ongoing.
Feb 23, 2025
b3754e2
Ongoing.
Feb 23, 2025
83dba37
Ongoing.
Feb 23, 2025
a7ef051
Ongoing.
Feb 23, 2025
d219fc4
Ongoing.
Feb 23, 2025
044ccea
Ongoing.
Feb 23, 2025
2af41d8
Ongoing.
Feb 23, 2025
056c629
Ongoing.
Feb 23, 2025
7d9a1a3
Ongoing.
Feb 23, 2025
d8abf1b
Ongoing.
Feb 26, 2025
a17db62
Ongoing.
Feb 26, 2025
1d109a0
Ongoing.
Feb 27, 2025
bee7530
Ongoing.
Feb 27, 2025
2a269fd
Ongoing.
Feb 27, 2025
49820ff
Ongoing.
Feb 27, 2025
d2167da
first attempt at single particle injection
LudwigBoess Feb 28, 2025
fc3e647
Ongoing.
Feb 28, 2025
83c144f
Ongoing.
Feb 28, 2025
7c7c3f9
Ongoing.
Feb 28, 2025
939369e
Ongoing.
Feb 28, 2025
fa5a38f
Ongoing.
Feb 28, 2025
eeca02d
Ongoing.
Feb 28, 2025
c18840c
Ongoing.
Feb 28, 2025
9085afd
Ongoing.
Feb 28, 2025
87b37be
Ongoing.
Feb 28, 2025
5712e3b
Ongoing.
Feb 28, 2025
af258c6
Ongoing.
Feb 28, 2025
86f0597
Ongoing.
Feb 28, 2025
d0ce7c8
cleanup of conductor BCs
LudwigBoess Mar 3, 2025
0fd05b9
add 3D case and set correct boundary cells to zero
LudwigBoess Mar 3, 2025
425abe5
Ongoing
jmahlmann Mar 4, 2025
cfee51e
Ongoing
jmahlmann Mar 4, 2025
7d317e6
Ongoing
jmahlmann Mar 4, 2025
21d9937
Ongoing
jmahlmann Mar 4, 2025
bd723f3
minor reformatting of conductor BC
haykh Mar 7, 2025
28a02f1
filters adapted for conducting BCs
haykh Mar 7, 2025
b800b61
revert to old pgen for testing
LudwigBoess Mar 8, 2025
2b269f3
enforce B0/E0 at boundary
LudwigBoess Mar 8, 2025
9b23732
filter test fixed
haykh Mar 8, 2025
179fafe
removed extra kokkos flags
haykh Mar 9, 2025
db1a393
Merge branch 'dev/conductor_boundary' of github.com:entity-toolkit/en…
haykh Mar 9, 2025
b6fe114
revert to zero at boundary
LudwigBoess Mar 10, 2025
777d1fb
cleanup of pgen
LudwigBoess Mar 13, 2025
ef5c854
update example parameter file
LudwigBoess Mar 13, 2025
84e047c
revert to cleaner injector for shocktest
LudwigBoess Mar 19, 2025
69d4a0d
implemented new `arch::Piston` spatial distribution to set up shock p…
LudwigBoess Mar 20, 2025
e4d5979
fix inconsistency in return type
LudwigBoess Mar 20, 2025
cbc2021
Added `MovingInjector` (wip)
LudwigBoess Mar 21, 2025
70ea9af
Added `CustomPostStep` for shock pgen to continually inject particles…
LudwigBoess Mar 21, 2025
9727507
bugfix
LudwigBoess Mar 22, 2025
d7d12a3
added start time of injection and explicitly enforce injection region…
LudwigBoess Mar 22, 2025
6cf0dc8
small bugfix
LudwigBoess Mar 22, 2025
22a0479
shock pgen changed
haykh Mar 24, 2025
13da0dd
reduce resolution for faster test
LudwigBoess Mar 24, 2025
54f083f
cleanup and bugfix
LudwigBoess Mar 24, 2025
9f45d04
removed unnecessary parameter
LudwigBoess Mar 24, 2025
aa8b8e7
applied formatting to `MovingInjector`
LudwigBoess Mar 24, 2025
d0fb4ca
first attempt at moving-window injection
LudwigBoess Mar 31, 2025
4bcb1a2
extended field reset box to the right to squash waves propagating int…
LudwigBoess Apr 1, 2025
420f36f
bugfix: added check to truncate the injection box at the end of the d…
LudwigBoess Apr 1, 2025
df3fca1
exespace/memspace -> kokkos default + cmake flags changed
haykh Apr 1, 2025
18f02f6
fix unit conversion bug in field reset
LudwigBoess Apr 2, 2025
3ccdd4d
improved report + fetch adios2 + rm hdf5 dependency
haykh Apr 2, 2025
d1d999c
int type issues in mpi writer test
haykh Apr 3, 2025
4708d81
cmake prints report with TESTS
haykh Apr 4, 2025
4d75287
type+unused warnings fixed
haykh Apr 4, 2025
518071b
warnings in cmake + nullptr
haykh Apr 4, 2025
195de49
log level controlled from input
haykh Apr 4, 2025
e96a2d3
conductor in all directions
haykh Apr 4, 2025
af42012
prep for conductor boundaries
LudwigBoess Feb 21, 2025
7c6ddf4
first stubborn attempt at conductor boundaries (broken)
LudwigBoess Feb 21, 2025
9333b76
first attempt at ConductorBoundaries_kernel
LudwigBoess Feb 21, 2025
1565070
bugfix
LudwigBoess Feb 21, 2025
6a136fb
first attempt at Kokkos::parallel_for loop (broken)
LudwigBoess Feb 21, 2025
861e783
Ongoing.
Feb 22, 2025
cd81a5b
Ongoing.
Feb 22, 2025
aec0d41
Ongoing.
Feb 22, 2025
1c7105b
Ongoing.
Feb 22, 2025
de66f25
Ongoing.
Feb 22, 2025
2f8a01e
Ongoing.
Feb 22, 2025
2c7019b
Ongoing.
Feb 22, 2025
c041467
Ongoing.
Feb 22, 2025
b85346e
Ongoing.
Feb 22, 2025
b51a8bb
Ongoing.
Feb 22, 2025
f94e0fb
Ongoing.
Feb 22, 2025
7536825
Ongoing.
Feb 23, 2025
f313624
Ongoing.
Feb 23, 2025
dd6056e
Ongoing.
Feb 23, 2025
67a6a19
Ongoing.
Feb 23, 2025
679d037
Ongoing.
Feb 23, 2025
80043ef
Ongoing.
Feb 23, 2025
aff570e
Ongoing.
Feb 23, 2025
6d4eb13
Ongoing.
Feb 23, 2025
c3aa545
Ongoing.
Feb 23, 2025
f5d9bec
Ongoing.
Feb 23, 2025
2c2d595
Ongoing.
Feb 23, 2025
54b0222
Ongoing.
Feb 26, 2025
e023e37
Ongoing.
Feb 26, 2025
4254906
Ongoing.
Feb 27, 2025
20ae9a4
Ongoing.
Feb 27, 2025
9facba7
Ongoing.
Feb 27, 2025
8f0e72c
Ongoing.
Feb 27, 2025
cedf47a
first attempt at single particle injection
LudwigBoess Feb 28, 2025
77dc646
Ongoing.
Feb 28, 2025
afc0fe9
Ongoing.
Feb 28, 2025
c6a01f8
Ongoing.
Feb 28, 2025
4f3d261
Ongoing.
Feb 28, 2025
bec35fd
Ongoing.
Feb 28, 2025
400feb0
Ongoing.
Feb 28, 2025
906d276
Ongoing.
Feb 28, 2025
8bf2718
Ongoing.
Feb 28, 2025
5534983
Ongoing.
Feb 28, 2025
1a60a7a
Ongoing.
Feb 28, 2025
d50abcd
Ongoing.
Feb 28, 2025
fbdfb92
Ongoing.
Feb 28, 2025
b7bed42
cleanup of conductor BCs
LudwigBoess Mar 3, 2025
6249918
add 3D case and set correct boundary cells to zero
LudwigBoess Mar 3, 2025
268f35a
Ongoing
jmahlmann Mar 4, 2025
c4325e7
minor reformatting of conductor BC
haykh Mar 7, 2025
6e66aa2
filters adapted for conducting BCs
haykh Mar 7, 2025
81d51f9
filter test fixed
haykh Mar 8, 2025
8bb8428
removed extra kokkos flags
haykh Mar 9, 2025
b167d37
revert to old pgen for testing
LudwigBoess Mar 8, 2025
ec88a4f
enforce B0/E0 at boundary
LudwigBoess Mar 8, 2025
680b950
revert to zero at boundary
LudwigBoess Mar 10, 2025
de24703
cleanup of pgen
LudwigBoess Mar 13, 2025
a41bbe2
update example parameter file
LudwigBoess Mar 13, 2025
5d9fe73
revert to cleaner injector for shocktest
LudwigBoess Mar 19, 2025
6d43018
implemented new `arch::Piston` spatial distribution to set up shock p…
LudwigBoess Mar 20, 2025
4f5b1d8
fix inconsistency in return type
LudwigBoess Mar 20, 2025
3e9c4ac
Added `MovingInjector` (wip)
LudwigBoess Mar 21, 2025
e724b50
Added `CustomPostStep` for shock pgen to continually inject particles…
LudwigBoess Mar 21, 2025
236060b
bugfix
LudwigBoess Mar 22, 2025
2391bee
added start time of injection and explicitly enforce injection region…
LudwigBoess Mar 22, 2025
d67f6c7
small bugfix
LudwigBoess Mar 22, 2025
bb8e308
shock pgen changed
haykh Mar 24, 2025
31ef100
reduce resolution for faster test
LudwigBoess Mar 24, 2025
b324687
cleanup and bugfix
LudwigBoess Mar 24, 2025
2d1a454
removed unnecessary parameter
LudwigBoess Mar 24, 2025
b3ee77b
applied formatting to `MovingInjector`
LudwigBoess Mar 24, 2025
8d61ce8
first attempt at moving-window injection
LudwigBoess Mar 31, 2025
b2c738a
extended field reset box to the right to squash waves propagating int…
LudwigBoess Apr 1, 2025
fb16928
bugfix: added check to truncate the injection box at the end of the d…
LudwigBoess Apr 1, 2025
884a157
fix unit conversion bug in field reset
LudwigBoess Apr 2, 2025
3f4c565
conductor in all directions
haykh Apr 4, 2025
6ae91c9
minor formatting
haykh Apr 4, 2025
a31c9c7
rm TODOs
haykh Apr 4, 2025
58a6214
conductor filters in full 3D
haykh Apr 4, 2025
0303acf
rebase to 1.2.0rc
haykh Apr 4, 2025
0bee5ca
rebase to 1.2.0rc (attempt 2)
haykh Apr 4, 2025
dd8a35b
(RUNTEST)
haykh Apr 4, 2025
cb34e94
mpi tests fixed (RUNTEST)
haykh Apr 4, 2025
0bc510f
added non-mpi cpu test action (RUNTEST)
haykh Apr 4, 2025
3d2d60f
Merge pull request #84 from entity-toolkit/dev/conductor_boundary
haykh Apr 4, 2025
6643066
exespace/memspace -> kokkos default + cmake flags changed
haykh Apr 1, 2025
908c08a
improved report + fetch adios2 + rm hdf5 dependency
haykh Apr 2, 2025
9e22301
cmake prints report with TESTS
haykh Apr 4, 2025
004c6e9
type+unused warnings fixed
haykh Apr 4, 2025
b539a91
warnings in cmake + nullptr
haykh Apr 4, 2025
ec7ff77
log level controlled from input
haykh Apr 4, 2025
7bfb6c6
Merge branch 'dev/cleanup' of github.com:entity-toolkit/entity into d…
haykh Apr 4, 2025
8850ab9
warnings fixed
haykh Apr 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
7 changes: 6 additions & 1 deletion .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,14 @@ jobs:
matrix:
device: [cpu, amd-gpu, nvidia-gpu]
precision: [double, single]
mpi: [serial, parallel]
exclude: # my AMD GPU doesn't support fp64 atomics : (
- device: amd-gpu
precision: double
- device: amd-gpu
mpi: parallel
- device: nvidia-gpu
mpi: parallel
runs-on: [self-hosted, "${{ matrix.device }}"]
steps:
- name: Checkout
Expand All @@ -47,7 +52,7 @@ jobs:
fi
elif [ "${{ matrix.device }}" = "amd-gpu" ]; then
FLAGS="-D Kokkos_ENABLE_HIP=ON -D Kokkos_ARCH_AMD_GFX1100=ON"
elif [ "${{ matrix.device }}" = "cpu" ]; then
elif [ "${{ matrix.mpi }}" = "parallel" ]; then
FLAGS="-D mpi=ON"
fi
cmake -B build -D TESTS=ON -D output=ON -D precision=${{ matrix.precision }} $FLAGS
Expand Down
1 change: 0 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
[submodule "extern/adios2"]
path = extern/adios2
url = https://github.com/ornladios/ADIOS2.git
branch = master
[submodule "extern/Kokkos"]
path = extern/Kokkos
url = https://github.com/kokkos/kokkos.git
42 changes: 17 additions & 25 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# cmake-lint: disable=C0103,C0111,E1120,R0913,R0915

cmake_minimum_required(VERSION 3.16)
cmake_policy(SET CMP0110 NEW)

Expand All @@ -8,10 +10,10 @@ project(
VERSION 1.2.0
LANGUAGES CXX C)
add_compile_options("-D ENTITY_VERSION=\"${PROJECT_VERSION}\"")
set(hash_cmd "git diff --quiet src/ && echo $(git rev-parse HEAD) ")
string(APPEND hash_cmd "|| echo $(git rev-parse HEAD)-mod")
execute_process(
COMMAND
bash -c
"git diff --quiet src/ && echo $(git rev-parse HEAD) || echo $(git rev-parse HEAD)-mod"
COMMAND bash -c ${hash_cmd}
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE GIT_HASH
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
Expand Down Expand Up @@ -55,9 +57,8 @@ 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 "
"-Wno-unused-local-typedefs -Wno-unknown-cuda-version")
else()
set(CMAKE_BUILD_TYPE
Debug
Expand All @@ -79,11 +80,10 @@ set(BUILD_TESTING
CACHE BOOL "Build tests")

# ------------------------ Third-party dependencies ------------------------ #
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/kokkosConfig.cmake)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/dependencies.cmake)

find_or_fetch_dependency(Kokkos FALSE)
find_or_fetch_dependency(plog TRUE)
find_or_fetch_dependency(Kokkos FALSE QUIET)
find_or_fetch_dependency(plog TRUE QUIET)
set(DEPENDENCIES Kokkos::kokkos)
include_directories(${plog_SRC}/include)

Expand All @@ -92,25 +92,16 @@ set_precision(${precision})

# MPI
if(${mpi})
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/MPIConfig.cmake)
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)
endif()

# Output
if(${output})
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/adios2Config.cmake)
find_or_fetch_dependency(adios2 FALSE)
if(NOT DEFINED ENV{HDF5_ROOT})
if(DEFINED ENV{CONDA_PREFIX})
execute_process(COMMAND bash -c "conda list | grep \"hdf5\" -q"
RESULT_VARIABLE HDF5_INSTALLED)
if(HDF5_INSTALLED EQUAL 0)
set(HDF5_ROOT $ENV{CONDA_PREFIX})
endif()
endif()
endif()
find_package(HDF5 REQUIRED)

find_or_fetch_dependency(adios2 FALSE QUIET)
add_compile_options("-D OUTPUT_ENABLED")
if(${mpi})
set(DEPENDENCIES ${DEPENDENCIES} adios2::cxx11_mpi)
else()
Expand All @@ -129,11 +120,12 @@ elseif(BENCHMARK)
else()
# ----------------------------------- GUI ---------------------------------- #
if(${gui})
find_or_fetch_dependency(nttiny FALSE)
find_or_fetch_dependency(nttiny FALSE QUIET)
endif()

# ------------------------------- Main source ------------------------------ #
set_problem_generator(${pgen})
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/src src)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/report.cmake)
endif()

include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/report.cmake)
4 changes: 0 additions & 4 deletions cmake/MPIConfig.cmake

This file was deleted.

12 changes: 7 additions & 5 deletions cmake/adios2Config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,18 @@ set(ADIOS2_USE_Fortran
CACHE BOOL "Use Fortran for ADIOS2")

# Format/compression support
set(ADIOS2_USE_ZeroMQ
OFF
CACHE BOOL "Use ZeroMQ for ADIOS2")
set(ADIOS2_USE_HDF5
ON
CACHE BOOL "Use HDF5 for ADIOS2")

set(ADIOS2_USE_MPI
${mpi}
CACHE BOOL "Use MPI for ADIOS2")

set(ADIOS2_USE_ZeroMQ
OFF
CACHE BOOL "Use ZeroMQ for ADIOS2")

set(ADIOS2_USE_CUDA
OFF
CACHE BOOL "Use CUDA for ADIOS2")

add_compile_options("-D OUTPUT_ENABLED")
2 changes: 2 additions & 0 deletions cmake/benchmark.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# cmake-lint: disable=C0103

set(SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src)

add_subdirectory(${SRC_DIR}/global ${CMAKE_CURRENT_BINARY_DIR}/global)
Expand Down
8 changes: 4 additions & 4 deletions cmake/config.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# cmake-lint: disable=C0103

# -------------------------------- Precision ------------------------------- #
function(set_precision precision_name)
list(FIND precisions ${precision_name} PRECISION_FOUND)
Expand Down Expand Up @@ -28,10 +30,8 @@ function(set_problem_generator pgen_name)
endforeach()
list(FIND PGEN_NAMES ${pgen_name} PGEN_FOUND)
if(NOT ${pgen_name} STREQUAL "." AND ${PGEN_FOUND} EQUAL -1)
message(
FATAL_ERROR
"Invalid problem generator: ${pgen_name}\nValid options are: ${PGEN_NAMES}"
)
message(FATAL_ERROR "Invalid problem generator: "
"${pgen_name}\nValid options are: ${PGEN_NAMES}")
endif()
set(PGEN
${pgen_name}
Expand Down
40 changes: 3 additions & 37 deletions cmake/defaults.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# cmake-lint: disable=C0103

# ----------------------------- Defaults ---------------------------------- #
if(DEFINED ENV{Entity_ENABLE_DEBUG})
set(default_debug
Expand Down Expand Up @@ -33,7 +35,7 @@ if(DEFINED ENV{Entity_ENABLE_OUTPUT})
CACHE INTERNAL "Default flag for output")
else()
set(default_output
OFF
ON
CACHE INTERNAL "Default flag for output")
endif()

Expand All @@ -51,42 +53,6 @@ endif()

set_property(CACHE default_gui PROPERTY TYPE BOOL)

if(DEFINED ENV{Kokkos_ENABLE_CUDA})
set(default_KOKKOS_ENABLE_CUDA
$ENV{Kokkos_ENABLE_CUDA}
CACHE INTERNAL "Default flag for CUDA")
else()
set(default_KOKKOS_ENABLE_CUDA
OFF
CACHE INTERNAL "Default flag for CUDA")
endif()

set_property(CACHE default_KOKKOS_ENABLE_CUDA PROPERTY TYPE BOOL)

if(DEFINED ENV{Kokkos_ENABLE_HIP})
set(default_KOKKOS_ENABLE_HIP
$ENV{Kokkos_ENABLE_HIP}
CACHE INTERNAL "Default flag for HIP")
else()
set(default_KOKKOS_ENABLE_HIP
OFF
CACHE INTERNAL "Default flag for HIP")
endif()

set_property(CACHE default_KOKKOS_ENABLE_HIP PROPERTY TYPE BOOL)

if(DEFINED ENV{Kokkos_ENABLE_OPENMP})
set(default_KOKKOS_ENABLE_OPENMP
$ENV{Kokkos_ENABLE_OPENMP}
CACHE INTERNAL "Default flag for OpenMP")
else()
set(default_KOKKOS_ENABLE_OPENMP
OFF
CACHE INTERNAL "Default flag for OpenMP")
endif()

set_property(CACHE default_KOKKOS_ENABLE_OPENMP PROPERTY TYPE BOOL)

if(DEFINED ENV{Entity_ENABLE_MPI})
set(default_mpi
$ENV{Entity_ENABLE_MPI}
Expand Down
55 changes: 46 additions & 9 deletions cmake/dependencies.cmake
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
# cmake-lint: disable=C0103,C0111,R0915,R0912

set(Kokkos_REPOSITORY
https://github.com/kokkos/kokkos.git
CACHE STRING "Kokkos repository")
set(plog_REPOSITORY
https://github.com/SergiusTheBest/plog.git
CACHE STRING "plog repository")
set(adios2_REPOSITORY
https://github.com/ornladios/ADIOS2.git
CACHE STRING "ADIOS2 repository")

# set (adios2_REPOSITORY https://github.com/ornladios/ADIOS2.git CACHE STRING
# "ADIOS2 repository")
function(check_internet_connection)
if(OFFLINE STREQUAL "ON")
set(FETCHCONTENT_FULLY_DISCONNECTED
Expand Down Expand Up @@ -34,25 +37,28 @@ function(check_internet_connection)
endif()
endfunction()

function(find_or_fetch_dependency package_name header_only)
function(find_or_fetch_dependency package_name header_only mode)
if(NOT header_only)
find_package(${package_name} QUIET)
find_package(${package_name} ${mode})
endif()

if(NOT ${package_name}_FOUND)
if(${package_name} STREQUAL "Kokkos")
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/kokkosConfig.cmake)
elseif(${package_name} STREQUAL "adios2")
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/adios2Config.cmake)
endif()
if(DEFINED ${package_name}_REPOSITORY AND NOT
FETCHCONTENT_FULLY_DISCONNECTED)
# fetching package
message(
STATUS
"${Blue}${package_name} not found. Fetching from ${${package_name}_REPOSITORY}${ColorReset}"
)
message(STATUS "${Blue}${package_name} not found. "
"Fetching from ${${package_name}_REPOSITORY}${ColorReset}")
include(FetchContent)
if(${package_name} STREQUAL "Kokkos")
FetchContent_Declare(
${package_name}
GIT_REPOSITORY ${${package_name}_REPOSITORY}
GIT_TAG 4.3.00)
GIT_TAG 4.5.01)
else()
FetchContent_Declare(${package_name}
GIT_REPOSITORY ${${package_name}_REPOSITORY})
Expand All @@ -65,6 +71,9 @@ function(find_or_fetch_dependency package_name header_only)
set(${package_name}_SRC
${CMAKE_CURRENT_BINARY_DIR}/_deps/${lower_pckg_name}-src
CACHE PATH "Path to ${package_name} src")
set(${package_name}_BUILD_DIR
${CMAKE_CURRENT_BINARY_DIR}/_deps/${lower_pckg_name}-build
CACHE PATH "Path to ${package_name} build")
set(${package_name}_FETCHED
TRUE
CACHE BOOL "Whether ${package_name} was fetched")
Expand Down Expand Up @@ -127,7 +136,35 @@ function(find_or_fetch_dependency package_name header_only)
${Kokkos_VERSION}
CACHE INTERNAL "Kokkos version")
endif()
if(NOT DEFINED Kokkos_ARCH
OR Kokkos_ARCH STREQUAL ""
OR NOT DEFINED Kokkos_DEVICES
OR Kokkos_DEVICES STREQUAL "")
if(${Kokkos_FOUND})
include(${Kokkos_DIR}/KokkosConfigCommon.cmake)
elseif(NOT ${Kokkos_BUILD_DIR} STREQUAL "")
include(${Kokkos_BUILD_DIR}/KokkosConfigCommon.cmake)
else()
message(
STATUS "${Red}Kokkos_DIR and Kokkos_BUILD_DIR not set.${ColorReset}")
endif()
endif()
set(Kokkos_ARCH
${Kokkos_ARCH}
PARENT_SCOPE)
set(Kokkos_DEVICES
${Kokkos_DEVICES}
PARENT_SCOPE)
endif()
set(${package_name}_FOUND
${${package_name}_FOUND}
PARENT_SCOPE)
set(${package_name}_FETCHED
${${package_name}_FETCHED}
PARENT_SCOPE)
set(${package_name}_BUILD_DIR
${${package_name}_BUILD_DIR}
PARENT_SCOPE)
endfunction()

check_internet_connection()
47 changes: 2 additions & 45 deletions cmake/kokkosConfig.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# cmake-lint: disable=C0103

# ----------------------------- Kokkos settings ---------------------------- #
if(${DEBUG} STREQUAL "OFF")
set(Kokkos_ENABLE_AGGRESSIVE_VECTORIZATION
Expand Down Expand Up @@ -27,51 +29,6 @@ else()
CACHE BOOL "Kokkos debug bounds check")
endif()

set(Kokkos_ENABLE_HIP
${default_KOKKOS_ENABLE_HIP}
CACHE BOOL "Enable HIP")
set(Kokkos_ENABLE_CUDA
${default_KOKKOS_ENABLE_CUDA}
CACHE BOOL "Enable CUDA")
set(Kokkos_ENABLE_OPENMP
${default_KOKKOS_ENABLE_OPENMP}
CACHE BOOL "Enable OpenMP")

# set memory space
if(${Kokkos_ENABLE_CUDA})
add_compile_definitions(CUDA_ENABLED)
set(ACC_MEM_SPACE Kokkos::CudaSpace)
elseif(${Kokkos_ENABLE_HIP})
add_compile_definitions(HIP_ENABLED)
set(ACC_MEM_SPACE Kokkos::HIPSpace)
else()
set(ACC_MEM_SPACE Kokkos::HostSpace)
endif()

set(HOST_MEM_SPACE Kokkos::HostSpace)

# set execution space
if(${Kokkos_ENABLE_CUDA})
set(ACC_EXE_SPACE Kokkos::Cuda)
elseif(${Kokkos_ENABLE_HIP})
set(ACC_EXE_SPACE Kokkos::HIP)
elseif(${Kokkos_ENABLE_OPENMP})
set(ACC_EXE_SPACE Kokkos::OpenMP)
else()
set(ACC_EXE_SPACE Kokkos::Serial)
endif()

if(${Kokkos_ENABLE_OPENMP})
set(HOST_EXE_SPACE Kokkos::OpenMP)
else()
set(HOST_EXE_SPACE Kokkos::Serial)
endif()

add_compile_options("-D AccelExeSpace=${ACC_EXE_SPACE}")
add_compile_options("-D AccelMemSpace=${ACC_MEM_SPACE}")
add_compile_options("-D HostExeSpace=${HOST_EXE_SPACE}")
add_compile_options("-D HostMemSpace=${HOST_MEM_SPACE}")

if(${BUILD_TESTING} STREQUAL "OFF")
set(Kokkos_ENABLE_TESTS
OFF
Expand Down
Loading