-
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
Set precision cmake #182
Merged
Merged
Set precision cmake #182
Changes from 13 commits
Commits
Show all changes
44 commits
Select commit
Hold shift + click to select a range
a60c483
split include/src [WIP]
7aab74e
restore --gpus all
KowerKoint 218f0bb
state_vector compile
KowerKoint 86fad40
add installation
KowerKoint f3b56d8
[WIP] transfering
KowerKoint 71f6d52
transfer most of functions
271c908
reflect commit 4d65f3d
d53e3dc
enable pip install
KowerKoint deb9c49
Github Actions other-project build test
KowerKoint ce75305
specify CMAKE_C**_COMPILER for example_project
KowerKoint 965e9a3
fix typo
KowerKoint c9f8ba0
Python typename on double
KowerKoint 752e069
remove float name from type
KowerKoint a9399ce
nvcc is not in sudo PATH
KowerKoint 8938d40
setup python
KowerKoint 2ec5e6e
eps_f = 1e-6 -> 1e-5
KowerKoint 342ece5
remove mypy check from test
KowerKoint 82df9d9
transfer Circuit
KowerKoint 5fa9b86
float declare Circuit
KowerKoint 7d81c58
modify example_project
KowerKoint 2ec154c
eps_f = 1e-5 -> 1e-4
KowerKoint dd92103
find_package(CUDATookit)
KowerKoint a89d68b
find_package(CUDATookit)
KowerKoint 1641b90
CMAKE_INSTALL_PREFIX, update README
KowerKoint eecb99d
merge_gate for new cmake
239438d
[WIP] tempretize python bindings
9aad61b
python precision
KowerKoint ae1c48b
fix CI python script
KowerKoint b049a04
cuda path for sudo
KowerKoint 3143078
cuda 12.2.0 -> 12.6.2
KowerKoint b28bde7
READMEの要件を追加
KowerKoint 114fcb6
12.6.2->12.6.1
KowerKoint ec83f31
upgrade cuda-toolkit job
KowerKoint 2eabac4
Merge pull request #183 from qulacs/149-merge-2
KowerKoint 214c972
Merge pull request #185 from qulacs/upgrade-cuda-version
KowerKoint 81b37fe
sudo env
87f7453
remove extra quate
96ecce7
add description about precision on README
e23eb27
fix CNot, Toffoli, CCNot alias
ccd574e
revert and fix CX
b348a0d
std::float64_t -> double
2f4ea1e
Merge branch 'set-precision-cmake' into python-precision
KowerKoint 3ea7568
Merge pull request #184 from qulacs/python-precision
KowerKoint c2a2461
Merge branch 'set-precision' into set-precision-cmake
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,160 @@ | ||
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"] | ||
python-version: ["3.10"] | ||
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 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.10"] | ||
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: 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: pip install mypy | ||
|
||
- name: Install to system | ||
run: 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 | ||
python3 /tmp/sample.py | ||
mypy /tmp/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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,3 +43,4 @@ | |
/doc/build/ | ||
/python/scaluq/_version.py | ||
/kokkos-tools | ||
/example_project/build/ |
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 |
---|---|---|
|
@@ -12,10 +12,10 @@ if(NOT DEFINED SCALUQ_USE_CUDA) | |
set(SCALUQ_USE_CUDA OFF) | ||
endif(NOT DEFINED SCALUQ_USE_CUDA) | ||
if(NOT DEFINED SCALUQ_USE_TEST) | ||
set(SCALUQ_USE_TEST ON) | ||
set(SCALUQ_USE_TEST OFF) | ||
endif(NOT DEFINED SCALUQ_USE_TEST) | ||
if(NOT DEFINED SCALUQ_USE_EXE) | ||
set(SCALUQ_USE_EXE ON) | ||
set(SCALUQ_USE_EXE OFF) | ||
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. システムにインストールしたいだけの人を優先してデフォルト値を変更 |
||
endif(NOT DEFINED SCALUQ_USE_EXE) | ||
|
||
message(STATUS "SKBUILD = ${SKBUILD}") | ||
|
@@ -135,7 +135,7 @@ if ((${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") OR (${CMAKE_CXX_COMPILER_ID} STREQ | |
endif() | ||
|
||
### Add subdirectories ### | ||
add_subdirectory(scaluq) | ||
add_subdirectory(src) | ||
if(SKBUILD) | ||
add_subdirectory(python) | ||
endif(SKBUILD) | ||
|
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. scaluqを使った他のプロジェクトの設定例です |
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,15 @@ | ||
cmake_minimum_required(VERSION 3.21) | ||
|
||
project(example) | ||
|
||
find_package(scaluq) | ||
find_package(OpenMP) | ||
add_executable(main main.cpp) | ||
target_include_directories(main PUBLIC /usr/local/include/scaluq) | ||
target_include_directories(main PUBLIC /usr/local/include/kokkos) | ||
target_include_directories(main PUBLIC /usr/local/include/eigen3) | ||
target_compile_features(main PUBLIC cxx_std_20) | ||
target_compile_options(main PUBLIC -fopenmp) | ||
target_compile_definitions(main PUBLIC OPENMP) | ||
target_link_libraries(main PUBLIC scaluq::scaluq) | ||
|
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,10 @@ | ||
#include <scaluq/state/state_vector.hpp> | ||
|
||
int main() { | ||
scaluq::initialize(); | ||
{ | ||
scaluq::StateVector<double> state(2); | ||
std::cout << state << std::endl; | ||
} | ||
scaluq::finalize(); | ||
} |
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
File renamed without changes.
File renamed without changes.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
ninja installでシステムに追加したscaluqライブラリが他のプロジェクトで使えるかどうかをテストする項目を追加しました。
また、pip installもシステムにインストールするという括りでこっちのワークフローに移動しました。