-
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
Support more precisions #198
base: main
Are you sure you want to change the base?
Conversation
apt-get install -y gcc-13 g++-13 && \ | ||
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 100 && \ | ||
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-13 100 && \ | ||
apt-get install -y --no-install-recommends \ |
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.
<stdfloat>
のためにg++13が必要
if(NOT DEFINED SCALUQ_FLOAT16) | ||
set(SCALUQ_FLOAT16 OFF) | ||
endif(NOT DEFINED SCALUQ_FLOAT16) | ||
if(NOT DEFINED SCALUQ_FLOAT32) | ||
set(SCALUQ_FLOAT32 ON) | ||
endif(NOT DEFINED SCALUQ_FLOAT32) | ||
if(NOT DEFINED SCALUQ_FLOAT64) | ||
set(SCALUQ_FLOAT64 ON) | ||
endif(NOT DEFINED SCALUQ_FLOAT64) | ||
if(NOT DEFINED SCALUQ_BFLOAT16) | ||
set(SCALUQ_BFLOAT16 OFF) | ||
endif(NOT DEFINED SCALUQ_BFLOAT16) |
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.
各精度コンパイルに含めるかを選択できるようになっていて,デフォルトではF32,F64がONになっています.
if ((${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") OR (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang") OR (${CMAKE_CXX_COMPILER_ID} STREQUAL "AppleClang")) | ||
# Standard |
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.
GCCしかサポートしていないので削除
if ((${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") OR (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang") OR (${CMAKE_CXX_COMPILER_ID} STREQUAL "AppleClang")) | ||
# Standard | ||
# Standard | ||
if(SCALUQ_USE_CUDA) | ||
target_compile_features(scaluq PUBLIC cxx_std_20) |
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.
NVCCはC++23に対応していない
using StdComplex = std::complex<Fp>; | ||
template <std::floating_point Fp> | ||
using Complex = Kokkos::complex<Fp>; | ||
using StdComplex = std::complex<double>; |
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.
ユーザー向けはdouble
std::complex<double>
だけ使ってもらうことにしたので,Complex
はinternalへ
using ComplexMatrix = Eigen::Matrix<StdComplex, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor>; | ||
using SparseComplexMatrix = Eigen::SparseMatrix<StdComplex, Eigen::RowMajor>; |
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.
こいつらはユーザー向けなのであとでinternalの外へ移動
|
||
namespace scaluq { | ||
enum class Precision { F16, F32, F64, BF16 }; | ||
} |
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.
`template std::floating_pointをやめてこのenumをテンプレートで指定することになります
template <typename T> | ||
struct IsFloatingPoint : public std::false_type {}; | ||
#ifdef SCALUQ_FLOAT16 | ||
#ifdef SCALUQ_USE_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.
種類 | CPU | CUDA |
---|---|---|
F16 | std::float16_t |
__half |
F32 | std::float32_t |
short |
F16 | std::float64_t |
double |
F16 | std::bfloat16_t |
__nv_bfloat16 |
include/scaluq/type/complex.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.
Kokkos::Complex
はstd::floating_point
コンセプトが条件になっていて,残念ながらCUDA独自の__half
__nv_bfloat16
は置けないので自作し直した:innocent:
テストが通ってREADMEも整備できたので、 #200 の分をここで手動でマージします。 |
IEEE754 float16(
F16
)とbinary16(F16
)をサポートします.テストとPythonバインドは未対応です.