Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
137 commits
Select commit Hold shift + click to select a range
0269572
patch for mpich send buffr
haykh Jul 29, 2024
35ebe53
initial commit: modification to shock pgen to run magnetized shocks
LudwigBoess Aug 3, 2024
1920f44
Add bulk velocity as moment output.
Aug 22, 2024
bdd96be
Update input.
Aug 26, 2024
5132360
fix misunderstanding in setup
LudwigBoess Sep 5, 2024
cdfd285
fix sign error
LudwigBoess Sep 11, 2024
e24078c
fix sign error
LudwigBoess Sep 11, 2024
37871f9
Merge branch 'pgen/magnetized_shock' of https://github.com/entity-too…
LudwigBoess Sep 11, 2024
0fc366c
Added comment for `InitFields`
LudwigBoess Sep 11, 2024
c3b1018
fix signs (again)
LudwigBoess Sep 23, 2024
d666d1e
removed redundant parameter and added comments
LudwigBoess Sep 23, 2024
0b65f55
added atmosphere bc to enforce initial magnetic field config at the b…
LudwigBoess Oct 2, 2024
4385c0d
Merge pull request #66 from entity-toolkit/bug/mpich
haykh Oct 15, 2024
cbeca51
proper output readwrite test
haykh Oct 16, 2024
de597cf
TODO marked
haykh Oct 16, 2024
f91ca40
added downsampling input param
haykh Oct 16, 2024
97cccfa
added field downsampling + test
haykh Oct 16, 2024
24691ea
added a cpu runner for actions (totest)
haykh Oct 16, 2024
e3d40c3
RUNTEST
haykh Oct 16, 2024
81f5df0
RUNTEST
haykh Oct 16, 2024
7b7382b
RUNTEST
haykh Oct 16, 2024
0a465ad
RUNTEST
haykh Oct 16, 2024
a52d07d
Bugfix in moment calculation.
Oct 16, 2024
0caddf9
WIP proper mpi test for checkpoints
haykh Oct 17, 2024
0cf9baf
bookkeeping for downsampling
Oct 23, 2024
a0b1ff2
correct downsampling of field output
Oct 24, 2024
905fb98
MPI write test
haykh Nov 4, 2024
af5ac78
cmake formatting
haykh Nov 4, 2024
8a6321b
proper gh action (hopefully)
haykh Nov 4, 2024
50c7b9b
readme (RUNTEST)
haykh Nov 4, 2024
6cd75c1
minor issue in cmake (RUNTEST)
haykh Nov 4, 2024
727eb1e
test fixed (RUNTEST)
haykh Nov 4, 2024
6bdbeb9
issues in writer tests (RUNTEST)
haykh Nov 4, 2024
cdd3e87
writer test -> Sync (RUNTEST)
haykh Nov 4, 2024
3c793cd
added flushall to tests (RUNTEST)
haykh Nov 4, 2024
c18162d
correct layout in tests (RUNTEST)
haykh Nov 4, 2024
bd477c2
Merge pull request #73 from entity-toolkit/dev/fielddwn
haykh Nov 5, 2024
96a295c
patch for mpich send buffr
haykh Jul 29, 2024
2344629
initial commit: modification to shock pgen to run magnetized shocks
LudwigBoess Aug 3, 2024
a5f3485
fix misunderstanding in setup
LudwigBoess Sep 5, 2024
6eb034f
fix sign error
LudwigBoess Sep 11, 2024
9d1b39b
Added comment for `InitFields`
LudwigBoess Sep 11, 2024
037c705
fix signs (again)
LudwigBoess Sep 23, 2024
a613d0a
removed redundant parameter and added comments
LudwigBoess Sep 23, 2024
31a7d5b
added atmosphere bc to enforce initial magnetic field config at the b…
LudwigBoess Oct 2, 2024
4f6ad9d
Merge branch 'pgen/magnetized_shock' of github.com:entity-toolkit/ent…
haykh Nov 5, 2024
78412c8
changed FieldBC to FIXED
haykh Nov 5, 2024
9834995
FIXED bc + ATM
haykh Nov 5, 2024
833f038
multifile output
haykh Nov 6, 2024
7c940f7
0 particle case in timers
haykh Nov 12, 2024
c1f5ab6
benchmark flow
haykh Dec 1, 2024
553bcae
added new particle array
Dec 2, 2024
cffc563
added new sendbuffer function
Dec 2, 2024
3c55ee7
fixed bug in CommunicateParticlesBuffer and created metadomain object…
Dec 3, 2024
5f1fe4a
Printing nparticles per domain
Dec 3, 2024
5b14e34
Printing particle count in domain
Dec 3, 2024
1b0993d
benchmark/benchmark.cpp
Dec 6, 2024
3202924
create mirror views for MPISendRecv in comm_mpi
Dec 12, 2024
831e7d9
fixed function to time old and new communication routines
Dec 12, 2024
896a957
bug fix in comm
Dec 16, 2024
9391c19
fmt
haykh Dec 16, 2024
c0d4652
tested prtlsort (WIP)
haykh Dec 16, 2024
646a208
removed tag_offset array from the particle class. The npart_per_tag()…
Dec 18, 2024
708115c
changed functions that called npart_per_tag()
Dec 18, 2024
d6a325b
changed comms to dispatch arrays of same type in one buffer
Dec 19, 2024
89a109d
test for cuda mpi
Dec 29, 2024
43924f5
fixed displacements
Dec 31, 2024
8571797
changed mpi init call
Dec 31, 2024
ea99f3b
fixed displacements
Jan 1, 2025
73377c2
fixed permute vector construction
Jan 4, 2025
0d18e5c
test of the number of particles
Jan 4, 2025
d7f92f0
added function to remove dead particles
Jan 5, 2025
510532b
Merge remote-tracking branch 'origin/dev/prtlsort' into dev/prtlsort
Jan 5, 2025
39f6c9f
testing: remove dead prtls
Jan 6, 2025
c54035f
testing removedeadparticles()
Jan 6, 2025
6ac585f
fixed dead particle removal bug
Jan 7, 2025
c719c1f
print mpi ranks during sendrecv
Jan 7, 2025
e43b716
changed communications in fields
Jan 7, 2025
42a6ea2
small change in metadomain header
Jan 7, 2025
530485c
bugfix for duplicate symbols
pmocz Jan 8, 2025
a570474
correct communications with boundaries
Jan 9, 2025
d63595f
added dead particle function
Jan 9, 2025
8fc0cd6
added header
Jan 9, 2025
0ef2312
hdf5_root -- optionally set
haykh Jan 22, 2025
16a4086
sort_interval -> clear_interval
haykh Jan 22, 2025
e2644a6
rm old sorting + added new comm
haykh Jan 22, 2025
541633e
toml schema
haykh Jan 22, 2025
9d0c8db
nix shells
haykh Jan 22, 2025
5d1d8f7
comment
haykh Jan 22, 2025
179928f
plds are now 2d array
haykh Jan 23, 2025
ad02663
comm kernels
haykh Jan 23, 2025
ea4366b
minor fix in tags
haykh Jan 23, 2025
29ef300
proper tag_offsets access
haykh Jan 23, 2025
3c85363
minor
haykh Jan 23, 2025
d376b6e
minor bug: tag access
haykh Jan 23, 2025
f7ec06e
inline if patched
haykh Jan 24, 2025
fed4e62
bug on gpus fixed
haykh Jan 24, 2025
7388d8e
pld comm
haykh Jan 24, 2025
4357cb3
pld comm
haykh Jan 24, 2025
6aa7a80
minor bug fixed in kernel
haykh Jan 28, 2025
3071251
nix devshell
haykh Jan 29, 2025
6aa045a
pld reading in checkpoint fixed
haykh Jan 29, 2025
649e328
clean benchmark
haykh Jan 29, 2025
3f2674c
cleanup prep for release
haykh Jan 29, 2025
2b6ef3c
tested with/without mpi cpu+hip
haykh Jan 29, 2025
842edf6
Merge pull request #77 from entity-toolkit/dev/prtlsort
haykh Jan 29, 2025
f2be35a
Merge branch '1.2.0rc' into dev/sepfiles
haykh Jan 29, 2025
803fb48
Merge pull request #75 from entity-toolkit/dev/sepfiles
haykh Jan 29, 2025
08bc485
rm conflicting file
haykh Jan 29, 2025
8b0f205
Merge pull request #81 from pmocz/dev/bugfix
haykh Jan 29, 2025
c9b4591
nix-shell upd
haykh Jan 29, 2025
c89ea77
kokkos v4.5.01 fixed
haykh Jan 29, 2025
e1d7d52
adios v2.10.2 fixed
haykh Jan 29, 2025
3e6a01e
plog v1.1.10 fixed
haykh Jan 29, 2025
17bff13
nix-shell
haykh Jan 29, 2025
e99bf5d
fix bug in Bfield setup
LudwigBoess Nov 13, 2024
4374f94
switch BCs to be consistent with Tristan
LudwigBoess Nov 13, 2024
2fbf906
rebase
haykh Jan 29, 2025
77e89e5
bcs cleared
haykh Jan 29, 2025
c7c9696
old tests passing
haykh Jan 29, 2025
f61d1b8
match field test
haykh Jan 29, 2025
f81a9a5
minor
haykh Jan 30, 2025
9ce606c
changed bc in setups
haykh Jan 30, 2025
bd4cf2d
Merge pull request #72 from entity-toolkit/pgen/magnetized_shock
haykh Jan 30, 2025
65e6d77
added siddhant
haykh Feb 4, 2025
e644b65
nix cfgs
haykh Mar 9, 2025
158c385
Add bulk velocity as moment output.
Aug 22, 2024
334a8b1
Update input.
Aug 26, 2024
d0c98ae
Bugfix in moment calculation.
Oct 16, 2024
e7976ca
minor bookkeeping for 3vel output
haykh Mar 9, 2025
c9d69ce
implemented and tested bulk V output
haykh Mar 9, 2025
e3bc62b
rebase to 1.2.0rc
haykh Mar 9, 2025
ebe6080
contribs
haykh Apr 1, 2025
08de689
rm tasks (RUNTEST)
haykh Apr 1, 2025
2132b33
bulk grpic prohibit (RUNTEST)
haykh Apr 1, 2025
0f2c91e
minor bug in tests (RUNTEST)
haykh Apr 1, 2025
a22cd96
minor bug in mpi-output tests (RUNTEST)
haykh Apr 1, 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
32 changes: 23 additions & 9 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,39 @@
name: Unit tests

