Repository navigation
172 lines (152 loc) · 5.79 KB
/
Copy pathadaptivecpp-build.yml
File metadata and controls
172 lines (152 loc) · 5.79 KB
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
name: Build with AdaptiveCpp
on:
push:
branches:
- master
pull_request:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
CHANNELS: "-c conda-forge --override-channels"
# examples that AdaptiveCpp can build
SYCL_EXAMPLES: "cython/sycl_buffer cython/use_dpctl_sycl pybind11/external_usm_allocation pybind11/use_dpctl_sycl_queue"
C_EXAMPLES: "c/py_sycl_ls"
jobs:
test_linux:
name: Build and test with AdaptiveCpp, Python ${{ matrix.python }}
runs-on: ubuntu-latest
timeout-minutes: 120
defaults:
run:
shell: bash -el {0}
strategy:
fail-fast: false
matrix:
include:
- python: '3.14'
python_spec: '3.14.*=*_cp314'
- python: '3.14t'
python_spec: '3.14.*=*_cp314t'
steps:
- name: Checkout dpctl repo
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
# the package version comes from git describe
fetch-depth: 0
- name: Cache conda packages
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
env:
CACHE_NUMBER: 0 # Increase to reset cache
with:
# the package directory that setup-miniconda configures
path: ~/conda_pkgs_dir
key:
${{ runner.os }}-conda-acpp-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-${{ hashFiles('.github/workflows/adaptivecpp-build.yml') }}
restore-keys: |
${{ runner.os }}-conda-acpp-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-
${{ runner.os }}-conda-acpp-${{ env.CACHE_NUMBER }}-
- uses: conda-incubator/setup-miniconda@8ee1f361103df19b6f8c8655fd3967a8ecb162d5 # v4.0.1
with:
auto-update-conda: true
miniforge-version: latest
activate-environment: acpp
channels: conda-forge
conda-remove-defaults: true
- name: Install AdaptiveCpp and build dependencies
run: |
# the Python build string selects the GIL or the free-threaded variant,
# clang must come from the LLVM that adaptivecpp was built against, and
# intel-opencl-rt provides the OpenCL CPU device to run on; the HIP
# backend plugin links libamdhip64.so.6, which ROCm 7 does not provide
conda install -y ${{ env.CHANNELS }} \
"python=${{ matrix.python_spec }}" \
"adaptivecpp=*=cpu_llvm19*" "clang=19.*" "clangxx=19.*" \
"hip-runtime-amd=6.*" \
intel-opencl-rt \
cmake cython ninja numpy pybind11 pytest scikit-build "setuptools<80" versioneer
- name: Report the environment
run: |
conda list
python -VV
acpp-info -l
- name: Build dpctl
run: |
python scripts/build_locally.py --sycl-provider=AdaptiveCpp
- name: List platforms
run: |
python -m dpctl -f
python -c "from dpctl._diagnostics import sycl_provider; assert sycl_provider() == 'AdaptiveCpp'"
- name: Run dpctl/tests on the OpenMP device
env:
ACPP_VISIBILITY_MASK: omp
run: |
python -m pytest -q --capture=sys dpctl/tests
- name: Run dpctl/tests on the OpenCL CPU device
env:
ACPP_VISIBILITY_MASK: ocl
run: |
python -m pytest -q --capture=sys dpctl/tests
- name: Build examples of extensions
env:
PYTHONPATH: ${{ github.workspace }}
run: |
for d in ${SYCL_EXAMPLES}; do
pushd "examples/${d}" > /dev/null
CC="${CONDA_PREFIX}/bin/clang" CXX="${CONDA_PREFIX}/bin/acpp" \
python setup.py build_ext --inplace -G Ninja -- \
-DDPCTL_SYCL_PROVIDER=AdaptiveCpp \
-DDpctl_DIR="${GITHUB_WORKSPACE}/cmake"
popd > /dev/null
done
for d in ${C_EXAMPLES}; do
pushd "examples/${d}" > /dev/null
python setup.py build_ext --inplace
popd > /dev/null
done
- name: Run examples of extensions on the OpenMP device
env:
ACPP_VISIBILITY_MASK: omp
PYTHONPATH: ${{ github.workspace }}
run: |
for d in ${SYCL_EXAMPLES} ${C_EXAMPLES}; do
# the OpenMP backend allocates plain host memory, so every USM kind
# reports usm_type "host" and this example's checks cannot hold
if [ "${d}" = "pybind11/external_usm_allocation" ]; then
continue
fi
pushd "examples/${d}" > /dev/null
python -m pytest -q tests
popd > /dev/null
done
- name: Run examples of extensions on the OpenCL CPU device
env:
ACPP_VISIBILITY_MASK: ocl
PYTHONPATH: ${{ github.workspace }}
run: |
for d in ${SYCL_EXAMPLES} ${C_EXAMPLES}; do
pushd "examples/${d}" > /dev/null
python -m pytest -q tests
popd > /dev/null
done
- name: Run Python examples on the OpenMP device
working-directory: examples/python
env:
ACPP_VISIBILITY_MASK: omp
run: |
while IFS= read -r script; do
echo "Executing ${script}"
python "${script}" --run all
done < <(find . \( -not -name "_*" -and -name "*.py" \))
- name: Run Python examples on the OpenCL CPU device
working-directory: examples/python
env:
ACPP_VISIBILITY_MASK: ocl
run: |
while IFS= read -r script; do
echo "Executing ${script}"
python "${script}" --run all
done < <(find . \( -not -name "_*" -and -name "*.py" \))