Skip to content

Commit 09a67af

Browse files
authored
Merge pull request #17 from CExA-project/refactor_projects
Refactor projects
2 parents dc4e34a + 6c087fd commit 09a67af

File tree

40 files changed

+118
-92
lines changed

40 files changed

+118
-92
lines changed

.github/workflows/exercises.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ jobs:
1919
steps:
2020
- name: Set up Git repository
2121
uses: actions/checkout@v4
22-
- name: Prepare all exercices and solutions with the OpenMP backend
22+
- name: Prepare all exercices with the OpenMP backend
2323
run: |
2424
cmake \
2525
-B build \
2626
-DCMAKE_BUILD_TYPE=Release \
2727
-DKokkos_ENABLE_OPENMP=ON \
2828
exercises
29-
- name: Build all exercises and solutions
29+
- name: Build all exercises
3030
run: |
3131
cmake \
3232
--build build \

.github/workflows/projects.yml

Lines changed: 19 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55

66
name: Test projects
77

8-
run-name: Test projects
9-
108
on:
119
pull_request:
1210
branches:
@@ -16,59 +14,29 @@ on:
1614

1715
jobs:
1816

19-
build_kokkos:
20-
runs-on: ubuntu-latest
21-
steps:
22-
- name: Set up Git repository
23-
uses: actions/checkout@v4
24-
- name: Install Kokkos
25-
run: |
26-
git clone https://github.com/kokkos/kokkos.git
27-
cd kokkos
28-
git checkout develop
29-
mkdir build_openmp
30-
mkdir install_openmp
31-
cmake -B build_openmp -DCMAKE_INSTALL_PREFIX=${PWD}/install_openmp -DKokkos_ENABLE_OPENMP=ON ./
32-
make install -C build_openmp
33-
- name: Upload Kokkos artifact
34-
uses: actions/upload-artifact@v4
35-
with:
36-
name: kokkos
37-
path: kokkos/install_openmp
38-
39-
build_wave_projects:
17+
build_test_projects:
4018
runs-on: ubuntu-latest
41-
needs: [build_kokkos]
4219
steps:
4320
- name: Set up Git repository
4421
uses: actions/checkout@v4
45-
- name: Download Kokkos artifact
46-
uses: actions/download-artifact@v4
47-
with:
48-
name: kokkos
49-
path: kokkos/install_openmp
50-
- name: wave sequential
22+
- name: Prepare all projects with the OpenMP backend
5123
run: |
52-
cd projects/wave/sequential/
53-
cmake -DCMAKE_BUILD_TYPE=Release ./
54-
make
55-
./exe
56-
cd ${GITHUB_WORKSPACE}
57-
- name: wave openMP
24+
cmake \
25+
-B build \
26+
-DCMAKE_BUILD_TYPE=Release \
27+
-DKokkos_ENABLE_OPENMP=ON \
28+
projects
29+
- name: Build all projects
5830
run: |
59-
cd projects/wave/omp
60-
cmake -DCMAKE_BUILD_TYPE=Release ./
61-
make
62-
export OMP_NUM_THREADS=2
63-
export OMP_PROC_BIND=true
64-
export OMP_SCHEDULER=dynamic
65-
./exe --size 128 128 --time 5 --output-period 100 --print-period 100 --domain-length 10 10 --boundary 1
66-
cd ${GITHUB_WORKSPACE}
67-
- name: wave Kokkos
31+
cmake \
32+
--build build \
33+
--parallel $(($(nproc) * 2 + 1))
34+
- name: Test all solutions and reference implementations
35+
env:
36+
OMP_PROC_BIND: spread
37+
OMP_PLACES: threads
38+
OMP_NUM_THREADS: 2
6839
run: |
69-
cd projects/wave/solution/
70-
cmake -DCMAKE_BUILD_TYPE=Release -DKokkos_DIR=${GITHUB_WORKSPACE}/kokkos/install_openmp/lib/cmake/Kokkos/ ./
71-
make
72-
./exe --size 128 128 --time 5 --output-period 100 --print-period 100 --domain-length 10 10 --boundary 1
73-
cd ${GITHUB_WORKSPACE}
74-
40+
ctest \
41+
--test-dir build \
42+
--output-on-failure

.gitmodules

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[submodule "exercises/vendor/kokkos"]
2-
path = exercises/vendor/kokkos
1+
[submodule "vendor/kokkos"]
2+
path = vendor/kokkos
33
url = https://github.com/kokkos/kokkos
44
branch = master

