Skip to content

Commit 7db7b6c

Browse files
authored
add a basic workflow (#4)
* added a daily.sh script * added a daily workflow that runs on the devcloud * added a config file for pre-commit * added pre-commit to the workflow * reformat files * checks now run on ubuntu-latest * remove unnecessary pre-commit hooks, reformat * added the codespell hook and fixed spelling * added a simple Dockerfile * added a docker_workflow.yml * small fixes * added running pre-commit as a first workflow's step * remove the unused Dockerfile and devcloud workflow * remove -DENABLE_SYCL flag from the workflow
1 parent 799bdb3 commit 7db7b6c

File tree

11 files changed

+125
-18
lines changed

11 files changed

+125
-18
lines changed

.github/workflows/docker_workflow.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# SPDX-FileCopyrightText: Intel Corporation
2+
#
3+
# SPDX-License-Identifier: BSD-3-Clause
4+
5+
name: Docker
6+
7+
on:
8+
push:
9+
pull_request:
10+
workflow_dispatch:
11+
# 8am UTC is 12am PST, 1am PDT
12+
schedule:
13+
- cron: '0 8 * * *'
14+
15+
jobs:
16+
run_precommit:
17+
name: Run pre-commit
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Check out
21+
uses: actions/checkout@v3
22+
- name: Setup Python
23+
uses: actions/setup-python@v4
24+
with:
25+
python-version: '3.10'
26+
cache: 'pip'
27+
- name: Run pre-commit
28+
uses: pre-commit/[email protected]
29+
run_examples:
30+
name: Build and run examples
31+
runs-on: ubuntu-latest
32+
container:
33+
image: intel/oneapi:latest
34+
env:
35+
CXX: icpx
36+
CC: icx
37+
volumes:
38+
- ${{ github.workspace }}:/src
39+
steps:
40+
- name: Check out
41+
uses: actions/checkout@v3
42+
- name: Setup cmake
43+
uses: jwlawson/[email protected]
44+
- name: Build examples
45+
run: |
46+
cmake -B build
47+
cmake --build build -j
48+
- name: Run examples
49+
run: |
50+
mpirun -n 2 ./build/src/example1
51+
mpirun -n 2 ./build/src/example2
52+
mpirun -n 2 ./build/src/example3

.pre-commit-config.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# SPDX-FileCopyrightText: Intel Corporation
2+
#
3+
# SPDX-License-Identifier: BSD-3-Clause
4+
5+
repos:
6+
7+
- repo: https://github.com/pre-commit/mirrors-clang-format
8+
rev: v16.0.6
9+
hooks:
10+
- id: clang-format
11+
12+
- repo: https://github.com/pre-commit/pre-commit-hooks
13+
rev: v4.4.0
14+
hooks:
15+
- id: trailing-whitespace
16+
- id: end-of-file-fixer
17+
- id: mixed-line-ending
18+
- id: check-yaml
19+
- id: check-case-conflict
20+
- id: check-added-large-files
21+
args: ['--maxkb=800']
22+
23+
24+
- repo: https://github.com/pycqa/isort
25+
rev: 5.12.0
26+
hooks:
27+
- id: isort
28+
29+
- repo: https://github.com/cheshirekow/cmake-format-precommit
30+
rev: v0.6.13
31+
hooks:
32+
- id: cmake-format
33+
34+
- repo: https://github.com/codespell-project/codespell
35+
rev: v2.2.4
36+
hooks:
37+
- id: codespell

CMakeLists.txt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ project(
1111
VERSION 0.1
1212
DESCRIPTION "Distributed ranges tutorial")
1313

14-
15-
1614
find_package(MPI REQUIRED)
1715

1816
add_subdirectory(src)
@@ -24,9 +22,9 @@ option(ENABLE_FORMAT "Build with format library" ON)
2422
include(FetchContent)
2523

2624
FetchContent_Declare(
27-
distributed-ranges
28-
GIT_REPOSITORY https://github.com/oneapi-src/distributed-ranges.git
29-
GIT_TAG c618154a1bceda33e5d61e1536179aeaa11b68f4)
25+
distributed-ranges
26+
GIT_REPOSITORY https://github.com/oneapi-src/distributed-ranges.git
27+
GIT_TAG c618154a1bceda33e5d61e1536179aeaa11b68f4)
3028
FetchContent_MakeAvailable(distributed-ranges)
3129

