CuInterval is a CUDA interval arithmetic library. It includes all fundamental and set-based interval operations of the IEEE Standard for Interval Arithmetic. Other flavors, including decorations are not supported.
The following operations are implemented as CUDA kernels. All operations are correctly-rounded, given the limitations of the precision of the underlying CUDA operation. The tightest interval is always a subset of the computed interval. The lower and upper bounds of the basic operations are at most 3 ulps away from the lower and upper bounds of the correct interval, respectively. The error for a paricular operation is given below.
Basic Operations
Operation | Function Description | Error [ulps] |
---|---|---|
pos | 0 | |
neg | 0 | |
add | 0 | |
sub | 0 | |
mul | 0 | |
div | 0 | |
recip | 0 | |
sqr | 0 | |
sqrt | 0 | |
fma | 0 |
Power functions
Operation | Function Description | Error [ulps] |
---|---|---|
pown | 1 | |
pow | 1 | |
rootn | 2 | |
cbrt | 1 | |
exp | 3 | |
exp2 | 3 | |
exp10 | 3 | |
expm1 | 3 | |
log | 3 | |
log2 | 3 | |
log10 | 3 | |
log1p | 3 |
Trigonometric functions
Operation | Function Description | Error [ulps] |
---|---|---|
sin | 2 | |
cos | 2 | |
tan | 3 | |
asin | 3 | |
acos | 3 | |
atan | 3 | |
atan2 | 3 | |
cot | 2 | |
sinpi | 3 | |
cospi | 3 |
Hyperbolic functions
Operation | Function Description | Error [ulps] |
---|---|---|
sinh | 3 | |
cosh | 2 | |
tanh | 2 | |
asinh | 3 | |
acosh | 3 | |
atanh | 3 |
Special functions
Operation | Function Description | Error [ulps] |
---|---|---|
erf | 2 | |
erfc | 5 |
Integer functions
Operation | Function Description | Error [ulps] |
---|---|---|
sign | 0 | |
ceil | 0 | |
floor | 0 | |
trunc | 0 | |
roundTiesToEven | 0 | |
roundTiesToAway | 0 |
Absmax functions
Operation | Function Description | Error [ulps] |
---|---|---|
abs | 0 | |
min | 0 | |
max | 0 |
Numeric functions
Operation | Function Description | Error [ulps] |
---|---|---|
inf | 0 | |
sup | 0 | |
mid | 0 | |
wid | 0 | |
rad | 0 | |
mag | 0 | |
mig | 0 |
Boolean functions
Operation | Function Description | Error [ulps] |
---|---|---|
equal | 0 | |
subset | 0 | |
interior | 0 | |
disjoint | 0 | |
isEmpty | 0 | |
isEntire | 0 | |
less | 0 | |
strictLess | 0 | |
precedes | 0 | |
strictPrecedes | 0 | |
isMember | 0 | |
isSingleton | 0 | |
isCommonInterval | 0 |
Set operations
Operation | Function Description | Error [ulps] |
---|---|---|
intersection | 0 | |
convexHull | 0 |
Cancellative add and subtract
Operation | Function Description | Error [ulps] |
---|---|---|
cancelMinus | 0 | |
cancelPlus | 0 |
Please make sure that you have installed everything mentioned in the section Build Requirements.
git clone https://github.com/neilkichler/cuinterval.git
cd cuinterval
cmake --preset release
cmake --build build
cmake --install build
CPMAddPackage("gh:neilkichler/[email protected]")
include(FetchContent)
FetchContent_Declare(
cuinterval
GIT_REPOSITORY [email protected]:neilkichler/cuinterval.git
GIT_TAG main
)
FetchContent_MakeAvailable(cuinterval)
In either case, you can link to the library using:
target_link_libraries(${PROJECT_NAME} PUBLIC cuinterval)
Have a look at the examples folder.
The documentation is available here.
We use C++20, CMake v3.25.2+, Ninja (optional), and a recent C++ and CUDA compiler.
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