Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
144 commits
Select commit Hold shift + click to select a range
993bdad
Update gitignore
cscjlan Aug 23, 2024
30c0845
Add googletesting with cmake/ctest integration
cscjlan Aug 23, 2024
e171768
Update gitignore
cscjlan Aug 23, 2024
5d8e425
Add .clang-format from vlasiator repository
cscjlan Aug 23, 2024
0ed2c1b
Format the file using the vlasiator clang-format file
cscjlan Aug 23, 2024
4aee4ff
Change struct with no members and only static functions to a namespace
cscjlan Aug 23, 2024
b5fd864
Move variables to the bottom
cscjlan Aug 23, 2024
de4b302
Add github action for building and running tests
cscjlan Aug 23, 2024
3875290
Update github action to install mpi
cscjlan Aug 23, 2024
ca0d2f5
Add MPI packages to include headers and libs
cscjlan Aug 23, 2024
447ee2b
Add a second, more verbose test step on failure
cscjlan Aug 23, 2024
21154e4
Fix github action
cscjlan Aug 23, 2024
ef0ab62
Explicitly install openmpi everytime
cscjlan Aug 23, 2024
3c5e61e
Remove package from install list
cscjlan Aug 23, 2024
7b27802
Fix mpi tests on github CI; Add CMake conf vars for changing mpirun f…
cscjlan Aug 26, 2024
6abacae
Split fsgrid to two files; Add src/ and include those in root/fsgrid.…
cscjlan Aug 27, 2024
7a8e27b
Simplify tools funcs; Add tests
cscjlan Aug 27, 2024
0f147b3
Fix integer overflows; Add tests
cscjlan Aug 27, 2024
ce7f652
Reformat file
cscjlan Aug 27, 2024
508e9dc
Change tertiary op to arithmetic op
cscjlan Aug 27, 2024
d0f663a
Return a value instead of taking a mut ref to it as input
cscjlan Aug 27, 2024
97d0278
Remove two test files
cscjlan Aug 27, 2024
4df3f2a
Simplify domainDecomposition computation, remove MPI from it. Move te…
cscjlan Aug 27, 2024
8fdc3c2
Simplify dd computation; Fix tests
cscjlan Aug 27, 2024
f8416ff
Update headers; Add test
cscjlan Aug 27, 2024
53f03ae
Rename variables; Remove unused variable
cscjlan Aug 28, 2024
f451d9f
Add display function to grid; Add test that outputs grid display; Ena…
cscjlan Aug 28, 2024
82475fc
Replace int with excpilictly sized int32_t
cscjlan Aug 28, 2024
7ef4132
Add default construction to all variables of fsgrid; Improve display …
cscjlan Aug 28, 2024
aade22a
Attempt to fix github action not finding testdata
cscjlan Aug 28, 2024
42bdfae
Attempt to fix github action not finding testdata 2
cscjlan Aug 28, 2024
466cca7
Remove unused members, add more grid construction tests
cscjlan Aug 29, 2024
2c88823
Add MPI status checking; Add tests for status checsk func
cscjlan Aug 29, 2024
91464bd
Use MPI_CHECK macro/function for checking MPI statuses
cscjlan Aug 29, 2024
598ba89
Remove unused parameter; Generate new reference strings; Add test
cscjlan Aug 29, 2024
0ec28d6
Add helper functions for testing; Add MPI_Datatype tests
cscjlan Aug 29, 2024
72229cb
Add status checks to MPI calls
cscjlan Aug 29, 2024
de0a31a
Improve test reference strings; they should be implementation indepen…
cscjlan Aug 29, 2024
d099e67
Improve test data printing
cscjlan Aug 29, 2024
f72e7a6
Update combiner test data to platform independent
cscjlan Aug 30, 2024
137e8f8
Improve mpi test output by outputting only on rank 0
cscjlan Aug 30, 2024
831493b
Update workflow to create a log file and to upload it
cscjlan Aug 30, 2024
df98ede
Change tests to output generated string first
cscjlan Aug 30, 2024
d9463f4
Fix workflow syntax
cscjlan Aug 30, 2024
51b702e
Upload test logs regardless of success
cscjlan Aug 30, 2024
d804508
Clean up constructor; rankToIndexMapping is broken
cscjlan Aug 30, 2024
cb90d9d
Fix rank-to-index mapping
cscjlan Sep 3, 2024
d2559ca
Simplify some bits
cscjlan Sep 3, 2024
1821d20
Remove unnecessary init
cscjlan Sep 9, 2024
7f1815c
Add output to failed tests
cscjlan Oct 14, 2024
7894ade
Clarify communicator creation; Tests don't pass yet.
cscjlan Oct 14, 2024
48630a5
Remove extra communicators; Fix test reference files
cscjlan Oct 15, 2024
8c65674
Rework constructor to initialize all members using initializer list
cscjlan Oct 15, 2024
6d2413b
Create helper structures for MPI functionality
cscjlan Oct 15, 2024
27a1a6b
Revert "Create helper structures for MPI functionality"
cscjlan Oct 15, 2024
6edcb49
Move cartesian grid related stuff to a separate file
cscjlan Oct 15, 2024
ad48cac
Move data and functions to a separate file. Tests don't compile yet
cscjlan Oct 15, 2024
244d50b
Revert "Move data and functions to a separate file. Tests don't compi…
cscjlan Oct 16, 2024
9d8f98b
Revert "Move cartesian grid related stuff to a separate file"
cscjlan Oct 16, 2024
aabf7cb
Revert "Revert "Create helper structures for MPI functionality""
cscjlan Oct 16, 2024
69ec86d
Revert "Create helper structures for MPI functionality"
cscjlan Oct 16, 2024
af7940d
Move static functions to a detail namespace
cscjlan Oct 16, 2024
cb31fb1
Reorder functions: now they're organized by 'type' of function; Remov…
cscjlan Oct 16, 2024
5efe7d6
Simplify array init
cscjlan Oct 16, 2024
b1c2b26
Add warnings to fsgrid compilation and fix them
cscjlan Oct 16, 2024
c299657
Move functions
cscjlan Oct 16, 2024
4c5eca7
Add explicit cast
cscjlan Oct 16, 2024
ad52e80
Add const getters
cscjlan Oct 16, 2024
33cd73f
Add consts; Change int32_ts to FsIndex_Ts; Rename function
cscjlan Oct 16, 2024
cc3f06f
Add test for local-to-global-to-local coordinate change
cscjlan Oct 16, 2024
f85ee13
Unify function names; Remove unused code;
cscjlan Oct 16, 2024
3317c1f
Add casts
cscjlan Oct 16, 2024
d5e7d5f
Add test
cscjlan Oct 16, 2024
74d60d8
Perform casts to avoid over and underflows
cscjlan Oct 16, 2024
599ce41
Add test for localID; Add function that checks local id is in bounds;…
cscjlan Oct 17, 2024
741ed86
Add comment
cscjlan Oct 17, 2024
107e935
Make variables const; Make variable private; Add arguments to constru…
cscjlan Oct 17, 2024
1b1a63f
Make members const, remove non-const accessors
cscjlan Oct 17, 2024
f6c49ae
Make DX, DY, DZ private, change it to physicalGridSpacing
cscjlan Oct 17, 2024
af1e67f
Move coordinate data to a separate struct
cscjlan Oct 17, 2024
a581db8
Move coordinate functionality to Coordinates
cscjlan Oct 17, 2024
88f2269
Make coordinates constexpr friendly; Add functions and tests
cscjlan Oct 18, 2024
1b1de39
Make functions constexpr friendly; Add debug assert
cscjlan Oct 18, 2024
28ef6ea
Add coordinates tests to cmake
cscjlan Oct 18, 2024
38d67a7
Simplify grid getter and add tests for it
cscjlan Oct 18, 2024
16c23c9
Remove unnecessary function call (which is not constexpr)
cscjlan Oct 18, 2024
ba94460
Replace nested for loops with a single loo
cscjlan Oct 21, 2024
fdfcaf6
Add destructor
cscjlan Nov 8, 2024
fc65291
Remove unnecessary header
cscjlan Nov 8, 2024
69050e0
Remove unused function; Redirect function to a newer version
cscjlan Nov 12, 2024
ad16c62
Remove debug functions; Remove temporary tests; Remove testdata
cscjlan Nov 12, 2024
1e67960
Move Fsgrid size checks outside fsgrid; Remove unnecessary functions;…
cscjlan Nov 12, 2024
332227d
Make variable const
cscjlan Nov 12, 2024
e76a90b
Replace macros with functions
cscjlan Nov 18, 2024
b96e472
Add bitmask struct and tests for it; Change namespace name;
cscjlan Nov 19, 2024
c49cb4e
Add function; Add tests
cscjlan Nov 20, 2024
1784d9a
Add FsStencil and some tests for it.
cscjlan Nov 20, 2024
0a7a7f2
Unify fsgrid_tools and fsgrid namespaces; Add functions for FsStencil…
cscjlan Nov 21, 2024
ea1b47a
Improve bitmask indexing
cscjlan Nov 21, 2024
317832c
Add test for old and new localID computation
cscjlan Nov 21, 2024
be4f8fe
Add a test
cscjlan Nov 21, 2024
a6af4e8
Add a comment; Remove a comment
cscjlan Dec 4, 2024
bc270ec
Add function & tests for checking cell validity
cscjlan Dec 9, 2024
8d47e65
Add function for FsStencil: return neigbour indices as an array
cscjlan Dec 13, 2024
c2ab3d2
Make i, j, k public for stencil
cscjlan Dec 13, 2024
d8d21b2
Make calculateIndex public
cscjlan Dec 13, 2024
32bfa6b
Add ghostcell check to cellExists; Add function for computing index a…
cscjlan Dec 13, 2024
3da6416
Remove old way of GETting data
cscjlan Dec 17, 2024
8b9a78c
Fix a bug in domain decomposition calculation
cscjlan Dec 18, 2024
96a37ea
Fix tests to work with the fixed version of domain decomposing
cscjlan Dec 18, 2024
e18f849
Add parallel_for
trossi Oct 8, 2024
4da107f
Enable updating ghost cells with different types
trossi Dec 18, 2024
3dc908b
Update C++ standard to C++20
cscjlan Dec 27, 2024
cae5c1a
Construct span on a single line
cscjlan Dec 27, 2024
918a422
Add OpenMP support for building tests
cscjlan Dec 27, 2024
1f8a935
Take span by value; It's only 16 bytes, reference is 8 bytes. Helps p…
cscjlan Jan 8, 2025
60ee39a
Rename file
cscjlan Jan 10, 2025
512bb2f
Add FsData struct
cscjlan Jan 10, 2025
5d64dfd
Add methods and tests
cscjlan Jan 10, 2025
2ffd806
Add usign statement: Choosing the memory operations for FsData can be…
cscjlan Jan 10, 2025
cb0b328
Change parallel_for to take in arguments in addition to lamda; Add an…
cscjlan Jan 10, 2025
04862d3
Change parallel_for back; updateGhostCells only takes in span
cscjlan Jan 13, 2025
236e8bf
Add updateGhostCells version for FsData
cscjlan Jan 13, 2025
795409d
Add timer to parallel_for
cscjlan Jan 13, 2025
3cefd4f
Fix timer callbac
cscjlan Jan 13, 2025
d1889d3
Change order of arguments
cscjlan Jan 14, 2025
cfc80d7
Remove data from fsgrid
cscjlan Jan 14, 2025
a16cfa2
Change FsData to span
cscjlan Jan 14, 2025
befa0e0
Remove header; Add header; Remove function; Rename function
cscjlan Jan 15, 2025
2472c9d
Add data header
cscjlan Jan 15, 2025
1dd42ba
Rename stencil coordinate functions
cscjlan Feb 17, 2025
48f3cdf
Fix function call after rename
cscjlan Feb 17, 2025
964af72
Fix a couple of tests
cscjlan Feb 17, 2025
2979cf3
More helper functions for coordinate - ID conversions.
ykempf May 8, 2025
37fe28d
Add serial_for and experimental_for features.
ykempf May 13, 2025
00c9f04
Function to convert stnecil ID to coordinates
ykempf May 13, 2025
2370366
Interface for array instead of 3 coords separately.
ykempf May 14, 2025
44d16a1
Remove unuswed additions after all.
ykempf May 15, 2025
3a5a86c
Added parallel for options passing indices or coordinates to the loop…
ykempf Jul 10, 2025
8f6e847
More parallel_for interfaces, providing global cellid to the loop body.
ykempf Jul 11, 2025
ba64629
More serial loop interfaces
ykempf Jul 31, 2025
e627d0c
Renamed one function.
ykempf Aug 4, 2025
b3d479f
Remove all extra variants of parallel_for. Pass coordinates.
ykempf Aug 11, 2025
34f8ffb
Introduce serial and parallel reduction alongside for.
ykempf Aug 14, 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
14 changes: 14 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
BasedOnStyle: LLVM
UseTab: Never
IndentWidth: 3
TabWidth: 3
BreakBeforeBraces: Attach
PointerAlignment: Left
AlignAfterOpenBracket: true
AllowShortIfStatementsOnASingleLine: false
IndentCaseLabels: false
ColumnLimit: 120
AccessModifierOffset: -3
...

