-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #174 from qulacs/137-macos
MacOS Support
- Loading branch information
Showing
9 changed files
with
182 additions
and
165 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: Format | ||
|
||
on: | ||
push: | ||
paths-ignore: | ||
- ".devcontainer/**" | ||
- ".vscode/**" | ||
- "doc/**" | ||
- "*.md" | ||
pull_request: | ||
paths-ignore: | ||
- ".devcontainer/**" | ||
- ".vscode/**" | ||
- "doc/**" | ||
- "*.md" | ||
|
||
jobs: | ||
check-format: | ||
name: Check Format | ||
runs-on: "ubuntu-22.04" | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Setup cmake | ||
uses: lukka/get-cmake@latest | ||
|
||
- name: Install Ninja | ||
run: sudo apt install ninja-build | ||
|
||
- name: Configure | ||
run: | | ||
mkdir -p ./build | ||
cmake -B build -G Ninja | ||
- name: Check format | ||
run: | | ||
ninja -C build format | ||
diff=$(git diff) | ||
echo -n "$diff" | ||
test $(echo -n "$diff" | wc -l) -eq 0 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
name: Build and Test | ||
|
||
on: | ||
push: | ||
paths-ignore: | ||
- ".devcontainer/**" | ||
- ".vscode/**" | ||
- "doc/**" | ||
- "*.md" | ||
pull_request: | ||
paths-ignore: | ||
- ".devcontainer/**" | ||
- ".vscode/**" | ||
- "doc/**" | ||
- "*.md" | ||
|
||
jobs: | ||
test: | ||
name: Build and Test | ||
strategy: | ||
matrix: | ||
os: ["linux", "macos"] | ||
architecture: ["x86_64"] | ||
device: ["cpu", "cuda"] | ||
python-version: ["3.10"] | ||
exclude: | ||
- os: "macos" | ||
device: "cuda" | ||
include: | ||
- os: "linux" | ||
architecture: "x86_64" | ||
runs-on: "ubuntu-22.04" | ||
- os: "macos" | ||
architecture: "x86_64" | ||
runs-on: "macos-13" | ||
runs-on: ${{ matrix.runs-on }} | ||
env: | ||
CMAKE_C_COMPILER: ${{ matrix.os == 'macos' && '/usr/local/opt/ccache/libexec/gcc-14' || '/usr/lib/ccache/gcc' }} | ||
CMAKE_CXX_COMPILER: ${{ matrix.os == 'macos' && '/usr/local/opt/ccache/libexec/g++-14' || '/usr/lib/ccache/g++' }} | ||
CMAKE_BUILD_TYPE: ${{ matrix.device == 'cuda' && 'Release' || 'Debug' }} | ||
SCALUQ_USE_TEST: "ON" | ||
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.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: Install scaluq for Ubuntu | ||
run: ./script/build_gcc.sh | ||
|
||
- name: Install scaluq Python module | ||
run: pip install .[ci] | ||
|
||
- name: Test in Ubuntu | ||
if: ${{ matrix.device == 'cpu' }} # currently GPU runner is not supported | ||
run: | | ||
if [ "$(uname)" == 'Darwin' ]; then | ||
NPROC=$(sysctl -n hw.logicalcpu) | ||
else | ||
NPROC=$(nproc) | ||
fi | ||
OMP_PROC_BIND=false ninja test -C build -j ${NPROC} | ||
- name: Test if stub exists | ||
if: ${{ matrix.device == 'cpu' }} # currently GPU runner is not supported | ||
run: | | ||
echo -e "from scaluq import StateVector\nfrom scaluq.gate import I" > /tmp/stub_sample.py | ||
mypy /tmp/stub_sample.py |
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
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
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
Oops, something went wrong.