Skip to content

Commit 5835148

Browse files
authored
Merge pull request #69 from entity-toolkit/1.2.0rc
v1.2.0 release candidate
2 parents 97cc782 + 60c2bcf commit 5835148

253 files changed

Lines changed: 39572 additions & 8454 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.

.clang-format

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ IncludeCategories:
106106
Priority: 4
107107
- Regex: '^"engines\/.*\.h"'
108108
Priority: 4
109+
- Regex: '^"checkpoint\/.*\.h"'
110+
Priority: 4
109111
- Regex: '^"output\/.*\.h"'
110112
Priority: 4
111113
- Regex: '^"archetypes\/.*\.h"'

.github/workflows/actions.yml

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,44 @@
11
name: Unit tests
22

33
on:
4-
pull_request:
5-
branches:
6-
- '**rc'
7-
- 'master'
4+
push:
85

96
jobs:
7+
check-commit:
8+
runs-on: ubuntu-latest
9+
outputs:
10+
run_tests: ${{ steps.check_message.outputs.run_tests }}
11+
steps:
12+
- name: Checkout repository
13+
uses: actions/checkout@v4
14+
- name: Check commit message
15+
id: check_message
16+
run: |
17+
if git log -1 --pretty=%B | grep -q "RUNTEST"; then
18+
echo "run_tests=true" >> "$GITHUB_OUTPUT"
19+
else
20+
echo "run_tests=false" >> "$GITHUB_OUTPUT"
21+
fi
1022
tests:
23+
needs: check-commit
24+
if: needs.check-commit.outputs.run_tests == 'true'
1125
strategy:
1226
fail-fast: false
1327
matrix:
14-
device: [amd-gpu, nvidia-gpu]
28+
device: [cpu, amd-gpu, nvidia-gpu]
1529
precision: [double, single]
16-
exclude:
30+
mpi: [serial, parallel]
31+
exclude: # my AMD GPU doesn't support fp64 atomics : (
1732
- device: amd-gpu
1833
precision: double
19-
# my AMD GPUs doesn't support fp64 atomics : (
34+
- device: amd-gpu
35+
mpi: parallel
36+
- device: nvidia-gpu
37+
mpi: parallel
2038
runs-on: [self-hosted, "${{ matrix.device }}"]
2139
steps:
2240
- name: Checkout
23-
uses: actions/checkout@v3.3.0
41+
uses: actions/checkout@v4
2442
- name: Configure
2543
run: |
2644
if [ "${{ matrix.device }}" = "nvidia-gpu" ]; then
@@ -34,6 +52,8 @@ jobs:
3452
fi
3553
elif [ "${{ matrix.device }}" = "amd-gpu" ]; then
3654
FLAGS="-D Kokkos_ENABLE_HIP=ON -D Kokkos_ARCH_AMD_GFX1100=ON"
55+
elif [ "${{ matrix.mpi }}" = "parallel" ]; then
56+
FLAGS="-D mpi=ON"
3757
fi
3858
cmake -B build -D TESTS=ON -D output=ON -D precision=${{ matrix.precision }} $FLAGS
3959
- name: Compile

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ venv/
5151
# CMake testing files
5252
Testing/
5353

54+
tags
55+
.clangd
5456
.schema.json
5557
*_old/
5658
action-token
59+
*.vim
60+
ignore-*

.gitmodules

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
[submodule "extern/toml11"]
2-
path = extern/toml11
3-
url = https://github.com/ToruNiina/toml11.git
41
[submodule "extern/plog"]
52
path = extern/plog
63
url = https://github.com/SergiusTheBest/plog.git
74
[submodule "extern/adios2"]
85
path = extern/adios2
96
url = https://github.com/ornladios/ADIOS2.git
10-
branch = master
117
[submodule "extern/Kokkos"]
128
path = extern/Kokkos
139
url = https://github.com/kokkos/kokkos.git
10+
[submodule "extern/entity-pgens"]
11+
path = extern/entity-pgens
12+
url = https://github.com/entity-toolkit/entity-pgens.git

.taplo.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[formatting]
2+
align_entries = true
3+
indent_tables = true
4+
indent_entries = true
5+
trailing_newline = true
6+
align_comments = true