on:
pull_request:
branches:
- '**rc'
- 'master'
push:

jobs:
check-commit:
runs-on: ubuntu-latest
outputs:
run_tests: ${{ steps.check_message.outputs.run_tests }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Check commit message
id: check_message
run: |
if git log -1 --pretty=%B | grep -q "RUNTEST"; then
echo "run_tests=true" >> "$GITHUB_OUTPUT"
else
echo "run_tests=false" >> "$GITHUB_OUTPUT"
fi
tests:
needs: check-commit
if: needs.check-commit.outputs.run_tests == 'true'
strategy:
fail-fast: false
matrix:
device: [amd-gpu, nvidia-gpu]
device: [cpu, amd-gpu, nvidia-gpu]
precision: [double, single]
exclude:
exclude: # my AMD GPU doesn't support fp64 atomics : (
- device: amd-gpu
precision: double
# my AMD GPU doesn't support fp64 atomics : (
runs-on: [self-hosted, "${{ matrix.device }}"]
if: contains(github.event.head_commit.message, 'totest')
steps:
- name: Checkout
uses: actions/checkout@v3.3.0
uses: actions/checkout@v4
- name: Configure
run: |
if [ "${{ matrix.device }}" = "nvidia-gpu" ]; then
Expand All @@ -35,6 +47,8 @@ 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
FLAGS="-D mpi=ON"
fi
cmake -B build -D TESTS=ON -D output=ON -D precision=${{ matrix.precision }} $FLAGS
- name: Compile
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ venv/
# CMake testing files
Testing/

tags
.clangd
.schema.json
*_old/
action-token
Expand Down
6 changes: 6 additions & 0 deletions .taplo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[formatting]
align_entries = true
indent_tables = true
indent_entries = true
trailing_newline = true
align_comments = true
77 changes: 37 additions & 40 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ project(
VERSION 1.2.0
LANGUAGES CXX C)
add_compile_options("-D ENTITY_VERSION=\"${PROJECT_VERSION}\"")
execute_process(COMMAND
bash -c "git diff --quiet src/ && echo $(git rev-parse HEAD) || 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"
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE GIT_HASH
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE
)
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
message(STATUS "Git hash: ${GIT_HASH}")
add_compile_options("-D ENTITY_GIT_HASH=\"${GIT_HASH}\"")

Expand All @@ -25,56 +26,57 @@ include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/defaults.cmake)

