-
Notifications
You must be signed in to change notification settings - Fork 0
163 lines (145 loc) · 5.32 KB
/
install.yml
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
name: Install to System
on:
push:
paths-ignore:
- ".devcontainer/**"
- ".vscode/**"
- "doc/**"
- "*.md"
pull_request:
paths-ignore:
- ".devcontainer/**"
- ".vscode/**"
- "doc/**"
- "*.md"
jobs:
library:
name: Install Library
strategy:
matrix:
os: ["linux", "macos"]
architecture: ["x86_64", "arm64"]
device: ["cpu", "cuda"]
exclude:
- os: "macos"
device: "cuda"
# currently ARM runner is not supported
- os: "linux"
architecture: "arm64"
include:
- os: "linux"
architecture: "x86_64"
runs-on: "ubuntu-22.04"
- os: "macos"
architecture: "x86_64"
runs-on: "macos-13"
- os: "macos"
architecture: "arm64"
runs-on: "macos-14"
runs-on: ${{ matrix.runs-on }}
env:
CMAKE_C_COMPILER: ${{ matrix.runs-on == 'macos-13' && '/usr/local/opt/ccache/libexec/gcc-14'|| matrix.runs-on == 'macos-14' && '/opt/homebrew/opt/ccache/libexec/gcc-14' || '/usr/lib/ccache/gcc' }}
CMAKE_CXX_COMPILER: ${{ matrix.runs-on == 'macos-13' && '/usr/local/opt/ccache/libexec/g++-14'|| matrix.runs-on == 'macos-14' && '/opt/homebrew/opt/ccache/libexec/g++-14' || '/usr/lib/ccache/g++' }}
SCALUQ_USE_CUDA: ${{ matrix.device == 'cuda' && 'ON' || 'OFF' }}
SCALUQ_CUDA_ARCH: "PASCAL61"
steps:
- uses: actions/checkout@v4
- name: Install Ninja
if: ${{ matrix.os == 'linux' }}
run: sudo apt update && sudo apt install ninja-build
- name: Install Ninja
if: ${{ matrix.os == 'macos' }}
run: brew install ninja
- name: Setup ccache
uses: hendrikmuhs/[email protected]
with:
key: "${{ github.job }}-${{ matrix.os }}-${{ matrix.architecture }}-${{ matrix.device }}"
verbose: 2
- name: Install CUDA toolkit
if: ${{ matrix.device == 'cuda' }}
uses: Jimver/[email protected]
with:
cuda: "12.6.1"
method: "network"
- name: Show installed Compiler version
run: |
[ $SCALUQ_USE_CUDA = 'ON' ] && nvcc --version
ccache --version
$CMAKE_C_COMPILER --version
$CMAKE_CXX_COMPILER --version
cmake --version
ninja --version
- name: Configure
run: ./script/configure
- name: Install to system
run: sudo -E env "PATH=$PATH" ninja -C build install
- name: Build and Run other project
run: |
cd example_project/
cmake -B build/ -D "CMAKE_C_COMPILER=$CMAKE_C_COMPILER" -D "CMAKE_CXX_COMPILER=$CMAKE_CXX_COMPILER" -D "SCALUQ_USE_CUDA=$SCALUQ_USE_CUDA"
make -C build
if [ "$SCALUQ_USE_CUDA" != 'ON' ]; then
build/main
fi
python:
name: Install Python package
strategy:
matrix:
os: ["linux", "macos"]
architecture: ["x86_64", "arm64"]
device: ["cpu", "cuda"]
python-version: ["3.12"]
exclude:
- os: "macos"
device: "cuda"
# currently ARM runner is not supported
- os: "linux"
architecture: "arm64"
include:
- os: "linux"
architecture: "x86_64"
runs-on: "ubuntu-22.04"
- os: "macos"
architecture: "x86_64"
runs-on: "macos-13"
- os: "macos"
architecture: "arm64"
runs-on: "macos-14"
runs-on: ${{ matrix.runs-on }}
env:
CMAKE_C_COMPILER: ${{ matrix.runs-on == 'macos-13' && '/usr/local/opt/ccache/libexec/gcc-14'|| matrix.runs-on == 'macos-14' && '/opt/homebrew/opt/ccache/libexec/gcc-14' || '/usr/lib/ccache/gcc' }}
CMAKE_CXX_COMPILER: ${{ matrix.runs-on == 'macos-13' && '/usr/local/opt/ccache/libexec/g++-14'|| matrix.runs-on == 'macos-14' && '/opt/homebrew/opt/ccache/libexec/g++-14' || '/usr/lib/ccache/g++' }}
SCALUQ_USE_CUDA: ${{ matrix.device == 'cuda' && 'ON' || 'OFF' }}
SCALUQ_CUDA_ARCH: "PASCAL61"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Setup ccache
uses: hendrikmuhs/[email protected]
with:
key: "${{ github.job }}-${{ matrix.os }}-${{ matrix.architecture }}-${{ matrix.device }}"
verbose: 2
- name: Install CUDA toolkit
if: ${{ matrix.device == 'cuda' }}
uses: Jimver/[email protected]
with:
cuda: "12.6.1"
method: "network"
- name: Show installed Compiler version
run: |
[ $SCALUQ_USE_CUDA = 'ON' ] && nvcc --version
ccache --version
$CMAKE_C_COMPILER --version
$CMAKE_CXX_COMPILER --version
- name: Install mypy
run: python -m pip install mypy
- name: Install to system
run: python -m pip install .
- name: Run / Test stub
if: ${{ matrix.device == 'cpu' }} # currently GPU runner is not supported
run: |
echo -e "from scaluq.f64 import StateVector, gate\nstate = StateVector(2)\nx = gate.X(0)\nx.update_quantum_state(state)\nprint(state.get_amplitudes())" > /tmp/sample.py
python /tmp/sample.py
python -m mypy /tmp/sample.py