-
Notifications
You must be signed in to change notification settings - Fork 13
133 lines (120 loc) · 4.58 KB
/
unit-test.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
name: Unit test
env:
COMPONENT_NAME: azplugins
# Most components should not modify the rest of this file. When needed, merge in updates from
# https://github.com/glotzerlab/hoomd-component-template/
#############################################################################################
# HOOMD-blue version to build.
HOOMD_BLUE_VERSION: v4.8.2
# prevent deadlocked MPI tests from causing the job to cancel
MPIEXEC_TIMEOUT: 3000
# allow mpirun to execute as root in the tests
OMPI_ALLOW_RUN_AS_ROOT: 1
OMPI_ALLOW_RUN_AS_ROOT_CONFIRM: 1
# allow openmpi to oversubscribe cores
PRTE_MCA_rmaps_default_mapping_policy: ":oversubscribe"
OMPI_MCA_rmaps_base_oversubscribe: "true"
# prevent errors from mis-configured openib systems
OMPI_MCA_btl: "vader,self"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
pull_request:
push:
branches: [main]
workflow_dispatch:
defaults:
run:
shell: bash
jobs:
build_test:
name: Build and test [${{ matrix.name }}]
runs-on: ubuntu-24.04
container:
image: nvidia/cuda:12.5.0-devel-ubuntu22.04
strategy:
fail-fast: false
matrix:
include:
- name: "CPU"
enable_gpu: "OFF"
enable_mpi: "OFF"
- name: "CPU, MPI"
enable_gpu: "OFF"
enable_mpi: "ON"
- name: "GPU"
enable_gpu: "ON"
enable_mpi: "OFF"
- name: "GPU, MPI"
enable_gpu: "ON"
enable_mpi: "ON"
steps:
- name: Restore cached HOOMD-blue build
id: cache
uses: actions/cache/restore@v4
with:
path: install
key: hoomd-blue-${{ env.HOOMD_BLUE_VERSION }}-${{ matrix.enable_mpi }}-gpu-${{ matrix.enable_gpu }}
- name: Install git
run: |
apt-get update
apt-get install git --yes
- name: Checkout HOOMD-blue
uses: actions/checkout@v4
with:
repository: glotzerlab/hoomd-blue
path: hoomd-blue
submodules: true
ref: ${{ env.HOOMD_BLUE_VERSION }}
- name: Create Python Environment
uses: mamba-org/setup-micromamba@v1
with:
environment-name: test
environment-file: hoomd-blue/.github/workflows/environments/py312-conda-lock.yml
micromamba-root-path: ${{ github.workspace }}/micromamba
- name: Configure conda environment variables
run: |
echo "PYTHONPATH=$GITHUB_WORKSPACE/install" >> $GITHUB_ENV
echo "CONDA_PREFIX=$MAMBA_ROOT_PREFIX/envs/test" >> $GITHUB_ENV
echo "CMAKE_PREFIX_PATH=$MAMBA_ROOT_PREFIX/envs/test" >> $GITHUB_ENV
echo "$MAMBA_ROOT_PREFIX/envs/test/bin" >> $GITHUB_PATH
- name: Configure HOOMD-blue
if: steps.cache.outputs.cache-hit != 'true'
run: |
cmake -B build-hoomd-blue -S hoomd-blue \
-GNinja \
-DCMAKE_BUILD_TYPE=Release \
-DENABLE_GPU=${ENABLE_GPU} \
-DENABLE_MPI=${ENABLE_MPI} \
-DCUDA_ARCH_LIST="70" \
-DBUILD_TESTING=OFF \
-DPLUGINS="" \
-DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/install
env:
ENABLE_GPU: ${{ matrix.enable_gpu }}
ENABLE_MPI: ${{ matrix.enable_mpi }}
- name: Build HOOMD-blue
if: steps.cache.outputs.cache-hit != 'true'
run: ninja install -j $(($(getconf _NPROCESSORS_ONLN) + 2))
working-directory: build-hoomd-blue
- name: Cache HOOMD-blue build
if: steps.cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: install
key: hoomd-blue-${{ env.HOOMD_BLUE_VERSION }}-${{ matrix.enable_mpi }}-gpu-${{ matrix.enable_gpu }}
- name: Checkout component
uses: actions/checkout@v4
with:
path: component
- name: Configure component
run: CMAKE_PREFIX_PATH=${GITHUB_WORKSPACE}/install cmake -S component -B build-component -GNinja -DCMAKE_BUILD_TYPE=Release
- name: Build component
run: ninja install -j $(($(getconf _NPROCESSORS_ONLN) + 2))
working-directory: build-component
- name: Run pytest (serial)
run: python3 -m pytest --pyargs hoomd.${COMPONENT_NAME} -x -v -ra --durations=0 --durations-min=0.1
- name: Run pytest (MPI)
if: ${{ matrix.enable_mpi == 'ON' }}
run: mpirun -n 2 ${GITHUB_WORKSPACE}/install/hoomd/pytest/pytest-openmpi.sh --pyargs hoomd.${COMPONENT_NAME} -x -v -ra --durations=0 --durations-min=0.1 || (( cat pytest.out.1 && exit 1 ))