# defaults
set(DEBUG
${default_debug}
CACHE BOOL "Debug mode")
${default_debug}
CACHE BOOL "Debug mode")

set(precision
${default_precision}
CACHE STRING "Precision")
${default_precision}
CACHE STRING "Precision")
set(pgen
${default_pgen}
CACHE STRING "Problem generator")
${default_pgen}
CACHE STRING "Problem generator")

set(gui
${default_gui}
CACHE BOOL "Use GUI [nttiny]")
${default_gui}
CACHE BOOL "Use GUI [nttiny]")
set(output
${default_output}
CACHE BOOL "Enable output")
${default_output}
CACHE BOOL "Enable output")
set(mpi
${default_mpi}
CACHE BOOL "Use MPI")
${default_mpi}
CACHE BOOL "Use MPI")

# -------------------------- Compilation settings -------------------------- #
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

if(${DEBUG} STREQUAL "OFF")
set(CMAKE_BUILD_TYPE
Release
CACHE STRING "CMake build type")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNDEBUG")
Release
CACHE STRING "CMake build type")
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} -DNDEBUG -Wno-unused-local-typedefs -Wno-unknown-cuda-version"
)
else()
set(CMAKE_BUILD_TYPE
Debug
CACHE STRING "CMake build type")
Debug
CACHE STRING "CMake build type")
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} -DDEBUG -Wall -Wextra -Wno-unknown-pragmas")
"${CMAKE_CXX_FLAGS} -DDEBUG -Wall -Wextra -Wno-unknown-pragmas")
endif()

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-local-typedefs")

