CuTangent is a CUDA library for computing forward-mode subgradients, i.e. tangents, by operator-overloading.
+
-
*
/
-x
==
!=
<=>
sqr
sqrt
cbrt
abs
exp
log
log2
log10
pown
pow
recip
sin
cos
tan
asin
acos
atan
atan2
sinh
cosh
tanh
asinh
acosh
atanh
erf
erfc
max
min
mid
clamp
ceil
floor
remquo
isinf
isfinite
isnan
signbit
copysign
Please make sure that you have installed everything mentioned in the section Build Requirements.
git clone https://github.com/neilkichler/cutangent.git
cd cutangent
cmake --preset release
cmake --build build
cmake --install build
CPMAddPackage("gh:neilkichler/[email protected]")
include(FetchContent)
FetchContent_Declare(
cutangent
GIT_REPOSITORY https://github.com/neilkichler/cutangent.git
GIT_TAG v0.2.0
)
FetchContent_MakeAvailable(cutangent)
In either case, you can link to the library using:
target_link_libraries(${PROJECT_NAME} PUBLIC cutangent)
Important
When using CUDA in a CMake project, make sure that it configures the CUDA_ARCHITECTURES
property using
set_target_properties(${PROJECT_NAME} PROPERTIES CUDA_ARCHITECTURES native)
where native
could be replaced by specific versions, see the CMake docs for more information.
Have a look at the examples folder.
The documentation is available here.
We require C++20, CMake v3.25.2+, Ninja, and recent C++ and CUDA compilers.
apt install cmake gcc ninja-build
module load CMake CUDA GCC Ninja
cmake --workflow --preset dev
cmake --preset debug
cmake --build --preset debug
ctest --preset debug
cmake -S . -B build -GNinja
cmake --build build
./build/tests/tests