-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MacOS Support #174
MacOS Support #174
Changes from all commits
59acbd7
7903a1f
49e46e6
9216b63
a099156
1487db0
541ffc9
51a83e9
f1e8a31
64335d4
1649f43
10aa422
72cb44c
81933e0
78eb233
8e461ac
87ef406
585251b
0f72a69
74fe505
16c7810
e603b99
b5e7824
68aa5dd
09a51e7
1a51d3b
7c0b4ae
01dbb5d
51f0f9d
d1b72e8
2ee81b8
cdda846
453bdc7
fc09b84
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
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 |
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++' }} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Macでは |
||
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 | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 公式runnerに入っているもののパッケージを見て、GCCやCMakeのインストールは不要なことがわかったので消しました |
||
- 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/ccache-action@v1.2 | ||
with: | ||
key: "${{ github.job }}-${{ matrix.os }}-${{ matrix.device }}" | ||
verbose: 2 | ||
|
||
- name: Install CUDA toolkit | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. このstepが圧倒的に重いのでなんとかしたい……… |
||
if: ${{ matrix.device == 'cuda' }} | ||
uses: Jimver/cuda-toolkit@v0.2.11 | ||
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CPU版とGPU版を1種類のjobにしてmatrixで分けた