# options
set(precisions
"single" "double"
CACHE STRING "Precisions")
"single" "double"
CACHE STRING "Precisions")

include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/config.cmake)

# ------------------------- Third-Party Tests ------------------------------ #
set(BUILD_TESTING
OFF
CACHE BOOL "Build tests")
OFF
CACHE BOOL "Build tests")

# ------------------------ Third-party dependencies ------------------------ #
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/kokkosConfig.cmake)
Expand All @@ -98,21 +100,13 @@ endif()
if(${output})
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/adios2Config.cmake)
find_or_fetch_dependency(adios2 FALSE)
if (NOT DEFINED ENV{HDF5_ROOT})
set(USE_CUSTOM_HDF5 OFF)
if (DEFINED ENV{CONDA_PREFIX})
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)
RESULT_VARIABLE HDF5_INSTALLED)
if(HDF5_INSTALLED EQUAL 0)
set(HDF5_ROOT $ENV{CONDA_PREFIX})
else()
set(USE_CUSTOM_HDF5 ON)
endif()
else()
set(USE_CUSTOM_HDF5 ON)
endif()
if (USE_CUSTOM_HDF5)
message(FATAL_ERROR "HDF5_ROOT is not set. Please set it to the root of the HDF5 installation")
endif()
endif()
find_package(HDF5 REQUIRED)
Expand All @@ -129,6 +123,9 @@ link_libraries(${DEPENDENCIES})
if(TESTS)
# ---------------------------------- Tests --------------------------------- #
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/tests.cmake)
elseif(BENCHMARK)
# ------------------------------ Benchmark --------------------------------- #
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/benchmark.cmake)
else()
# ----------------------------------- GUI ---------------------------------- #
if(${gui})
Expand Down
24 changes: 16 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,29 @@ 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)

## Core developers (alphabetical)
## Lead developers

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

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