3230
FetchContent_Declare(

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ In case your environment is not configured properly or you just prefer a hassle-
4545
git clone https://github.com/mateuszpn/distributed-ranges-tutorial
4646
cd distributed-ranges-tutorial
4747
docker run -it -v $(pwd):/custom-directory-name -u root docker.io/intel/oneapi:latest /bin/bash
48-
cd custom-directory-name
48+
cd custom-directory-name
4949
CXX=icpx CC=icx cmake -B build -DENABLE_SYCL=ON
5050
cmake --build build -j
5151
```
@@ -81,12 +81,12 @@ In this way, many of the technical details related to the parallel execution of
8181
### Namespaces
8282
8383
General namespace used in the library is `dr::`
84-
For program using a single node with shared memory available for multiple CPUs and one or more GPUs, data structures and algoritms from `dr::shp::` namespace are provided.
84+
For program using a single node with shared memory available for multiple CPUs and one or more GPUs, data structures and algorithms from `dr::shp::` namespace are provided.
8585
For distributed memory model, use the `dr::mhp::` namespace.
8686
8787
### Data structures
8888
89-
Content of distributes-ranges' data structures is distributed over available nodes. For example, segments of `dr::mhp::distributed_vector` are located in memory of different nodes (mpi processes). Still, global view of the `distributed_vector` is uniform, with contigous indices.
89+
Content of distributes-ranges' data structures is distributed over available nodes. For example, segments of `dr::mhp::distributed_vector` are located in memory of different nodes (mpi processes). Still, global view of the `distributed_vector` is uniform, with contiguous indices.
9090
<!-- TODO: some pictures here -->
9191
9292
#### Halo concept
@@ -97,7 +97,7 @@ To support this situation, the concept of halo was introduced. A halo is an area
9797
9898
### Algorithms
9999
100-
Follwing algorithms are included in distributed-ranges, both in mhp and shp versions:
100+
Following algorithms are included in distributed-ranges, both in mhp and shp versions:
101101
102102
```cpp
103103
copy()
@@ -121,7 +121,7 @@ The examples should be compiled with SYCL compiler and run with.
121121
mpirun -n N ./build/src/example_name
122122
```
123123

124-
where `N` - number of MPI processes. Replace _example_name_ with appropiate name of a file tu run.
124+
where `N` - number of MPI processes. Replace _example_name_ with appropriate name of a file tu run.
125125

126126
### Example 1
127127

@@ -140,13 +140,13 @@ The example shows the distributed nature of dr data structures. The distributed_
140140

141141
[./src/example3.cpp](src/example3.cpp)
142142

143-
The example simulates the elementary 1-d cellular automaton (ECA). Description of what the automaton is and how it works can be found in [wikipedia](https://en.wikipedia.org/wiki/Elementary_cellular_automaton). Visulisation of the automaton work is available in [ASU team webpage](https://elife-asu.github.io/wss-modules/modules/1-1d-cellular-automata).
143+
The example simulates the elementary 1-d cellular automaton (ECA). Description of what the automaton is and how it works can be found in [wikipedia](https://en.wikipedia.org/wiki/Elementary_cellular_automaton). Visualisation of the automaton work is available in [ASU team webpage](https://elife-asu.github.io/wss-modules/modules/1-1d-cellular-automata).
144144

145145
The ECA calculates the new value of a cell using old value of the cell and old values of the cell's neighbors. Therefore a halo of 1-cell width is used, to get access to neighboring cells' values when the loop eaches end of local segment of a vector.
146146
Additionally, a use of a subrange is presented, and `transform()` function, which puts transformed values of input structure to the output structure, element by element. The transforming function is given as lambda `newvalue`.
147147
_Please note: after each loop the vector content is printed with `fmt::print()`. The formatter function for `distributed_vector` is rather slow, as it gets the vector element by element, both from local node and remote nodes. You can think about customised, more effective way of results presentation._
148148

149149
<!--
150-
Consider adding one more example:
150+
Consider adding one more example:
151151
*Simple 2-D operation - Find a pattern in the randomly filled array*
152152
-->

requirements.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# SPDX-FileCopyrightText: Intel Corporation
2+
#
3+
# SPDX-License-Identifier: BSD-3-Clause
4+
5+
pre-commit==3.4.0

scripts/build_run.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#! /bin/bash
2+
3+
# SPDX-FileCopyrightText: Intel Corporation
4+
#
5+
# SPDX-License-Identifier: BSD-3-Clause
6+
7+
export CXX=icpx
8+
export CC=icx
9+
10+
cmake -B build
11+
cmake --build build -j
12+
13+
mpirun -n 2 ./build/src/example1
14+
mpirun -n 2 ./build/src/example2
15+
mpirun -n 2 ./build/src/example3

security.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Security Policy
2-
Intel is committed to rapidly addressing security vulnerabilities affecting our customers and providing clear guidance on the solution, impact, severity and mitigation.
2+
Intel is committed to rapidly addressing security vulnerabilities affecting our customers and providing clear guidance on the solution, impact, severity and mitigation.
33

44
## Reporting a Vulnerability
55
Please report any security vulnerabilities in this project utilizing the guidelines [here](https://www.intel.com/content/www/us/en/security-center/vulnerability-handling-guidelines.html).

src/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ if(ENABLE_CUDA)
99
add_compile_options(-fsycl-targets=nvptx64-nvidia-cuda
1010
-Wno-error=unknown-cuda-version)
1111
add_link_options(-fsycl-targets=nvptx64-nvidia-cuda
12-
-Wno-error=unknown-cuda-version)
12+
-Wno-error=unknown-cuda-version)
1313
endif()
1414

1515
add_executable(example1 example1.cpp)

src/example1.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ int main(int argc, char **argv) {
2929
mhp::finalize();
3030

3131
return 0;
32-
}
32+
}

src/example2.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ int main(int argc, char **argv) {
1212
mhp::init(sycl::default_selector_v);
1313

1414
fmt::print(
15-
"Hello, World! Distributed ranges proces is running on rank {} / {} on "
15+
"Hello, World! Distributed ranges process is running on rank {} / {} on "
1616
"host {}\n",
1717
mhp::rank(), mhp::nprocs(), mhp::hostname());
1818

src/example3.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace mhp = dr::mhp;
1010
/* The example simulates the elementary 1-d cellular automaton. Description of
1111
* what the automaton is and how it works can be found at
1212
* https://en.wikipedia.org/wiki/Elementary_cellular_automaton
13-
* Visulisation of the automaton work is available
13+
* Visualisation of the automaton work is available
1414
* https://elife-asu.github.io/wss-modules/modules/1-1d-cellular-automata
1515
* (credit: Emergence team @ Arizona State University)*/
1616

@@ -58,4 +58,4 @@ int main(int argc, char **argv) {
5858
mhp::finalize();
5959

6060
return 0;
61-
}
61+
}

0 commit comments

Comments
 (0)