Skip to content

Commit 187346e

Browse files
Update naming and CMake structure
1 parent 8dcd857 commit 187346e

19 files changed

Lines changed: 535 additions & 486 deletions

.github/workflows/build-and-test.yml

Lines changed: 0 additions & 61 deletions
This file was deleted.

.github/workflows/documentation.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ jobs:
2323
uses: actions/checkout@v4
2424
- name: Build Docs
2525
run: |
26-
cmake -B ${{github.workspace}}/build
27-
cmake --build ${{github.workspace}}/build/docs --target docs
26+
cmake -B ${{github.workspace}}/build -DBUILD_DOCS=ON
27+
cmake --build ${{github.workspace}}/build
2828
mv ${{github.workspace}}/build/docs/html /root/
2929
- name: Upload Artifact
3030
uses: actions/upload-artifact@v4

.github/workflows/unit-tests.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Unit Tests
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
push:
7+
branches:
8+
- '**'
9+
10+
permissions:
11+
contents: read
12+
actions: read
13+
checks: write
14+
pull-requests: write
15+
16+
jobs:
17+
unit-tests:
18+
runs-on: cern-nextgen-h100
19+
container: registry.cern.ch/ngt-wp1.7/wp1.7-soa-wrapper@sha256:16432eae6635379637e67c4cc00334c46b6dce845b83da7e75fb754d24266897
20+
steps:
21+
- uses: actions/checkout@v4
22+
name: checkout repository
23+
- name: gcc
24+
env:
25+
CXX: g++
26+
CC: gcc
27+
NVCC_CCBIN: gcc
28+
CUDACXX: nvcc
29+
TEST_TAG: gcc
30+
run: &build-and-test |
31+
cmake -B ${{github.workspace}}/build/ -DBUILD_TESTING=ON -DCMAKE_COMPILE_WARNING_AS_ERROR=ON
32+
cmake --build ${{github.workspace}}/build/
33+
ctest --test-dir ${{github.workspace}}/build/tests --output-on-failure --output-junit /root/test_${TEST_TAG}.xml
34+
rm -rf ${{github.workspace}}/build
35+
- name: clang
36+
env:
37+
CXX: clang++
38+
CC: clang
39+
NVCC_CCBIN: clang
40+
CUDACXX: nvcc
41+
TEST_TAG: clang
42+
run: *build-and-test
43+
- name: upload artifact
44+
uses: actions/upload-artifact@v4
45+
with:
46+
name: junit-artifacts
47+
path: |
48+
/root/test_gcc.xml
49+
/root/test_clang.xml
50+
publish-test-results:
51+
needs: unit-tests
52+
runs-on: ubuntu-latest
53+
steps:
54+
- name: download artifact
55+
uses: actions/download-artifact@v5
56+
with:
57+
name: junit-artifacts
58+
- name: publish test results
59+
uses: EnricoMi/publish-unit-test-result-action@v2
60+
if: (!cancelled())
61+
with:
62+
files: "test_*.xml"

CMakeLists.txt

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
cmake_minimum_required(VERSION 4.0)
22
project(memlayout LANGUAGES CXX)
33

4-
#option(ENABLE_CPU "Build CPU tests" ON)
5-
#option(ENABLE_CUDA "Build CUDA tests" ON)
4+
option(BUILD_TESTING "Build unit tests" OFF)
5+
option(BUILD_DOCS "Build documentation" OFF)
66

7-
add_library(memlayout INTERFACE)
8-
target_include_directories(memlayout INTERFACE include)
7+
add_subdirectory(memlayout)
98

10-
add_subdirectory(tests EXCLUDE_FROM_ALL)
9+
if(BUILD_TESTING)
10+
add_subdirectory(tests)
11+
endif()
1112

12-
add_subdirectory(docs EXCLUDE_FROM_ALL)
13+
if(BUILD_DOCS)
14+
add_subdirectory(docs)
15+
endif()

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ In Step 9, instead of running nvidia-smi, execute the commands in the section [B
8383
## TODO
8484
- Default initializations
8585
- Choose between uninitialized, default initialized, and custom initialized arrays
86-
- Allow putting default values in skeleton struct definition, e.g. by template spcialization
86+
- Allow putting default values in skeleton struct definition, e.g. by template specialization
8787
- Aggregate initialization for arrays
8888
- Don't define closures twice
8989
- Return classical reference to struct in AoS case

docs/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ set(DOXYGEN_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
55

66
configure_file(${DOXYGEN_IN} ${DOXYGEN_OUT} @ONLY)
77

8-
add_custom_target(docs
8+
add_custom_target(docs ALL
99
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT}
1010
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
1111
COMMENT "Generating API documentation with Doxygen"

docs/mainpage.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,27 +17,28 @@
1717

1818
```cpp
1919
#include <iostream>
20+
2021
#include <memlayout.h>
2122

22-
template <template <class> class F>
23+
template <template <class> class Container>
2324
struct Point {
2425
MEMLAYOUT_APPLY_UNARY(x, y, z)
2526
MEMLAYOUT_APPLY_BINARY(Point, MEMLAYOUT_EXPAND(x), MEMLAYOUT_EXPAND(y), MEMLAYOUT_EXPAND(z))
26-
F<int> x, y, z;
27+
Container<int> x, y, z;
2728
};
2829

29-
template <template <class> class F>
30+
template <template <class> class Container>
3031
struct Momentum {
3132
MEMLAYOUT_APPLY_UNARY(p, i)
3233
MEMLAYOUT_APPLY_BINARY(Momentum, MEMLAYOUT_EXPAND(v), MEMLAYOUT_EXPAND(m))
33-
MemLayout::wrapper<Point, F> v;
34-
F<int> m;
34+
memlayout::Wrapper<Point, Container> v;
35+
Container<int> m;
3536
};
3637

3738
int main()
3839
{
3940
constexpr int N = 10;
40-
memlayout::wrapper<Momentum, int[N], memlayout::format::soa> p{};
41+
memlayout::Wrapper<Momentum, int[N], memlayout::Layout::soa> p{};
4142
for (int n = 0; n < N; ++n) {
4243
p[n].v.x = N - n;
4344
std::cout << p[n].v.x << ", ";

0 commit comments

Comments
 (0)