find_package(CUDATookit) #13
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.2.0" | |
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 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" | |
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.2.0" | |
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 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 |