Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
202 commits
Select commit Hold shift + click to select a range
b3da13a
First stage of cutensor wrapper, only works with basic strides
SpaceyLake Oct 3, 2025
362962c
Added the use of handle
SpaceyLake Oct 3, 2025
f2ed80f
Updated bindings allowing for non-contigous output tensor.
SpaceyLake Oct 10, 2025
933fba4
Modified to work with current CuTensor bindings
SpaceyLake Oct 10, 2025
a2d46d3
Added functionality for elemental operation on D
SpaceyLake Oct 14, 2025
00e90e5
Fixed function name
SpaceyLake Oct 22, 2025
439d5cf
Fixed precision type
SpaceyLake Oct 22, 2025
e8f86f0
Small sectioning optimization
SpaceyLake Oct 22, 2025
412f1fe
Fixed scalar for permute D
SpaceyLake Oct 22, 2025
f584e7d
Fixed sectioning
SpaceyLake Oct 22, 2025
2b2ecec
Created a demo version that loads libraries dynamically
SpaceyLake Oct 22, 2025
29230cb
Created a test version that loads libraries dynamically
SpaceyLake Oct 22, 2025
aa69f9a
Simple exapmle of using CuTensor
SpaceyLake Oct 22, 2025
f407841
Made cuda stream a part of TAPP_executor
SpaceyLake Oct 27, 2025
4ca108b
Algorithm correction
SpaceyLake Oct 27, 2025
a917783
Added cutensor handle to TAPP_handle
SpaceyLake Oct 27, 2025
d80d06f
Corrected copying of memory
SpaceyLake Oct 27, 2025
f8e70fb
cutensor error handling
janbrandejs Nov 21, 2025
87cdea5
can compile with cmake
SpaceyLake Dec 4, 2025
3353f35
Fixed typo
SpaceyLake Dec 4, 2025
31b44ba
Added the handle to create tensor info
SpaceyLake Dec 5, 2025
0d67763
Added handle when creating tensor info in old files
SpaceyLake Jan 9, 2026
7dbaf36
Uncommented code
SpaceyLake Jan 9, 2026
81e8234
Made test use tblis instead of cutensor
SpaceyLake Jan 9, 2026
c6d6737
Added the use of attributes to decide if input is on host or device
SpaceyLake Jan 9, 2026
9f361ad
Added demo for cutensor with on device input
SpaceyLake Jan 9, 2026
2a466f3
Dynamic demo running on cutensor with attribute to telling use of hos…
SpaceyLake Jan 9, 2026
7f061fa
Updated error handling
SpaceyLake Jan 14, 2026
d701639
Updated function calls with create executor and handle as part of the…
SpaceyLake Feb 5, 2026
f6838a0
Added define statement
SpaceyLake Feb 5, 2026
c77f973
Updated include
SpaceyLake Feb 5, 2026
3698239
Creation of handlle and executor now handled by TAPP
SpaceyLake Feb 5, 2026
ded6ad7
Removed TAPP_EXPORT from definitions
SpaceyLake Feb 5, 2026
6276132
Removed unnecessary includes
SpaceyLake Feb 5, 2026
7fcad82
Corrected print
SpaceyLake Feb 5, 2026
aa80808
Updated function calls for cudemo
SpaceyLake Feb 5, 2026
bff60bb
Restructured
SpaceyLake Feb 5, 2026
6269b5f
Updated to follow the new "normal" test
SpaceyLake Feb 5, 2026
49a395a
Updated cmake to work with the new changes
SpaceyLake Feb 5, 2026
cfbb6d4
Updated cmake to not require cuda
SpaceyLake Feb 5, 2026
f21e618
Moved the adding of test
SpaceyLake Feb 5, 2026
ada644c
Attempt to use cuda in tests
SpaceyLake Feb 5, 2026
c06e280
Fixed missed D
SpaceyLake Feb 5, 2026
1f2671b
Attempt to fix "CMAKE_C_COMPILER not set, after EnableLanguage"
SpaceyLake Feb 5, 2026
2ea7cd1
improve cutensor lib discovery inc. conda install, allow custom tblis…
jurajHasik Feb 7, 2026
8e5a2d5
First stage of cutensor wrapper, only works with basic strides
SpaceyLake Oct 3, 2025
e40c78a
Added the use of handle
SpaceyLake Oct 3, 2025
dccdc70
Updated bindings allowing for non-contigous output tensor.
SpaceyLake Oct 10, 2025
b8e65ba
Modified to work with current CuTensor bindings
SpaceyLake Oct 10, 2025
1197747
Added functionality for elemental operation on D
SpaceyLake Oct 14, 2025
308da00
Fixed function name
SpaceyLake Oct 22, 2025
bf3b0bb
Fixed precision type
SpaceyLake Oct 22, 2025
0d724cd
Small sectioning optimization
SpaceyLake Oct 22, 2025
50f724d
Fixed scalar for permute D
SpaceyLake Oct 22, 2025
25b1f23
Fixed sectioning
SpaceyLake Oct 22, 2025
e6eeac2
Created a demo version that loads libraries dynamically
SpaceyLake Oct 22, 2025
a868c35
Created a test version that loads libraries dynamically
SpaceyLake Oct 22, 2025
f716779
Simple exapmle of using CuTensor
SpaceyLake Oct 22, 2025
0f70697
Made cuda stream a part of TAPP_executor
SpaceyLake Oct 27, 2025
242c855
Algorithm correction
SpaceyLake Oct 27, 2025
7042cac
Added cutensor handle to TAPP_handle
SpaceyLake Oct 27, 2025
dbeb969
Corrected copying of memory
SpaceyLake Oct 27, 2025
f79d9ed
cutensor error handling
janbrandejs Nov 21, 2025
339b1b9
can compile with cmake
SpaceyLake Dec 4, 2025
05e4dbb
Fixed typo
SpaceyLake Dec 4, 2025
ee049f6
Added the handle to create tensor info
SpaceyLake Dec 5, 2025
795e386
Added handle when creating tensor info in old files
SpaceyLake Jan 9, 2026
e035333
Uncommented code
SpaceyLake Jan 9, 2026
c8a50ff
Made test use tblis instead of cutensor
SpaceyLake Jan 9, 2026
5f5f85f
Added the use of attributes to decide if input is on host or device
SpaceyLake Jan 9, 2026
e910c72
Added demo for cutensor with on device input
SpaceyLake Jan 9, 2026
2f64da2
Dynamic demo running on cutensor with attribute to telling use of hos…
SpaceyLake Jan 9, 2026
5638ff8
Updated error handling
SpaceyLake Jan 14, 2026
1279655
Updated function calls with create executor and handle as part of the…
SpaceyLake Feb 5, 2026
37a000e
Added define statement
SpaceyLake Feb 5, 2026
4825dbd
Updated include
SpaceyLake Feb 5, 2026
98c2c77
Creation of handlle and executor now handled by TAPP
SpaceyLake Feb 5, 2026
4f7df34
Removed TAPP_EXPORT from definitions
SpaceyLake Feb 5, 2026
d9bc873
Removed unnecessary includes
SpaceyLake Feb 5, 2026
64281a0
Corrected print
SpaceyLake Feb 5, 2026
37cabaa
Updated function calls for cudemo
SpaceyLake Feb 5, 2026
5be169d
Restructured
SpaceyLake Feb 5, 2026
a55f422
Updated to follow the new "normal" test
SpaceyLake Feb 5, 2026
6dc5732
Updated cmake to work with the new changes
SpaceyLake Feb 5, 2026
dc2a122
Updated cmake to not require cuda
SpaceyLake Feb 5, 2026
a157683
Merge branch 'cutensor_bindings' into cmake_extension
SpaceyLake Feb 9, 2026
08e2e49
Merge pull request #37 from jurajHasik/cmake_extension
SpaceyLake Feb 9, 2026
577418d
Restructure, with own CMake for the bindings
SpaceyLake Feb 9, 2026
161f1b0
Removed depricated code
SpaceyLake Feb 9, 2026
3b7888c
Removed more depricated code
SpaceyLake Feb 9, 2026
98665cf
Update exercises
SpaceyLake Feb 9, 2026
ec88bdb
Changed comments
SpaceyLake Feb 9, 2026
e7387d9
Seeing to it that the examples have create and destroy handles
SpaceyLake Feb 9, 2026
cb02009
make permutation path in cutensor optional, fix cmake, fix setting us…
jurajHasik Feb 10, 2026
0e822ae
skip syncing stream, unless offloading
jurajHasik Feb 10, 2026
389423c
handle memory via Async allocation using stream (executor)
jurajHasik Feb 10, 2026
f0abc67
fix type TAPP_attr_get
jurajHasik Feb 11, 2026
5144807
Merge pull request #39 from jurajHasik/feat_skip_permute
SpaceyLake Feb 12, 2026
04d04fc
Fixed a bug where generation of test with subtensor with lower number…
SpaceyLake Feb 12, 2026
841a965
Merge branch 'refs/heads/main' into cutensor_bindings
evaleev Feb 13, 2026
e64b280
[cutensor] slim down cmake harness + no need for CUDA
evaleev Feb 13, 2026
691c0b3
[cutensor] cleanup CMake yet more, missing/misnamed headers
evaleev Feb 13, 2026
f31bfdb
[cmake] push down tests/examples CMake code into the respective subdirs
evaleev Feb 13, 2026
241cdac
[cutensor] tapp-reference-cutensor -> tapp-cutensor
evaleev Feb 13, 2026
6b1b5d0
Workaround, only doing reductions when necessary, avoiding some cases…
SpaceyLake Feb 17, 2026
dac4050
Put alpha and beta to more appropriate values
SpaceyLake Feb 17, 2026
a73fcca
Merge branch 'cutensor_bindings' of github.com:TAPPorg/reference-impl…
SpaceyLake Feb 17, 2026
04a4fc4
Fixed alpha, beta range for dynamic test
SpaceyLake Feb 17, 2026
48d664c
Moved includes to header files
SpaceyLake Feb 17, 2026
5cd1396
Added missed semicolon
SpaceyLake Feb 17, 2026
0a83ffe
include cutensor.h instead of cutensor/types.h to inject cuda_runtime.h
jurajHasik Feb 22, 2026
6670ff1
Merge pull request #40 from jurajHasik/fix_tapp_cutensor_build
SpaceyLake Feb 23, 2026
3e2ad16
Corrected paths for the dynamically loaded libs
SpaceyLake Feb 23, 2026
9de9a88
Removed accidental character
SpaceyLake Feb 23, 2026
96a4976
First stage of cutensor wrapper, only works with basic strides
SpaceyLake Oct 3, 2025
a0b76b1
Added the use of handle
SpaceyLake Oct 3, 2025
bfe739d
Updated bindings allowing for non-contigous output tensor.
SpaceyLake Oct 10, 2025
c408352
Modified to work with current CuTensor bindings
SpaceyLake Oct 10, 2025
60eb1ee
Added functionality for elemental operation on D
SpaceyLake Oct 14, 2025
d9a7579
Fixed function name
SpaceyLake Oct 22, 2025
9ace705
Fixed precision type
SpaceyLake Oct 22, 2025
ac0b41e
Small sectioning optimization
SpaceyLake Oct 22, 2025
5bf8908
Fixed scalar for permute D
SpaceyLake Oct 22, 2025
55d6188
Fixed sectioning
SpaceyLake Oct 22, 2025
9134a72
Created a demo version that loads libraries dynamically
SpaceyLake Oct 22, 2025
e9dbc9e
Created a test version that loads libraries dynamically
SpaceyLake Oct 22, 2025
ce49813
Simple exapmle of using CuTensor
SpaceyLake Oct 22, 2025
6829808
Made cuda stream a part of TAPP_executor
SpaceyLake Oct 27, 2025
6047fbc
Algorithm correction
SpaceyLake Oct 27, 2025
894a28d
Added cutensor handle to TAPP_handle
SpaceyLake Oct 27, 2025
d691d4c
Corrected copying of memory
SpaceyLake Oct 27, 2025
b3ddef0
cutensor error handling
janbrandejs Nov 21, 2025
340889b
can compile with cmake
SpaceyLake Dec 4, 2025
b2ea68e
Fixed typo
SpaceyLake Dec 4, 2025
75293e0
Added the handle to create tensor info
SpaceyLake Dec 5, 2025
5ebd73e
Added handle when creating tensor info in old files
SpaceyLake Jan 9, 2026
fe2bc96
Uncommented code
SpaceyLake Jan 9, 2026
cf14255
Made test use tblis instead of cutensor
SpaceyLake Jan 9, 2026
fa3f4e0
Added the use of attributes to decide if input is on host or device
SpaceyLake Jan 9, 2026
76dfb47
Added demo for cutensor with on device input
SpaceyLake Jan 9, 2026
0a82e7c
Dynamic demo running on cutensor with attribute to telling use of hos…
SpaceyLake Jan 9, 2026
5743037
Updated error handling
SpaceyLake Jan 14, 2026
08276e3
Updated function calls with create executor and handle as part of the…
SpaceyLake Feb 5, 2026
0e8a1b9
Added define statement
SpaceyLake Feb 5, 2026
60f148a
Updated include
SpaceyLake Feb 5, 2026
7e34dbe
Creation of handlle and executor now handled by TAPP
SpaceyLake Feb 5, 2026
15bdf44
Removed TAPP_EXPORT from definitions
SpaceyLake Feb 5, 2026
76f900f
Removed unnecessary includes
SpaceyLake Feb 5, 2026
c9d1e21
Corrected print
SpaceyLake Feb 5, 2026
69708c9
Updated function calls for cudemo
SpaceyLake Feb 5, 2026
eabfd49
Restructured
SpaceyLake Feb 5, 2026
4bdc533
Updated to follow the new "normal" test
SpaceyLake Feb 5, 2026
09d693a
Updated cmake to work with the new changes
SpaceyLake Feb 5, 2026
0679bdc
Updated cmake to not require cuda
SpaceyLake Feb 5, 2026
74006ac
Attempt to use cuda in tests
SpaceyLake Feb 5, 2026
f868823
Attempt to fix "CMAKE_C_COMPILER not set, after EnableLanguage"
SpaceyLake Feb 5, 2026
6a6c389
improve cutensor lib discovery inc. conda install, allow custom tblis…
jurajHasik Feb 7, 2026
006af70
First stage of cutensor wrapper, only works with basic strides
SpaceyLake Oct 3, 2025
9c20ce9
Added cutensor handle to TAPP_handle
SpaceyLake Oct 27, 2025
21463bb
Corrected copying of memory
SpaceyLake Oct 27, 2025
727a264
cutensor error handling
janbrandejs Nov 21, 2025
f9f78ea
can compile with cmake
SpaceyLake Dec 4, 2025
24d80cb
Added the use of attributes to decide if input is on host or device
SpaceyLake Jan 9, 2026
8d35420
Dynamic demo running on cutensor with attribute to telling use of hos…
SpaceyLake Jan 9, 2026
9a7bd24
Updated function calls with create executor and handle as part of the…
SpaceyLake Feb 5, 2026
8e3af4e
Updated cmake to work with the new changes
SpaceyLake Feb 5, 2026
6c2be1d
Restructure, with own CMake for the bindings
SpaceyLake Feb 9, 2026
87436c9
Removed depricated code
SpaceyLake Feb 9, 2026
cef44f6
Removed more depricated code
SpaceyLake Feb 9, 2026
973c1b0
Update exercises
SpaceyLake Feb 9, 2026
b1996aa
Changed comments
SpaceyLake Feb 9, 2026
5e6f88c
Seeing to it that the examples have create and destroy handles
SpaceyLake Feb 9, 2026
8f31742
make permutation path in cutensor optional, fix cmake, fix setting us…
jurajHasik Feb 10, 2026
c1e6db3
skip syncing stream, unless offloading
jurajHasik Feb 10, 2026
69b1158
handle memory via Async allocation using stream (executor)
jurajHasik Feb 10, 2026
a351f28
fix type TAPP_attr_get
jurajHasik Feb 11, 2026
8dc4da8
Fixed a bug where generation of test with subtensor with lower number…
SpaceyLake Feb 12, 2026
ca12525
Workaround, only doing reductions when necessary, avoiding some cases…
SpaceyLake Feb 17, 2026
b64966a
Put alpha and beta to more appropriate values
SpaceyLake Feb 17, 2026
edf664a
[cutensor] slim down cmake harness + no need for CUDA
evaleev Feb 13, 2026
2ef1368
[cutensor] cleanup CMake yet more, missing/misnamed headers
evaleev Feb 13, 2026
922c7b2
[cmake] push down tests/examples CMake code into the respective subdirs
evaleev Feb 13, 2026
8d589d5
[cutensor] tapp-reference-cutensor -> tapp-cutensor
evaleev Feb 13, 2026
589be46
Fixed alpha, beta range for dynamic test
SpaceyLake Feb 17, 2026
c60462a
Moved includes to header files
SpaceyLake Feb 17, 2026
5a520d9
Added missed semicolon
SpaceyLake Feb 17, 2026
c8a2d36
include cutensor.h instead of cutensor/types.h to inject cuda_runtime.h
jurajHasik Feb 22, 2026
4917a73
Corrected paths for the dynamically loaded libs
SpaceyLake Feb 23, 2026
03a03fd
Removed accidental character
SpaceyLake Feb 23, 2026
923e2b1
Removed cuda from languages
SpaceyLake Feb 24, 2026
447e382
Merge branch 'cutensor_bindings' of github.com:TAPPorg/reference-impl…
SpaceyLake Feb 24, 2026
b2ee699
Removed old, unused file
SpaceyLake Feb 24, 2026
e2f1262
Changed random seed because seed 0 generates cases that doesn't agree…
SpaceyLake Feb 24, 2026
5eded62
Fixed directories when testing
SpaceyLake Feb 24, 2026
53089b9
Further directory fix when for tests
SpaceyLake Feb 24, 2026
85c59d3
Fixed handle in cutensor plan struct
SpaceyLake Feb 27, 2026
132d365
Fixed value used for giving error description
SpaceyLake Feb 27, 2026
349749d
Added the recommended minimum workspace
SpaceyLake Feb 27, 2026
5e60aef
Fixed linking name
SpaceyLake Feb 27, 2026
7335ccd
Fixed size of copied memory
SpaceyLake Feb 27, 2026
9b6952e
Combined tests with dynamically loaded and statically loaded libs int…
SpaceyLake Feb 27, 2026
b06a4aa
Combined demos with dynamically loaded and statically loaded libs int…
SpaceyLake Feb 27, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ jobs:
-G Ninja
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-DCMAKE_UNITY_BUILD=${{ matrix.build_type == 'Debug' || matrix.valgrind }}
-DTAPP_REFERENCE_ENABLE_TBLIS=${{ !matrix.valgrind }}
-DTAPP_REFERENCE_USE_TBLIS=${{ !matrix.valgrind }}

