Skip to content

Commit 51e3796

Browse files
authored
Merge pull request #7 from haykh/dev/main
Dev/main
2 parents 5d853a2 + 241bccd commit 51e3796

Some content is hidden

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

70 files changed

+2089
-885
lines changed

.gitmodules

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@
2121
branch = master
2222
[submodule "extern/fmt"]
2323
path = extern/fmt
24-
url = https://github.com/fmtlib/fmt.git
24+
url = https://github.com/fmtlib/fmt.git

.vscode/c_cpp_properties.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"${workspaceFolder}/build/extern/kokkos/",
99
"${workspaceFolder}/build/extern/adios2/source/"
1010
],
11-
"myCompilerPath": "/usr/bin/g++"
11+
"myCompilerPath": "g++"
1212
},
1313
"configurations": [
1414
{

.vscode/settings.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,8 @@
121121
"cmake.buildDirectory": "${workspaceFolder}/build",
122122
"cmake.configureSettings": {
123123
"output": "OFF",
124-
"nttiny": "ON",
124+
"nttiny": "OFF",
125125
"Kokkos_ENABLE_OPENMP": "ON",
126-
"pgen": "langmuir"
126+
"pgen": "weibel"
127127
},
128128
}

CMakeLists.txt

+26-11
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ cmake_minimum_required(VERSION 3.16)
33
set(PROJECT_NAME entity)
44

55
project(${PROJECT_NAME}
6-
VERSION 0.8.0.9
6+
VERSION 0.8.2.1
77
LANGUAGES CXX
88
)
99

1010
# ----------------------------- Submodules ------------------------------- #
11+
# !TODO: this is quite ugly, update submodules as needed (below)
1112
find_package(Git QUIET)
1213

1314
file(GLOB SUBMODULES_LOADED extern/kokkos/*)
@@ -24,6 +25,7 @@ if(GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git" AND NOT ${SUBMODULES_LOADED
2425

2526
if(GIT_SUBMODULE)
2627
message(STATUS "Updating all the submodules")
28+
message(STATUS " During the first-time configure this may take a couple of minutes")
2729
execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --remote --recursive
2830
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
2931
RESULT_VARIABLE GIT_SUBMOD_RESULT)
@@ -131,7 +133,7 @@ else()
131133
message(STATUS "Debug mode")
132134
endif()
133135

134-
# ---------------------------------- tests --------------------------------- #
136+
# ---------------------------------- Tests --------------------------------- #
135137
set(BUILD_TESTING OFF CACHE BOOL "Build tests")
136138

137139
if(${BUILD_TESTING} STREQUAL "OFF")
@@ -143,17 +145,11 @@ endif()
143145
# ----------------------------------- GUI ---------------------------------- #
144146
set(nttiny ${default_nttiny} CACHE BOOL "Use nttiny GUI")
145147

146-
if(${nttiny} STREQUAL "ON")
147-
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/extern/nttiny extern/nttiny)
148-
endif()
149-
150148
# ----------------------------- Kokkos settings ---------------------------- #
151149
if(${Kokkos_ENABLE_CUDA})
152150
set(Kokkos_ENABLE_CUDA_LAMBDA ON CACHE BOOL "Enable CUDA lambda")
153151
endif()
154152

155-
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/extern/kokkos extern/kokkos)
156-
157153
# set memory space
158154
if(${Kokkos_ENABLE_CUDA})
159155
add_definitions(-DENABLE_GPU)
@@ -183,21 +179,40 @@ endif()
183179
set(output ${default_output} CACHE BOOL "Enable output")
184180

185181
if(${output} STREQUAL "ON")
182+
set(ADIOS2_BUILD_EXAMPLES OFF CACHE BOOL "Build ADIOS2 examples")
183+
# Language support
186184
set(ADIOS2_USE_Python OFF CACHE BOOL "Use Python for ADIOS2")
187185
set(ADIOS2_USE_Fortran OFF CACHE BOOL "Use Fortran for ADIOS2")
186+
# Format/compression support
187+
set(ADIOS2_USE_MPI OFF CACHE BOOL "Use MPI for ADIOS2")
188+
set(ADIOS2_USE_ZeroMQ OFF CACHE BOOL "Use ZeroMQ for ADIOS2")
189+
set(ADIOS2_USE_SST OFF CACHE BOOL "Use SST for ADIOS2")
190+
set(ADIOS2_USE_BZip2 OFF CACHE BOOL "Use BZip2 for ADIOS2")
191+
set(ADIOS2_USE_ZFP OFF CACHE BOOL "Use ZFP for ADIOS2")
192+
set(ADIOS2_USE_SZ OFF CACHE BOOL "Use SZ for ADIOS2")
193+
set(ADIOS2_USE_MGARD OFF CACHE BOOL "Use MGARD for ADIOS2")
194+
set(ADIOS2_USE_PNG OFF CACHE BOOL "Use PNG for ADIOS2")
195+
set(ADIOS2_USE_Blosc OFF CACHE BOOL "Use Blosc for ADIOS2")
196+
197+
# !TODO: add MPI-enabled ADIOS2
188198
set(ADIOS2_USE_MPI OFF CACHE BOOL "Use MPI for ADIOS2")
189-
set(ADIOS2_BUILD_EXAMPLES OFF CACHE BOOL "Build ADIOS2 examples")
190199

191200
# !TODO: add CUDA-enabled ADIOS2
192201
set(ADIOS2_USE_CUDA OFF CACHE BOOL "Use CUDA for ADIOS2")
193202

194203
# set(ADIOS2_USE_CUDA ${Kokkos_ENABLE_CUDA} CACHE BOOL "Use CUDA for ADIOS2")
195204
add_compile_options("-D OUTPUT_ENABLED")
196-
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/extern/adios2 extern/adios2)
197205
endif()
198206

199-
# ----------------------------------- fmt ---------------------------------- #
207+
# ------------------------------ Dependencies ------------------------------ #
208+
if(${nttiny} STREQUAL "ON")
209+
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/extern/nttiny extern/nttiny)
210+
endif()
211+
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/extern/kokkos extern/kokkos)
200212
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/extern/fmt extern/fmt)
213+
if (${output} STREQUAL "ON")
214+
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/extern/adios2 extern/adios2)
215+
endif()
201216

202217
# ------------------------------- Main source ------------------------------ #
203218
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/src src)

README.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
# `Entity` a.k.a. `ntt`
22
One particle-in-cell code to rule them all. Find our detailed documentation [here](https://haykh.github.io/entity/).
33

4-
![image](assets/cover.gif)
4+
<p align="center">
5+
<picture>
6+
<source media="(prefers-color-scheme: dark)" srcset="assets/cover_dark.gif">
7+
<source media="(prefers-color-scheme: light)" srcset="assets/cover_light.gif">
8+
<img alt="cover" src="assets/cover_light.gif">
9+
</picture>
10+
</p>
511

612
## Code contributors (alphabetical)
713

TASKLIST.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
- [ ] add diagnostics for nans in fields and particles
66
- [ ] add gravitationally bound atmosphere
77
- [x] rewrite UniformInjector with global random pool
8-
- [ ] add particle deletion routine
8+
- [?] add particle deletion routine
99
- [ ] make more user-friendly and understandable boundary conditions
1010
- [ ] refine output
1111
- [ ] fix bugs in `nttiny`
1212
- [x] delete plot removes all labels
1313
- [ ] add particles to `nttiny`
14-
- [ ] state should also save skip interval
14+
- [x] state should also save skip interval
1515
- [ ] (?) add autosave state
1616
- [x] why last cell does not work?
1717
- [ ] add different moments (momX, momY, momZ, meanGamma)

assets/cover.gif.REMOVED.git-id

-1
This file was deleted.

assets/cover_dark.gif

16 MB
Loading

assets/cover_light.gif

18 MB
Loading

extern/nttiny

extern/plog

template.toml renamed to input.toml.example

+8-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ qsph_r0 = <float: -infinity < ... < r_min>
99
qsph_h = <float: -1 < ... < 1>
1010
resolution = <array of int of size 1, 2 or 3>
1111
extent = <array of float of size 2, 4 or 6>, ex. [x1min, x1max, x2min, x2max, x3min, x3max]
12-
boundaries = <array of strings of size 1, 2 or 3: { "PERIODIC" | "ABSORB" | "OPEN" | "USER_BC" }>
12+
boundaries = <array of strings of size 1, 2 or 3: { "PERIODIC" | "ABSORB" | "OPEN" | "USER" }>
1313

1414
[algorithm]
1515
CFL = <float: 0.0 < ... < 1.0>
@@ -25,21 +25,25 @@ skindepth0 = <float>
2525

2626
[particles]
2727
n_species = <int>
28+
shuffle_step = <int>
29+
max_dead_frac = <float>
2830

2931
[species_<INT>]
3032
label = <string>
3133
mass = <float>
3234
charge = <float>
3335
maxnpart = <int>
34-
pusher = <string: { BORIS }>
36+
pusher = <string: { "Boris" }>
3537

3638
[problem]
3739
...
3840

3941
[visualization]
40-
fields = <array of strings, ex. ["Dr", "Dtheta", ...], see vis/nttiny.cpp for ref>
42+
fields = <array of strings, ex. ["Dr", "Dtheta", ...], see src/definitions.h for ref>
4143
fields_stride = <int>
4244

4345
[output]
46+
fields = <array of strings, ex. ["Dr", "Dtheta", ...], see src/definitions.h for ref>
4447
format = <string: { disabled, hdf5 }>
45-
interval = <int>
48+
mom_smooth = <int>
49+
interval = <int>

report.cmake

+43-43
Original file line numberDiff line numberDiff line change
@@ -224,36 +224,43 @@ PrintChoices("OpenMP"
224224
0
225225
42
226226
)
227+
227228
PrintChoices("C++ compiler"
228229
"CMAKE_CXX_COMPILER"
229-
"${CMAKE_CXX_COMPILER}"
230-
${CMAKE_CXX_COMPILER}
230+
"${CMAKE_CXX_COMPILER} v${CMAKE_CXX_COMPILER_VERSION}"
231+
"${CMAKE_CXX_COMPILER} v${CMAKE_CXX_COMPILER_VERSION}"
231232
"N/A"
232233
"${White}"
233-
COMPILERS_REPORT
234+
CXX_COMPILER_REPORT
234235
0
235236
42
236237
)
237238

238-
# check if empty
239-
if ("${CMAKE_CUDA_COMPILER}" STREQUAL "")
240-
execute_process(COMMAND which nvcc OUTPUT_VARIABLE CUDACOMP)
241-
else()
242-
set(CUDACOMP ${CMAKE_CUDA_COMPILER})
243-
endif()
244-
245239
if(${Kokkos_ENABLE_CUDA})
240+
# check if empty
241+
if ("${CMAKE_CUDA_COMPILER}" STREQUAL "")
242+
execute_process(COMMAND which nvcc OUTPUT_VARIABLE CUDACOMP)
243+
else()
244+
set(CUDACOMP ${CMAKE_CUDA_COMPILER})
245+
endif()
246+
247+
message(STATUS "CUDA compiler: ${CUDACOMP}")
248+
execute_process(COMMAND bash "-c"
249+
"${CUDACOMP} --version | grep release | sed -e 's/.*release //' -e 's/,.*//'"
250+
OUTPUT_VARIABLE CUDACOMP_VERSION
251+
OUTPUT_STRIP_TRAILING_WHITESPACE)
252+
246253
PrintChoices("CUDA compiler"
247254
"CMAKE_CUDA_COMPILER"
248-
"${CUDACOMP}"
249-
${CUDACOMP}
255+
"${CUDACOMP} v${CUDACOMP_VERSION}"
256+
"${CUDACOMP} v${CUDACOMP_VERSION}"
250257
"N/A"
251258
"${White}"
252259
CUDA_COMPILER_REPORT
253260
0
254261
42
255262
)
256-
set(COMPILERS_REPORT "${COMPILERS_REPORT}\n\n ${CUDA_COMPILER_REPORT}")
263+
# set(COMPILERS_REPORT "${COMPILERS_REPORT}\n\n ${CUDA_COMPILER_REPORT}")
257264
endif()
258265

259266
set(DOT_SYMBOL "${ColourReset}.")
@@ -280,42 +287,35 @@ ${DOT_SYMBOL}${Blue} /\\___/
280287
${DOT_SYMBOL}${Blue} \\/__/ ${DOT_SYMBOL}
281288
${DOT_SYMBOL} ${DOT_SYMBOL}
282289
${DOT_SYMBOL}${Blue} ${VERSION_SYMBOL} ${DOT_SYMBOL}
283-
${DOTTED_LINE_SYMBOL}
284-
285-
${DASHED_LINE_SYMBOL}
290+
${DOTTED_LINE_SYMBOL}")
291+
message("${DASHED_LINE_SYMBOL}
286292
Main configurations ${Dim}[1]${ColourReset}
287-
${DASHED_LINE_SYMBOL}
288-
${ENGINE_REPORT}
289-
290-
${METRIC_REPORT}
291-
292-
${PGEN_REPORT}
293-
294-
${PRECISION_REPORT}
295-
296-
${OUTPUT_REPORT}
297-
298-
${NTTINY_REPORT}
299-
${DASHED_LINE_SYMBOL}
293+
${DASHED_LINE_SYMBOL}")
294+
message(" ${ENGINE_REPORT}\n")
295+
message(" ${METRIC_REPORT}\n")
296+
message(" ${PGEN_REPORT}\n")
297+
message(" ${PRECISION_REPORT}\n")
298+
message(" ${OUTPUT_REPORT}\n")
299+
message(" ${NTTINY_REPORT}\n")
300+
message("${DASHED_LINE_SYMBOL}
300301
Framework configurations
301-
${DASHED_LINE_SYMBOL}
302-
${DEBUG_REPORT}
303-
304-
${FRAMEWORK_REPORT}
305-
306-
${ARCH_REPORT}
307-
308-
${CUDA_REPORT}
309-
310-
${OPENMP_REPORT}
311-
312-
${COMPILERS_REPORT}
313-
${DASHED_LINE_SYMBOL}
302+
${DASHED_LINE_SYMBOL}")
303+
message(" ${DEBUG_REPORT}\n")
304+
message(" ${FRAMEWORK_REPORT}\n")
305+
if (NOT "${ARCH_REPORT}" STREQUAL "")
306+
message(" ${ARCH_REPORT}\n")
307+
endif()
308+
message(" ${CUDA_REPORT}\n")
309+
message(" ${OPENMP_REPORT}\n")
310+
message(" ${CXX_COMPILER_REPORT}\n")
311+
if (NOT "${CUDA_COMPILER_REPORT}" STREQUAL "")
312+
message(" ${CUDA_COMPILER_REPORT}\n")
313+
endif()
314+
message("${DASHED_LINE_SYMBOL}
314315
Notes
315316
${DASHED_LINE_SYMBOL}
316317
${Dim}[1] Set with `cmake ... -D ${Magenta}<FLAG>${ColourReset}${Dim}=<VALUE>`, the ${Underline}default${ColourReset}${Dim} value
317318
: will be used unless the variable is explicitly set.${ColourReset}
318-
319319
")
320320

321321
# message("This is normal")

src/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ add_library(${WRAPPER} STATIC)
5050
include_directories(${CMAKE_CURRENT_BINARY_DIR})
5151
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
5252
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/framework)
53+
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/framework/meshblock)
5354
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/framework/io)
5455
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/framework/utils)
5556
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/framework/vec_transforms)

src/config.h.in

+7
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,17 @@
99
# define STRINGIZE_DETAIL(x) #x
1010
# define LINE_STRING STRINGIZE(__LINE__)
1111

12+
# define NTTLog() \
13+
{ PLOGV_(ntt::LogFile); }
14+
15+
# define NTTFatal() \
16+
{ PLOGF_(ntt::LogFile); }
17+
1218
# define NTTHostError(msg) \
1319
{ \
1420
auto err \
1521
= fmt::format("# ERROR: {} : filename: {} : line: {}", msg, __FILE__, LINE_STRING); \
22+
NTTFatal(); \
1623
throw std::runtime_error(err); \
1724
}
1825

0 commit comments

Comments
 (0)