.vscode/.taplo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
include = ["input.example.toml", "setups/**/*.toml"]
1+
include = ["input.example.toml", "pgens/**/*.toml"]
22
exclude = [".taplo.toml"]
33

44
[formatting]

CMakeLists.txt

Lines changed: 79 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
1+
# cmake-lint: disable=C0103,C0111,E1120,R0913,R0915
2+
13
cmake_minimum_required(VERSION 3.16)
24
cmake_policy(SET CMP0110 NEW)
35

46
set(PROJECT_NAME entity)
57

68
project(
79
${PROJECT_NAME}
8-
VERSION 1.1.1
10+
VERSION 1.2.0
911
LANGUAGES CXX C)
1012
add_compile_options("-D ENTITY_VERSION=\"${PROJECT_VERSION}\"")
11-
execute_process(COMMAND
12-
bash -c "git diff --quiet src/ && echo $(git rev-parse HEAD) || echo $(git rev-parse HEAD)-mod"
13+
set(hash_cmd "git diff --quiet src/ && echo $(git rev-parse HEAD) ")
14+
string(APPEND hash_cmd "|| echo $(git rev-parse HEAD)-mod")
15+
execute_process(
16+
COMMAND bash -c ${hash_cmd}
1317
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
1418
OUTPUT_VARIABLE GIT_HASH
15-
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE
16-
)
19+
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
1720
message(STATUS "Git hash: ${GIT_HASH}")
1821
add_compile_options("-D ENTITY_GIT_HASH=\"${GIT_HASH}\"")
1922

@@ -25,100 +28,115 @@ include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/defaults.cmake)
2528

2629
# defaults
2730
set(DEBUG
28-
${default_debug}
29-
CACHE BOOL "Debug mode")
31+
${default_debug}
32+
CACHE BOOL "Debug mode")
3033

3134
set(precision
32-
${default_precision}
33-
CACHE STRING "Precision")
35+
${default_precision}
36+
CACHE STRING "Precision")
3437
set(pgen
35-
${default_pgen}
36-
CACHE STRING "Problem generator")
38+
${default_pgen}
39+
CACHE STRING "Problem generator")
3740

3841
set(gui
39-
${default_gui}
40-
CACHE BOOL "Use GUI [nttiny]")
42+
${default_gui}
43+
CACHE BOOL "Use GUI [nttiny]")
4144
set(output
42-
${default_output}
43-
CACHE BOOL "Enable output")
45+
${default_output}
46+
CACHE BOOL "Enable output")
4447
set(mpi
45-
${default_mpi}
46-
CACHE BOOL "Use MPI")
48+
${default_mpi}
49+
CACHE BOOL "Use MPI")
50+
51+
set(gpu_aware_mpi
52+
${default_gpu_aware_mpi}
53+
CACHE BOOL "Enable GPU-aware MPI")
4754

4855
# -------------------------- Compilation settings -------------------------- #
4956
set(CMAKE_CXX_STANDARD 17)
5057
set(CMAKE_CXX_STANDARD_REQUIRED ON)
58+
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
5159

5260
if(${DEBUG} STREQUAL "OFF")
5361
set(CMAKE_BUILD_TYPE
54-
Release
55-
CACHE STRING "CMake build type")
62+
Release
63+
CACHE STRING "CMake build type")
5664
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNDEBUG")
5765
else()
5866
set(CMAKE_BUILD_TYPE
59-
Debug
60-
CACHE STRING "CMake build type")
67+
Debug
68+
CACHE STRING "CMake build type")
6169
set(CMAKE_CXX_FLAGS
62-
"${CMAKE_CXX_FLAGS} -DDEBUG -Wall -Wextra -Wno-unknown-pragmas")
70+
"${CMAKE_CXX_FLAGS} -DDEBUG -Wall -Wextra -Wno-unknown-pragmas")
6371
endif()
6472

65-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-local-typedefs")
66-
6773
# options
6874
set(precisions
69-
"single" "double"
70-
CACHE STRING "Precisions")
75+
"single" "double"
76+
CACHE STRING "Precisions")
7177

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