58 changes: 58 additions & 0 deletions .github/workflows/cmake_single_platform.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: CMake build and test fsgrid

on:
push:
branches: [ "master", "development", "ctest_gtest" ]
pull_request:
branches: [ "master", "development", "ctest_gtest" ]

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
PROJECT_NAME: fsgrid

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Install OpenMPI
run: >
sudo apt-get install
openmpi-bin
libopenmpi-dev
openmpi-common

- name: Configure CMake
run: >
cmake
-B ${{github.workspace}}/build
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
-Dproject_name=${{env.PROJECT_NAME}}
-DMPI_TEST_NUM_PROCS=16
-DMPI_TEST_EXTRA_FLAGS=--oversubscribe

- name: Build
run: >
cmake
--build ${{github.workspace}}/build
--config ${{env.BUILD_TYPE}}

- name: Test
id: test
working-directory: ${{github.workspace}}
run: >
ctest
--test-dir ${{github.workspace}}/build/
-C ${{env.BUILD_TYPE}}
--output-on-failure
--output-log ${{github.workspace}}/build/github_test_log.log

- name: Archive test logs
if: always()
uses: actions/upload-artifact@v4
with:
name: test-logs
path: ${{github.workspace}}/build/github_test_log.log
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,10 @@
*.exe
*.out
*.app