🍵 __Benjamin Crinquand__ {[@bcrinquand](https://github.com/bcrinquand): GRPIC, cubed-sphere}
💁‍♂️ __Alexander Chernoglazov__ {[@SChernoglazov](https://github.com/SChernoglazov)}

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

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

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

☕ __Hayk Hakobyan__ {[@haykh](https://github.com/haykh): framework, PIC, GRPIC, cubed-sphere}
🎸 __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}

🥔 __Jens Mahlmann__ {[@jmahlmann](https://github.com/jmahlmann): framework, MPI, cubed-sphere}
🚂 __Evgeny Gorbunov__ {[@Alcauchy](https://github.com/Alcauchy): PIC, framework}

🐬 __Sasha Philippov__ {[@sashaph](https://github.com/sashaph): all-around}
:radio: __Siddhant Solanki__ {[@sidruns30](https://github.com/sidruns30): framework}

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

Expand Down
5 changes: 0 additions & 5 deletions TASKLIST.md

This file was deleted.

17 changes: 17 additions & 0 deletions benchmark/benchmark.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include "global.h"

#include <iostream>
#include <stdexcept>

auto main(int argc, char* argv[]) -> int {
ntt::GlobalInitialize(argc, argv);
try {
// ...
} catch (const std::exception& e) {
std::cerr << "Error: " << e.what() << std::endl;
GlobalFinalize();
return 1;
}
GlobalFinalize();
return 0;
}
3 changes: 2 additions & 1 deletion cmake/MPIConfig.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
find_package(MPI REQUIRED)
include_directories(${MPI_CXX_INCLUDE_PATH})
add_compile_options("-D MPI_ENABLED")
add_compile_options("-D MPI_ENABLED")

24 changes: 18 additions & 6 deletions cmake/adios2Config.cmake
Original file line number Diff line number Diff line change
@@ -1,15 +1,27 @@
# ----------------------------- Adios2 settings ---------------------------- #
set(ADIOS2_BUILD_EXAMPLES OFF CACHE BOOL "Build ADIOS2 examples")
set(ADIOS2_BUILD_EXAMPLES
OFF
CACHE BOOL "Build ADIOS2 examples")

# Language support
set(ADIOS2_USE_Python OFF CACHE BOOL "Use Python for ADIOS2")
set(ADIOS2_USE_Fortran OFF CACHE BOOL "Use Fortran for ADIOS2")
set(ADIOS2_USE_Python
OFF
CACHE BOOL "Use Python for ADIOS2")
set(ADIOS2_USE_Fortran
OFF
CACHE BOOL "Use Fortran for ADIOS2")

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

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

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

add_compile_options("-D OUTPUT_ENABLED")
24 changes: 24 additions & 0 deletions cmake/benchmark.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
set(SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src)

add_subdirectory(${SRC_DIR}/global ${CMAKE_CURRENT_BINARY_DIR}/global)
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)

if(${output})
add_subdirectory(${SRC_DIR}/output ${CMAKE_CURRENT_BINARY_DIR}/output)
add_subdirectory(${SRC_DIR}/checkpoint ${CMAKE_CURRENT_BINARY_DIR}/checkpoint)
endif()

set(exec benchmark.xc)
set(src ${CMAKE_CURRENT_SOURCE_DIR}/benchmark/benchmark.cpp)

add_executable(${exec} ${src})

set(libs ntt_global ntt_metrics ntt_kernels ntt_archetypes ntt_framework)
if(${output})
list(APPEND libs ntt_output ntt_checkpoint)
endif()
add_dependencies(${exec} ${libs})
target_link_libraries(${exec} PRIVATE ${libs} stdc++fs)
31 changes: 23 additions & 8 deletions cmake/config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ function(set_precision precision_name)
list(FIND precisions ${precision_name} PRECISION_FOUND)

if(${PRECISION_FOUND} EQUAL -1)
message(FATAL_ERROR "Invalid precision: ${precision_name}\nValid options are: ${precisions}")
message(
FATAL_ERROR
"Invalid precision: ${precision_name}\nValid options are: ${precisions}"
)
endif()

if(${precision_name} STREQUAL "single")
Expand All @@ -13,19 +16,31 @@ endfunction()

# ---------------------------- Problem generator --------------------------- #
function(set_problem_generator pgen_name)
file(GLOB_RECURSE PGENS "${CMAKE_CURRENT_SOURCE_DIR}/setups/**/pgen.hpp" "${CMAKE_CURRENT_SOURCE_DIR}/setups/pgen.hpp")
file(GLOB_RECURSE PGENS "${CMAKE_CURRENT_SOURCE_DIR}/setups/**/pgen.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/setups/pgen.hpp")
foreach(PGEN ${PGENS})
get_filename_component(PGEN_NAME ${PGEN} DIRECTORY)
string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/setups/" "" PGEN_NAME ${PGEN_NAME})
string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/setups" "" PGEN_NAME ${PGEN_NAME})
string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/setups/" "" PGEN_NAME
${PGEN_NAME})
string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/setups" "" PGEN_NAME
${PGEN_NAME})
list(APPEND PGEN_NAMES ${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} PARENT_SCOPE)
set(PGEN
${pgen_name}
PARENT_SCOPE)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/setups/${pgen_name})
set(PGEN_FOUND TRUE PARENT_SCOPE)
set(problem_generators ${PGEN_NAMES} PARENT_SCOPE)
set(PGEN_FOUND
TRUE
PARENT_SCOPE)
set(problem_generators
${PGEN_NAMES}
PARENT_SCOPE)
endfunction()
Loading