-
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
Set precision cmake #182
Conversation
.github/workflows/install.yml
Outdated
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もシステムにインストールするという括りでこっちのワークフローに移動しました。
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 comment
The reason will be displayed to describe this comment to others. Learn more.
システムにインストールしたいだけの人を優先してデフォルト値を変更
example_project/CMakeLists.txt
Outdated
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.
scaluqを使った他のプロジェクトの設定例です
.def("set_computational_basis", | ||
&StateVector<double>::set_computational_basis, | ||
"Initialize with computational basis \\ket{\\mathrm{basis}}.") | ||
.def("get_amplitudes", |
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.
Pythonでの関数名がamplitudes
になっていましたが、C++でのものに合わせて変更しました
include/scaluq/util/utility.hpp
Outdated
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.
ここの関数たちはユーザーがincludeできる必要はないのでupdate_ops.hpp
みたいにヘッダごとsrc/
に移動させるかも(internal名前空間で切ってるし割とどっちでもいい)
dev = [ | ||
"mypy == 1.11.2", | ||
"scikit-build == 0.17.6", | ||
"typing_extensions == 4.12.0", | ||
"numpy == 1.26.0", | ||
"nanobind == 2.0.0" | ||
] | ||
|
||
ci = [ | ||
"mypy == 1.11.2", | ||
"scikit-build == 0.17.6", | ||
"typing_extensions == 4.12.0", | ||
"numpy == 1.26.0", | ||
"nanobind == 2.0.0" | ||
] | ||
|
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.
使う意義が殆ど無い気がしたので消しました
Kokkos::kokkos | ||
Eigen3::Eigen |
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.
Eigenはヘッダオンリーなのでinclude指定に移動しました
"__str__", \ | ||
[](const GATE_TYPE& gate) { return gate->to_string(""); }, \ | ||
#define DEF_GATE_BASE(GATE_TYPE, FLOAT, DESCRIPTION) \ | ||
nb::class_<GATE_TYPE<FLOAT>>(m, #GATE_TYPE, DESCRIPTION) \ |
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.
GATE_TYPE
にが入った状態でそのままclass_
の引数に#GATE_TYPE
が入れられるとPythonの型名に<double>
が入って困る(コンストラクタ使えなかったりmypyに引っかかったりする)ので変えました
merge_gate for control/dense with new cmake
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.
LGTM
README.md
Outdated
NVIDIA GPU と CUDA が利用可能ならば、以下のコマンドで GPU バージョンをインストールできます。ビルドスクリプトの実行の際に `SCALUQ_USE_CUDA` オプションを付けます。 | ||
- 依存ライブラリのEigenとKokkosも同時にインストールされます | ||
- `CMAKE_INSTALL_PREFIX`を設定することで `/usr/local`以外にインストールすることもできます。ユーザーローカルにインストールしたい場合や、別の設定でビルドしたKokkosと衝突させたくない場合は明示的に指定してください。例: `CMAKE_INSTALL_PREFIX=~/.local script/configure; ninja -C build install` | ||
- NVIDIA GPU と CUDA が利用可能ならば、`SCALUQ_USE_CUDA=Yes`を設定してconfigureすることでCUDAを利用するライブラリとしてインストールできます。 |
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.
ありがとうございます!とても良いと思います
SCALUQ_USE_CUDA=ON
を設定した場合、sudo env "PATH=$PATH" ninja -C build install
を使うことを書いてもらえるとありがたいです!
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.
SCALUQ_USE_CUDA=ON
でなくてもビルドに必要な環境変数がrootのデフォルトにない場合があるので`sudo -e env "PATH=$PATH"を基本として注釈を書きました
cuda 12.2.0 -> 12.6.2
Python precision
#177 をできるだけライブラリにコンパイルできるように大幅にCMakeの構成を変えました。
また、
ninja -C build install
でscaluqをシステムにインストールできるようになりました。