Skip to content

neilkichler/cutangent

Repository files navigation

CuTangent

Cpp Version CUDA Version CMake Version Docs DOI GitHub License

CuTangent is a CUDA library for computing forward-mode subgradients, i.e. tangents, by operator-overloading.

Supported Operations

+ - * / -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

Installation

Please make sure that you have installed everything mentioned in the section Build Requirements.

System-wide

git clone https://github.com/neilkichler/cutangent.git
cd cutangent
cmake --preset release
cmake --build build
cmake --install build

CMake Project

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.

Example

Have a look at the examples folder.

Documentation

The documentation is available here.

Build

Build Requirements

We require C++20, CMake v3.25.2+, Ninja, and recent C++ and CUDA compilers.

Ubuntu

apt install cmake gcc ninja-build

Cluster

module load CMake CUDA GCC Ninja

Build and run tests

Using Workflows

cmake --workflow --preset dev

Using Presets

cmake --preset debug
cmake --build --preset debug
ctest --preset debug

Using regular CMake

cmake -S . -B build -GNinja
cmake --build build
./build/tests/tests

About

CUDA subgradients using forward-mode Algorithmic Differentiation (AD).

Topics

Resources

License

Stars

Watchers

Forks