# directories to ignore
build/
.cache/

# compile_commands
compile_commands.json
44 changes: 44 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
cmake_minimum_required(VERSION 3.18...3.24)

project(${project_name} VERSION 1.0 DESCRIPTION "Fsgrid testing with ctest and googletest" LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# Download googletest as a dependency
include(FetchContent)
FetchContent_Declare(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG f8d7d77c06936315286eb55f8de22cd23c188571 # release-1.14.0
)
FetchContent_MakeAvailable(googletest)

include(CTest)
enable_testing()

set(gcc "$<COMPILE_LANG_AND_ID:CXX,ARMClang,AppleClang,Clang,GNU,LCC>")

set(debug_gcc "$<AND:$<CONFIG:Debug>,${gcc}>")

set(gcc_warn -Wall;-Werror;-Wextra;-Wconversion;-Wsign-conversion;)
set(gcc_warn ${gcc_warn};-pedantic-errors;-Wcast-qual;-Wwrite-strings;)
set(gcc_warn ${gcc_warn};-Wcast-align=strict;-Wparentheses;)
set(gcc_warn ${gcc_warn};-Wlogical-op;-Wlogical-not-parentheses;)
set(gcc_warn ${gcc_warn};-Wredundant-decls;-Wformat=2;)
set(gcc_warn ${gcc_warn};-Wformat-security;-Wformat-nonliteral;)
set(gcc_warn ${gcc_warn};-Wnull-dereference;-Winit-self;-Wuninitialized;)
set(gcc_warn ${gcc_warn};-Warith-conversion;-Wduplicated-branches;)
set(gcc_warn ${gcc_warn};-Wpointer-arith;-Wundef;)
set(gcc_warn ${gcc_warn};-Wduplicated-cond;-Wformat-signedness;)

set(gcc_deb_opt -Og;)
set(gcc_rel_opt -O3;)

add_compile_options(
"$<${gcc}:${gcc_warn}>"
"$<IF:${debug_gcc},${gcc_deb_opt},${gcc_rel_opt}>"
)

# This must be after the add_compile_options for it to have any effect
add_subdirectory(tests)
30 changes: 30 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
MAKEFLAGS += --silent

project_name:=fsgrid
root_dir:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
source_dir:=$(root_dir)
build_dir_prefix:=$(root_dir)/build

.PHONY: all test clean

.ONESHELL:
all:
build_type=Release
build_dir=$(build_dir_prefix)/$${build_type}
cmake \
-B $${build_dir} \
-S $(source_dir) \
-DCMAKE_BUILD_TYPE:STRING=$${build_type} \
-Dproject_name=$(project_name) \
-DMPI_TEST_NUM_PROCS=16 \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
cmake \
--build $${build_dir} \
-j8
cp $${build_dir}/compile_commands.json $(source_dir)

clean:
rm -rf $(build_dir_prefix) $(project_name)

test: all
ctest --test-dir $(build_dir_prefix)/Release --output-on-failure
Loading