7480
# ------------------------- Third-Party Tests ------------------------------ #
7581
set(BUILD_TESTING
76-
OFF
77-
CACHE BOOL "Build tests")
82+
OFF
83+
CACHE BOOL "Build tests")
7884

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

83-
find_or_fetch_dependency(Kokkos FALSE)
84-
find_or_fetch_dependency(plog TRUE)
85-
find_or_fetch_dependency(toml11 TRUE)
88+
find_or_fetch_dependency(Kokkos FALSE QUIET)
89+
find_or_fetch_dependency(plog TRUE QUIET)
8690
set(DEPENDENCIES Kokkos::kokkos)
8791
include_directories(${plog_SRC}/include)
88-
include_directories(${toml11_SRC})
8992

9093
# -------------------------------- Main code ------------------------------- #
9194
set_precision(${precision})
95+
if("${Kokkos_DEVICES}" MATCHES "CUDA")
96+
add_compile_options("-D CUDA_ENABLED")
97+
set(DEVICE_ENABLED ON)
98+
add_compile_options("-D DEVICE_ENABLED")
99+
elseif("${Kokkos_DEVICES}" MATCHES "HIP")
100+
add_compile_options("-D HIP_ENABLED")
101+
set(DEVICE_ENABLED ON)
102+
add_compile_options("-D DEVICE_ENABLED")
103+
elseif("${Kokkos_DEVICES}" MATCHES "SYCL")
104+
add_compile_options("-D SYCL_ENABLED")
105+
set(DEVICE_ENABLED ON)
106+
add_compile_options("-D DEVICE_ENABLED")
107+
else()
108+
set(DEVICE_ENABLED OFF)
109+
endif()
110+
111+
if(("${Kokkos_DEVICES}" MATCHES "CUDA")
112+
OR ("${Kokkos_DEVICES}" MATCHES "HIP")
113+
OR ("${Kokkos_DEVICES}" MATCHES "SYCL"))
114+
set(DEVICE_ENABLED ON)
115+
else()
116+
set(DEVICE_ENABLED OFF)
117+
endif()
92118

93119
# MPI
94120
if(${mpi})
95-
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/MPIConfig.cmake)
121+
find_or_fetch_dependency(MPI FALSE REQUIRED)
122+
include_directories(${MPI_CXX_INCLUDE_PATH})
123+
add_compile_options("-D MPI_ENABLED")
96124
set(DEPENDENCIES ${DEPENDENCIES} MPI::MPI_CXX)
125+
if(${DEVICE_ENABLED})
126+
if(${gpu_aware_mpi})
127+
add_compile_options("-D GPU_AWARE_MPI")
128+
endif()
129+
else()
130+
set(gpu_aware_mpi
131+
OFF
132+
CACHE BOOL "Use explicit copy when using MPI + GPU")
133+
endif()
97134
endif()
98135

99136
# Output
100137
if(${output})
101-
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/adios2Config.cmake)
102-
find_or_fetch_dependency(adios2 FALSE)
103-
if (NOT DEFINED ENV{HDF5_ROOT})
104-
set(USE_CUSTOM_HDF5 OFF)
105-
if (DEFINED ENV{CONDA_PREFIX})
106-
execute_process(COMMAND bash -c "conda list | grep \"hdf5\" -q"
107-
RESULT_VARIABLE HDF5_INSTALLED)
108-
if (HDF5_INSTALLED EQUAL 0)
109-
set(HDF5_ROOT $ENV{CONDA_PREFIX})
110-
else()
111-
set(USE_CUSTOM_HDF5 ON)
112-
endif()
113-
else()
114-
set(USE_CUSTOM_HDF5 ON)
115-
endif()
116-
if (USE_CUSTOM_HDF5)
117-
message(FATAL_ERROR "HDF5_ROOT is not set. Please set it to the root of the HDF5 installation")
118-
endif()
119-
endif()
120-
find_package(HDF5 REQUIRED)
121-
138+
find_or_fetch_dependency(adios2 FALSE QUIET)
139+
add_compile_options("-D OUTPUT_ENABLED")
122140
if(${mpi})
123141
set(DEPENDENCIES ${DEPENDENCIES} adios2::cxx11_mpi)
124142
else()
@@ -131,14 +149,18 @@ link_libraries(${DEPENDENCIES})
131149
if(TESTS)
132150
# ---------------------------------- Tests --------------------------------- #
133151
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/tests.cmake)
152+
elseif(BENCHMARK)
153+
# ------------------------------ Benchmark --------------------------------- #
154+
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/benchmark.cmake)
134155
else()
135156
# ----------------------------------- GUI ---------------------------------- #
136157
if(${gui})
137-
find_or_fetch_dependency(nttiny FALSE)
158+
find_or_fetch_dependency(nttiny FALSE QUIET)
138159
endif()
139160