steps:
- uses: actions/checkout@v4

Expand Down Expand Up @@ -90,6 +91,7 @@ jobs:
run: |
sudo apt-get update
sudo apt-get install ninja-build g++-14 liblapack-dev ccache valgrind

- name: Prepare ccache timestamp
id: ccache_cache_timestamp
shell: cmake -P {0}
Expand Down Expand Up @@ -136,8 +138,8 @@ jobs:
working-directory: ${{github.workspace}}/build
shell: bash
run: |
valgrind --error-exitcode=1 --leak-check=full ./tapp-reference-demo
valgrind --error-exitcode=1 --leak-check=full ./tapp-reference-driver
valgrind --error-exitcode=1 --leak-check=full ./test/tapp-reference-demo
valgrind --error-exitcode=1 --leak-check=full ./examples/tapp-reference-driver

- name: Consume from build tree
if: ${{ !matrix.valgrind && !matrix.sanitize }}
Expand Down
218 changes: 25 additions & 193 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ project(tapp
HOMEPAGE_URL "https://github.com/TAPPOrg/")

# TBLIS requires CXX; enable_language must be called at the top level
option(TAPP_REFERENCE_ENABLE_TBLIS "Build and link TBLIS and TBLIS bindings" OFF)
if(TAPP_REFERENCE_ENABLE_TBLIS)
option(TAPP_REFERENCE_USE_TBLIS "TAPP-Reference will use TBLIS to implement TAPP_product" OFF)
if(TAPP_REFERENCE_USE_TBLIS)
include(CheckLanguage)
check_language(CXX)
if(CMAKE_CXX_COMPILER)
Expand All @@ -65,207 +65,39 @@ set(TAPP_INSTALL_DATADIR "share/tapp/${TAPP_EXT_VERSION}/data"
set(TAPP_INSTALL_DOCDIR "share/tapp/${TAPP_EXT_VERSION}/doc"
CACHE PATH "TAPP doc install directory")

# this provides tapp-api target
# this provides tapp::api target
add_subdirectory(api)

# this provides tapp-reference target
# this provides tapp::reference target
add_subdirectory(reference_implementation)

# ----------------------------------------------------------------------------
# testing

include(CTest)

if(BUILD_TESTING)

# ----------------------------------------------------------------------------
# TBLIS test

if(TAPP_REFERENCE_ENABLE_TBLIS)
add_executable(tapp-reference-test++)

target_sources(
tapp-reference-test++
PRIVATE
test/test.cpp
test/test.h
)

target_link_libraries(
tapp-reference-test++
PRIVATE
tapp-reference
tblis-static
)

set_property(
TARGET tapp-reference-test++
PROPERTY
CXX_STANDARD 20
CXX_STANDARD_REQUIRED YES
CXX_EXTENSIONS NO
)

add_test(
NAME tapp-reference-test++
COMMAND $<TARGET_FILE:tapp-reference-test++>
)
endif()

# ----------------------------------------------------------------------------
# demo

add_executable(tapp-reference-demo)

target_sources(
tapp-reference-demo
PRIVATE
test/demo.c
test/helpers.c
test/helpers.h
)

target_link_libraries(
tapp-reference-demo
PRIVATE
tapp-reference
)

add_test(
NAME tapp-reference-demo
COMMAND $<TARGET_FILE:tapp-reference-demo>
)

# ----------------------------------------------------------------------------
# driver

add_executable(tapp-reference-driver)

target_sources(
tapp-reference-driver
PRIVATE
examples/driver/driver.c
test/helpers.c
test/helpers.h
)

target_include_directories(
tapp-reference-driver
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/test
)

target_link_libraries(
tapp-reference-driver
PRIVATE
tapp-reference
)

add_test(
NAME tapp-reference-driver
COMMAND $<TARGET_FILE:tapp-reference-driver>
)

# ----------------------------------------------------------------------------
# exercise: contraction

if(TAPP_BUILD_EXERCISE)
add_executable(tapp-reference-exercise_contraction)

target_sources(
tapp-reference-exercise_contraction
PRIVATE
examples/exercise_contraction/exercise_contraction.c
test/helpers.c
test/helpers.h
)

target_include_directories(
tapp-reference-exercise_contraction
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/test
)

target_link_libraries(
tapp-reference-exercise_contraction
PRIVATE
tapp-reference
)

add_test(
NAME tapp-reference-exercise_contraction
COMMAND $<TARGET_FILE:tapp-reference-exercise_contraction>
)
# cutensor bindings
option(TAPP_CUTENSOR "Build cuTensor bindings" OFF)
if (TAPP_CUTENSOR)
# enable_language must be called at the top level
include(CheckLanguage)
check_language(CXX)
if(CMAKE_CXX_COMPILER)
enable_language(CXX)
else()
message(FATAL_ERROR "Cannot build cuTENSOR bindings due to missing CXX language support")
endif()
# since CUDAToolkit will be needed in tests/ also, load it here
cmake_minimum_required(VERSION 3.17) # CUDAToolkit
find_package(CUDAToolkit REQUIRED)

# ----------------------------------------------------------------------------
# exercise: contraction answers

add_executable(tapp-reference-exercise_contraction_answers)

target_sources(
tapp-reference-exercise_contraction_answers
PRIVATE
examples/exercise_contraction/answers/exercise_contraction_answers.c
test/helpers.c
test/helpers.h
)

target_include_directories(
tapp-reference-exercise_contraction_answers
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/test
)

target_link_libraries(
tapp-reference-exercise_contraction_answers
PRIVATE
tapp-reference
)

add_test(
NAME tapp-reference-exercise_contraction_answers
COMMAND $<TARGET_FILE:tapp-reference-exercise_contraction_answers>
)

# ----------------------------------------------------------------------------
# exercise: tucker

add_library(tapp-reference-exercise_tucker SHARED)

target_sources(
tapp-reference-exercise_tucker
PUBLIC
examples/exercise_tucker/tapp_tucker/exercise_tucker.h
PRIVATE
examples/exercise_tucker/tapp_tucker/exercise_tucker.c
)

target_link_libraries(
tapp-reference-exercise_tucker
PRIVATE
tapp-reference
)

# ----------------------------------------------------------------------------
# exercise: tucker answers

add_library(tapp-reference-exercise_tucker_answers SHARED)
add_subdirectory(cutensor_bindings)
endif()

target_sources(
tapp-reference-exercise_tucker_answers
PUBLIC
examples/exercise_tucker/tapp_tucker/answers/exercise_tucker_answers.h
PRIVATE
examples/exercise_tucker/tapp_tucker/answers/exercise_tucker_answers.c
)
# ----------------------------------------------------------------------------
# testing

target_link_libraries(
tapp-reference-exercise_tucker_answers
PRIVATE
tapp-reference
)
include(CTest)

if(BUILD_TESTING)
add_subdirectory(test)
add_subdirectory(examples)
endif()

# ============================================================================
Expand Down
2 changes: 2 additions & 0 deletions api/include/tapp/tensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include <stdint.h>

#include "handle.h"
#include "util.h"
#include "error.h"
#include "datatype.h"
Expand All @@ -20,6 +21,7 @@ typedef intptr_t TAPP_tensor_info;
*/

TAPP_EXPORT TAPP_error TAPP_create_tensor_info(TAPP_tensor_info* info,
TAPP_handle handle,
TAPP_datatype type,
int nmode,
const int64_t* extents,
Expand Down
73 changes: 73 additions & 0 deletions cutensor_bindings/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# cuTENSOR is not part of the CUDA toolkit; look for it separately
if(NOT TARGET cutensor::cutensor)
find_path(CUTENSOR_INCLUDE_DIR
NAMES cutensor.h
HINTS ${CUTENSOR_ROOT} ENV CUTENSOR_ROOT
${CUDAToolkit_LIBRARY_ROOT}
PATH_SUFFIXES include
)
find_library(CUTENSOR_LIBRARY
NAMES cutensor
HINTS ${CUTENSOR_ROOT} ENV CUTENSOR_ROOT
${CUDAToolkit_LIBRARY_ROOT}
PATH_SUFFIXES lib lib64 lib/${CMAKE_LIBRARY_ARCHITECTURE}
)

if(NOT CUTENSOR_INCLUDE_DIR OR NOT CUTENSOR_LIBRARY)
message(FATAL_ERROR "cuTENSOR not found; set CUTENSOR_ROOT to the cuTENSOR installation prefix")
endif()
message(STATUS "Found cuTENSOR: ${CUTENSOR_LIBRARY}")
message(STATUS "cuTENSOR include: ${CUTENSOR_INCLUDE_DIR}")

add_library(cutensor::cutensor UNKNOWN IMPORTED GLOBAL)
set_target_properties(cutensor::cutensor PROPERTIES
IMPORTED_LOCATION "${CUTENSOR_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${CUTENSOR_INCLUDE_DIR}"
)
endif()

add_library(tapp-cutensor SHARED)
set_property(TARGET tapp-cutensor PROPERTY EXPORT_NAME cutensor)
add_library(tapp::cutensor ALIAS tapp-cutensor)
target_link_libraries(
cutensor::cutensor
INTERFACE
CUDA::cudart
)

target_sources(tapp-cutensor
PRIVATE
src/attributes.cpp
src/datatype.cpp
src/error.cpp
src/executor.cpp
src/handle.cpp
src/product.cpp
src/tensor.cpp
)

set_target_properties(tapp-cutensor PROPERTIES
POSITION_INDEPENDENT_CODE ON
CXX_STANDARD 20
CXX_STANDARD_REQUIRED YES
)

target_include_directories(tapp-cutensor
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/include
)

target_link_libraries(tapp-cutensor
PUBLIC
tapp::api
PRIVATE
cutensor::cutensor
CUDA::cudart
)

install(TARGETS tapp-cutensor EXPORT tapp
COMPONENT cutensor)

if(APPLE AND CMAKE_C_COMPILER_ID MATCHES "^(Clang|AppleClang)$")
target_link_options(tapp-cutensor PRIVATE "-undefined;dynamic_lookup")
endif()
12 changes: 12 additions & 0 deletions cutensor_bindings/include/attributes.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#ifndef TAPP_REF_IMPL_CUTENSOR_BINDINGS_ATTRIBUTES_H_
#define TAPP_REF_IMPL_CUTENSOR_BINDINGS_ATTRIBUTES_H_

#include <tapp/attributes.h>

#include <cstring>

#include "handle.h"

#define ATTR_KEY_USE_DEVICE_MEMORY 0

#endif /* TAPP_REF_IMPL_CUTENSOR_BINDINGS_ATTRIBUTES_H_ */
16 changes: 16 additions & 0 deletions cutensor_bindings/include/datatype.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#ifndef TAPP_REF_IMPL_CUTENSOR_BINDINGS_DATATYPE_H_
#define TAPP_REF_IMPL_CUTENSOR_BINDINGS_DATATYPE_H_

#include <tapp/datatype.h>

#include <cutensor.h>

#include <complex>

cutensorDataType_t translate_datatype(TAPP_datatype type);

cutensorComputeDescriptor_t translate_prectype(TAPP_prectype prec, TAPP_datatype datatype);

size_t sizeof_datatype(TAPP_datatype type);

#endif /* TAPP_REF_IMPL_CUTENSOR_BINDINGS_DATATYPE_H_ */
Loading
Loading