CONTRIBUTING.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Contributing to the tutorials
22

3-
## Add a new exercise
3+
## Add a new exercise or a new project
44

5-
### Exercise structure
5+
### Directory structure
66

77
```
88
new_exercise/
@@ -18,14 +18,14 @@ new_exercise/
1818

1919
### Testing
2020

21-
Exercises should be tested in the CI.
22-
To do so, edit `exercises/CMakeLists.txt` to append your exercise directory with `add_subdirectory`:
21+
Exercises and projects should be tested in the CI.
22+
To do so, edit `exercises/CMakeLists.txt` or `projects/CMakeLists.txt` to append your exercise directory with `add_subdirectory`:
2323

2424
```cmake
2525
add_subdirectory(my_exercise)
2626
```
2727

28-
In your `solution/CMakeLists.txt`, add your solution target as a test.
28+
In your `solution/CMakeLists.txt` (or any build you want to test), add your solution target as a test.
2929

3030
```cmake
3131
add_test(
@@ -34,4 +34,6 @@ add_test(
3434
)
3535
```
3636

37+
You can customise the `COMMAND` with any extra arguments for the test.
38+
3739
The new exercise will be automatically built and tested by the CI.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ This course is part of the [CExA project](https://cexa-project.github.io/).
3232

3333
### Projects
3434

35-
- [Project 1: Wave Propagation](projects/wave/README.md)
35+
- [Project 1: Wave Propagation](projects/01_wave/README.md)
3636

3737
## Get the repository
3838

exercises/cmake/modules/FindKokkos.cmake renamed to cmake/modules/FindKokkos.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ endif()
2828
# find Kokkos as an existing source directory
2929
set(
3030
CexaKokkosTutorials_KOKKOS_SOURCE_DIR
31-
"${CMAKE_CURRENT_SOURCE_DIR}/../../vendor/kokkos"
31+
"${CMAKE_CURRENT_SOURCE_DIR}/../../../vendor/kokkos"
3232
CACHE
3333
PATH
3434
"Path to the local source directory of Kokkos"

exercises/00_compiling_kokkos/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ mv kokkos-4.5.01 kokkos
3030

3131
### Use the submodule
3232

33-
The `../vendor/kokkos` directory contains Kokkos as a Git submodule.
34-
If you haven't cloned the repository recursively, you can get it with:
33+
The `../../../vendor/kokkos` directory contains Kokkos as a Git submodule.
34+
If you haven't cloned the repository recursively already, you can get it with:
3535

3636
```sh
3737
git submodule update --init
@@ -40,7 +40,7 @@ git submodule update --init
4040
Then you create a link here:
4141

4242
```sh
43-
ln -s ../vendor/kokkos kokkos
43+
ln -s ../../../vendor/kokkos kokkos
4444
```
4545

4646
## Step 2: Build Kokkos with default parameters
@@ -51,7 +51,7 @@ This way, you can easily clean up the build directory without affecting the sour
5151
To create a build directory and build Kokkos with default parameters, you can use the following commands:
5252

5353
```bash
54-
cmake -B build_serial -DCMAKE_INSTALL_PREFIX=${PWD}/install_default kokkos
54+
cmake -B build_serial -DCMAKE_INSTALL_PREFIX=${PWD}/install_serial kokkos
5555
cmake --build build_serial
5656
cmake --install build_serial
5757
```

exercises/01_first_program/exercise/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ cmake_minimum_required (VERSION 3.21)
22

33
project(01FirstProgramExercise LANGUAGES CXX)
44

5-
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/modules")
5+
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../../cmake/modules")
66

77
find_package(Kokkos REQUIRED)
88

exercises/01_first_program/solution/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ cmake_minimum_required (VERSION 3.21)
22

33
project(01FirstProgramSolution LANGUAGES CXX)
44

5-
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/modules")
5+
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../../cmake/modules")
66

77
find_package(Kokkos REQUIRED)
88

exercises/02_basic_view/exercise/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ cmake_minimum_required (VERSION 3.21)
22

33
project(02BasicViewExercise LANGUAGES CXX)
44

5-
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/modules")
5+
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../../cmake/modules")
66

77
find_package(Kokkos REQUIRED)
88

0 commit comments

Comments
 (0)