140161
# ------------------------------- Main source ------------------------------ #
141162
set_problem_generator(${pgen})
142163
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/src src)
143-
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/report.cmake)
144164
endif()
165+
166+
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/report.cmake)

CODE_OF_CONDUCT.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
This code of conduct outlines shared principles and expectations for all participants in our open-source project. It's here to keep things open, respectful, and simple for everyone. Anyone involved with using and developing the code are expected to follow these guidelines starting from the release version `1.2.0`.
2+
3+
# Open-source Principles
4+
- This project is fully open-source and does not belong to any individual or institution.
5+
- It is developed and maintained by our team of incredibly talented people, whose goal is to make it accessible to everyone with no expectation of credits.
6+
- Anyone is free to use, copy, modify, or distribute the code under the project's open license.
7+
- If you contribute something to the repository, it becomes part of the project and thus will also be regarded as open-source.
8+
9+
# Contributions and Credit
10+
- The only attribution we strongly encourage is a citation of either the code repository, or the corresponding method papers (coming soon).
11+
- All contributions are made voluntarily, and there is no expectation of recognition of isolated individuals.
12+
- There's no built-in expectation of credit or authorship for modules or changes pushed to the repository. Anyone is free to use any part of the code with no attribution to the author of any specific module or algorithm.
13+
- The code is there for everyone to use, and its only goal is to enable the community to produce exciting science!
14+
15+
# Roles in the Project
16+
- There are three informal roles:
17+
- users: anyone using the code;
18+
- contributors: users who have write access to the repository;
19+
- maintainers: contributors who also take care of organizational, administrative, and tech-support duties.
20+
- Role changes (user -> contributor or vice versa) are easy and open, and can be done by asking the maintainers.
21+
- Contributors are also expected to follow any shared guidelines -- whether discussed informally or written down -- around code-development things, such as committing, merging, and creating pull requests.
22+
- Maintainers have the most strict obligations of keeping the repository clean, managing pull-requests, issuing releases, documenting all the features and additions, writing unit tests, helping other users and contributors with any problems they encounter, etc.
23+
- To reiterate, regardless of the extent of involvement and help, there is absolutely no expectation of recognition or attribution on maintainers' end!
24+
25+
# Community and Participation
26+
- Everyone is welcome in the community.
27+
- Joining meetings on Zoom, using the Slack workspace, giving feedback, taking part in decision making and planning, or following development doesn't require any special status -- it's open to all.
28+
29+
Finally, while we cannot enforce it, we strongly encourage any projects that build on this code to be open source too. If you build upon this project, we welcome transparency and openness in spirit. You may contribute to the code as much or as little as you like; all effort is appreciated, none is required.

LICENSE

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,8 @@
11
BSD 3-Clause License
22

3-
Copyright (c) 2024, Princeton University (PU), and
4-
Princeton Plasma Physics Lab (PPPL).
3+
Copyright (c) 2021-present, Entity development team.
54
All rights reserved.
65

7-
Core developers (alphabetical order):
8-
* Alexander Chernoglazov
9-
* Benjamin Crinquand
10-
* Alisa Galishnikova
11-
* Hayk Hakobyan
12-
* Jens Mahlmann
13-
* Sasha Philippov
14-
* Arno Vanthieghem
15-
* Muni Zhou
16-
176
Redistribution and use in source and binary forms, with or without
187
modification, are permitted provided that the following conditions are met:
198

0 commit comments

Comments
 (0)