tensoracle 2.2.3__tar.gz → 2.4.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (180) hide show
  1. {tensoracle-2.2.3 → tensoracle-2.4.0}/CMakeLists.txt +1 -0
  2. {tensoracle-2.2.3 → tensoracle-2.4.0}/PKG-INFO +18 -3
  3. {tensoracle-2.2.3 → tensoracle-2.4.0}/README.md +15 -1
  4. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/CMakeLists.txt +39 -6
  5. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/README.md +35 -2
  6. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/cmake/tensoracleConfig.cmake.in +2 -2
  7. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/conan/bootstrap.cmake +4 -0
  8. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/conanfile.py +0 -11
  9. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/include/tensoracle/tensoracle.h +5 -3
  10. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/tests/CMakeLists.txt +5 -0
  11. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/tests/installed.cmake +9 -1
  12. tensoracle-2.4.0/cpp/tests/static_consumer/CMakeLists.txt +20 -0
  13. tensoracle-2.4.0/cpp/tests/static_consumer/fixture.cpp +69 -0
  14. tensoracle-2.4.0/cpp/tests/static_consumer/fixture.h +24 -0
  15. tensoracle-2.4.0/cpp/tests/static_consumer/main.c +52 -0
  16. tensoracle-2.4.0/cpp/tests/static_consumer/main.cpp +39 -0
  17. {tensoracle-2.2.3 → tensoracle-2.4.0}/docs/cpp-sdk.md +53 -2
  18. {tensoracle-2.2.3 → tensoracle-2.4.0}/docs/index.md +13 -1
  19. {tensoracle-2.2.3 → tensoracle-2.4.0}/docs/tensorrt-sdk.md +25 -2
  20. {tensoracle-2.2.3 → tensoracle-2.4.0}/examples/cubin_plugin/README.md +1 -1
  21. {tensoracle-2.2.3 → tensoracle-2.4.0}/examples/wheel_consumer/README.md +4 -2
  22. {tensoracle-2.2.3 → tensoracle-2.4.0}/pyproject.toml +2 -1
  23. {tensoracle-2.2.3 → tensoracle-2.4.0}/src/tensoracle/_version.py +2 -2
  24. {tensoracle-2.2.3 → tensoracle-2.4.0}/tests/test_conan.py +43 -0
  25. {tensoracle-2.2.3 → tensoracle-2.4.0}/tests/test_distribution.py +38 -8
  26. {tensoracle-2.2.3 → tensoracle-2.4.0}/tests/test_example_plugin.py +9 -1
  27. tensoracle-2.4.0/tests/test_native_install.py +96 -0
  28. tensoracle-2.4.0/tests/test_static_sdk.py +147 -0
  29. {tensoracle-2.2.3 → tensoracle-2.4.0}/uv.lock +7 -3
  30. {tensoracle-2.2.3 → tensoracle-2.4.0}/.gitignore +0 -0
  31. {tensoracle-2.2.3 → tensoracle-2.4.0}/LICENSE +0 -0
  32. {tensoracle-2.2.3 → tensoracle-2.4.0}/bindings.cpp +0 -0
  33. {tensoracle-2.2.3 → tensoracle-2.4.0}/build_backend.py +0 -0
  34. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/cmake/TensoracleCubinPlugin.cmake +0 -0
  35. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/cmake/TensoracleCuda.cmake +0 -0
  36. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/cmake/TensoracleDependencies.cmake +0 -0
  37. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/conan/install.cmake +0 -0
  38. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/conan/prepare-tests.cmake +0 -0
  39. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/conan/profiles/linux-gcc13 +0 -0
  40. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/conan/profiles/linux-gcc14 +0 -0
  41. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/conan/recipes/cuda-toolkit/conanfile.py +0 -0
  42. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/conan/recipes/cuda-toolkit/redist.json +0 -0
  43. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/conan/recipes/tensorrt/LICENSE.NVIDIA +0 -0
  44. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/conan/recipes/tensorrt/LICENSE.OSS +0 -0
  45. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/conan/recipes/tensorrt/conandata.yml +0 -0
  46. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/conan/recipes/tensorrt/conanfile.py +0 -0
  47. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/conan/recipes.json +0 -0
  48. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/conan/recipes.py +0 -0
  49. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/conan.lock +0 -0
  50. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/include/tensoracle/builder.h +0 -0
  51. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/include/tensoracle/builder.hpp +0 -0
  52. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/include/tensoracle/cache.h +0 -0
  53. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/include/tensoracle/cache.hpp +0 -0
  54. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/include/tensoracle/cubin.h +0 -0
  55. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/include/tensoracle/cubin.hpp +0 -0
  56. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/include/tensoracle/cubin_plugin.hpp +0 -0
  57. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/include/tensoracle/engine.h +0 -0
  58. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/include/tensoracle/engine.hpp +0 -0
  59. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/include/tensoracle/plugins.h +0 -0
  60. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/include/tensoracle/plugins.hpp +0 -0
  61. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/include/tensoracle/tensoracle.hpp +0 -0
  62. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/src/abi.cpp +0 -0
  63. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/src/builder.cpp +0 -0
  64. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/src/builder_internal.hpp +0 -0
  65. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/src/bundle.cpp +0 -0
  66. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/src/bundle_internal.hpp +0 -0
  67. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/src/cache.cpp +0 -0
  68. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/src/cache.hpp +0 -0
  69. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/src/cache_management.cpp +0 -0
  70. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/src/cache_management_internal.cpp +0 -0
  71. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/src/cache_management_internal.hpp +0 -0
  72. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/src/cache_open.cpp +0 -0
  73. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/src/comparison.cpp +0 -0
  74. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/src/cubin_plugin.cpp +0 -0
  75. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/src/engine.cpp +0 -0
  76. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/src/engine_internal.hpp +0 -0
  77. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/src/error.cpp +0 -0
  78. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/src/error.hpp +0 -0
  79. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/src/native_exports.hpp +0 -0
  80. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/src/plugins.cpp +0 -0
  81. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/src/producer.cpp +0 -0
  82. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/src/safetensors.cpp +0 -0
  83. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/src/safetensors.hpp +0 -0
  84. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/src/sha256.hpp +0 -0
  85. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/src/structure.hpp +0 -0
  86. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/src/tensoracle.map +0 -0
  87. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/tests/abi.cpp +0 -0
  88. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/tests/builder.cpp +0 -0
  89. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/tests/builder_fixture.hpp +0 -0
  90. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/tests/builder_probe.cpp +0 -0
  91. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/tests/c_consumer.c +0 -0
  92. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/tests/cache.cpp +0 -0
  93. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/tests/cache_management.cpp +0 -0
  94. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/tests/cache_probe.cpp +0 -0
  95. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/tests/comparison.cpp +0 -0
  96. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/tests/concurrent_builder.hpp +0 -0
  97. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/tests/consumer/CMakeLists.txt +0 -0
  98. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/tests/consumer/main.cpp +0 -0
  99. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/tests/core.cpp +0 -0
  100. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/tests/cubin.cpp +0 -0
  101. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/tests/driver_failures.cpp +0 -0
  102. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/tests/execution.cpp +0 -0
  103. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/tests/native_exports.cpp +0 -0
  104. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/tests/native_exports_fixture.cpp +0 -0
  105. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/tests/plugin_fixture.cpp +0 -0
  106. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/tests/plugins.cpp +0 -0
  107. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/tests/precision.cpp +0 -0
  108. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/tests/runtime.cmake +0 -0
  109. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/tests/utilities.cpp +0 -0
  110. {tensoracle-2.2.3 → tensoracle-2.4.0}/cpp/tests/weights.cpp +0 -0
  111. {tensoracle-2.2.3 → tensoracle-2.4.0}/cubin_bindings.cpp +0 -0
  112. {tensoracle-2.2.3 → tensoracle-2.4.0}/docs/api/bundle.md +0 -0
  113. {tensoracle-2.2.3 → tensoracle-2.4.0}/docs/api/index.md +0 -0
  114. {tensoracle-2.2.3 → tensoracle-2.4.0}/docs/api/producer.md +0 -0
  115. {tensoracle-2.2.3 → tensoracle-2.4.0}/docs/cpp-python-repositories.md +0 -0
  116. {tensoracle-2.2.3 → tensoracle-2.4.0}/docs/migration.md +0 -0
  117. {tensoracle-2.2.3 → tensoracle-2.4.0}/docs/optimization.md +0 -0
  118. {tensoracle-2.2.3 → tensoracle-2.4.0}/docs/precision.md +0 -0
  119. {tensoracle-2.2.3 → tensoracle-2.4.0}/examples/cubin_plugin/CMakeLists.txt +0 -0
  120. {tensoracle-2.2.3 → tensoracle-2.4.0}/examples/cubin_plugin/bindings.cpp +0 -0
  121. {tensoracle-2.2.3 → tensoracle-2.4.0}/examples/cubin_plugin/bundle/bundle.cpp +0 -0
  122. {tensoracle-2.2.3 → tensoracle-2.4.0}/examples/cubin_plugin/bundle/bundle.json +0 -0
  123. {tensoracle-2.2.3 → tensoracle-2.4.0}/examples/cubin_plugin/bundle/cubins/sm120/bias.cubin +0 -0
  124. {tensoracle-2.2.3 → tensoracle-2.4.0}/examples/cubin_plugin/bundle/cubins/sm120/dot.specialized.cubin +0 -0
  125. {tensoracle-2.2.3 → tensoracle-2.4.0}/examples/cubin_plugin/bundle/cubins/sm120/dot.tf32-control.cubin +0 -0
  126. {tensoracle-2.2.3 → tensoracle-2.4.0}/examples/cubin_plugin/bundle/cubins/sm120/dot.unspecialized.cubin +0 -0
  127. {tensoracle-2.2.3 → tensoracle-2.4.0}/examples/cubin_plugin/bundle/cubins/sm120/scale.cubin +0 -0
  128. {tensoracle-2.2.3 → tensoracle-2.4.0}/examples/cubin_plugin/bundle/cubins/sm86/bias.cubin +0 -0
  129. {tensoracle-2.2.3 → tensoracle-2.4.0}/examples/cubin_plugin/bundle/cubins/sm86/dot.specialized.cubin +0 -0
  130. {tensoracle-2.2.3 → tensoracle-2.4.0}/examples/cubin_plugin/bundle/cubins/sm86/dot.tf32-control.cubin +0 -0
  131. {tensoracle-2.2.3 → tensoracle-2.4.0}/examples/cubin_plugin/bundle/cubins/sm86/dot.unspecialized.cubin +0 -0
  132. {tensoracle-2.2.3 → tensoracle-2.4.0}/examples/cubin_plugin/bundle/cubins/sm86/scale.cubin +0 -0
  133. {tensoracle-2.2.3 → tensoracle-2.4.0}/examples/cubin_plugin/bundle/cubins/sm89/bias.cubin +0 -0
  134. {tensoracle-2.2.3 → tensoracle-2.4.0}/examples/cubin_plugin/bundle/cubins/sm89/dot.specialized.cubin +0 -0
  135. {tensoracle-2.2.3 → tensoracle-2.4.0}/examples/cubin_plugin/bundle/cubins/sm89/dot.tf32-control.cubin +0 -0
  136. {tensoracle-2.2.3 → tensoracle-2.4.0}/examples/cubin_plugin/bundle/cubins/sm89/dot.unspecialized.cubin +0 -0
  137. {tensoracle-2.2.3 → tensoracle-2.4.0}/examples/cubin_plugin/bundle/cubins/sm89/scale.cubin +0 -0
  138. {tensoracle-2.2.3 → tensoracle-2.4.0}/examples/cubin_plugin/example_cubin_plugin/__init__.py +0 -0
  139. {tensoracle-2.2.3 → tensoracle-2.4.0}/examples/cubin_plugin/example_cubin_plugin/weights.safetensors +0 -0
  140. {tensoracle-2.2.3 → tensoracle-2.4.0}/examples/cubin_plugin/kernels.cu +0 -0
  141. {tensoracle-2.2.3 → tensoracle-2.4.0}/examples/cubin_plugin/kernels.py +0 -0
  142. {tensoracle-2.2.3 → tensoracle-2.4.0}/examples/cubin_plugin/plugin.cpp +0 -0
  143. {tensoracle-2.2.3 → tensoracle-2.4.0}/examples/cubin_plugin/pyproject.toml +0 -0
  144. {tensoracle-2.2.3 → tensoracle-2.4.0}/examples/wheel_consumer/CMakeLists.txt +0 -0
  145. {tensoracle-2.2.3 → tensoracle-2.4.0}/examples/wheel_consumer/bindings.cpp +0 -0
  146. {tensoracle-2.2.3 → tensoracle-2.4.0}/examples/wheel_consumer/pyproject.toml +0 -0
  147. {tensoracle-2.2.3 → tensoracle-2.4.0}/examples/wheel_consumer/src/tensoracle_consumer/__init__.py +0 -0
  148. {tensoracle-2.2.3 → tensoracle-2.4.0}/mkdocs.yml +0 -0
  149. {tensoracle-2.2.3 → tensoracle-2.4.0}/src/tensoracle/__init__.py +0 -0
  150. {tensoracle-2.2.3 → tensoracle-2.4.0}/src/tensoracle/_cli.py +0 -0
  151. {tensoracle-2.2.3 → tensoracle-2.4.0}/src/tensoracle/_comparison.py +0 -0
  152. {tensoracle-2.2.3 → tensoracle-2.4.0}/src/tensoracle/bundle.py +0 -0
  153. {tensoracle-2.2.3 → tensoracle-2.4.0}/src/tensoracle/convert.py +0 -0
  154. {tensoracle-2.2.3 → tensoracle-2.4.0}/src/tensoracle/producer.py +0 -0
  155. {tensoracle-2.2.3 → tensoracle-2.4.0}/src/tensoracle/py.typed +0 -0
  156. {tensoracle-2.2.3 → tensoracle-2.4.0}/tests/cubin_io/check.cpp +0 -0
  157. {tensoracle-2.2.3 → tensoracle-2.4.0}/tests/cubins/ptxas-12.9.86/sm120.cubin +0 -0
  158. {tensoracle-2.2.3 → tensoracle-2.4.0}/tests/cubins/ptxas-12.9.86/sm86.cubin +0 -0
  159. {tensoracle-2.2.3 → tensoracle-2.4.0}/tests/cubins/ptxas-12.9.86/sm89.cubin +0 -0
  160. {tensoracle-2.2.3 → tensoracle-2.4.0}/tests/native/CMakeLists.txt +0 -0
  161. {tensoracle-2.2.3 → tensoracle-2.4.0}/tests/native/cache/CMakeLists.txt +0 -0
  162. {tensoracle-2.2.3 → tensoracle-2.4.0}/tests/native/cache/writer.cpp +0 -0
  163. {tensoracle-2.2.3 → tensoracle-2.4.0}/tests/native/export.h +0 -0
  164. {tensoracle-2.2.3 → tensoracle-2.4.0}/tests/native_build.py +0 -0
  165. {tensoracle-2.2.3 → tensoracle-2.4.0}/tests/test_build_distributions.py +0 -0
  166. {tensoracle-2.2.3 → tensoracle-2.4.0}/tests/test_bundle.py +0 -0
  167. {tensoracle-2.2.3 → tensoracle-2.4.0}/tests/test_cache_cli.py +0 -0
  168. {tensoracle-2.2.3 → tensoracle-2.4.0}/tests/test_cmake_cuda.py +0 -0
  169. {tensoracle-2.2.3 → tensoracle-2.4.0}/tests/test_cmake_plugin.py +0 -0
  170. {tensoracle-2.2.3 → tensoracle-2.4.0}/tests/test_comparison.py +0 -0
  171. {tensoracle-2.2.3 → tensoracle-2.4.0}/tests/test_comparison_binding.py +0 -0
  172. {tensoracle-2.2.3 → tensoracle-2.4.0}/tests/test_convert.py +0 -0
  173. {tensoracle-2.2.3 → tensoracle-2.4.0}/tests/test_cpp_core.py +0 -0
  174. {tensoracle-2.2.3 → tensoracle-2.4.0}/tests/test_cpp_test_runtime.py +0 -0
  175. {tensoracle-2.2.3 → tensoracle-2.4.0}/tests/test_native.py +0 -0
  176. {tensoracle-2.2.3 → tensoracle-2.4.0}/tests/test_plugin_io.py +0 -0
  177. {tensoracle-2.2.3 → tensoracle-2.4.0}/tests/test_producer.py +0 -0
  178. {tensoracle-2.2.3 → tensoracle-2.4.0}/tests/test_public_api.py +0 -0
  179. {tensoracle-2.2.3 → tensoracle-2.4.0}/tests/test_recipe_acquisition.py +0 -0
  180. {tensoracle-2.2.3 → tensoracle-2.4.0}/tests/test_tensorrt_recipe.py +0 -0
@@ -21,6 +21,7 @@ set(TENSORACLE_INSTALL_RPATH "$ORIGIN/../../../tensorrt_libs" CACHE STRING "Tens
21
21
  set(CMAKE_INSTALL_LIBDIR lib CACHE STRING "Wheel library directory" FORCE)
22
22
  set(BUILD_TESTING OFF CACHE BOOL "Tests are built separately" FORCE)
23
23
  set(TENSORACLE_BUILD_CUBIN_HELPER OFF CACHE BOOL "Ship the source-based helper" FORCE)
24
+ set(BUILD_SHARED_LIBS ON CACHE BOOL "Wheels ship the shared library" FORCE)
24
25
 
25
26
  add_subdirectory("${_cpp}" cpp)
26
27
  nanobind_add_module(_native STABLE_ABI bindings.cpp cubin_bindings.cpp)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tensoracle
3
- Version: 2.2.3
3
+ Version: 2.4.0
4
4
  Summary: Build, save, reuse, and execute TensorRT engines from safetensors weights
5
5
  Author-Email: minamik <mia@sync.dev>
6
6
  License-Expression: MIT
@@ -19,9 +19,10 @@ Project-URL: issues, https://github.com/sync-dev-org/tensoracle/issues
19
19
  Requires-Python: <3.14,>=3.12
20
20
  Requires-Dist: numpy>=2.0
21
21
  Requires-Dist: safetensors>=0.4
22
- Requires-Dist: tensorrt-cu13<12,>=11.2
23
22
  Provides-Extra: convert
24
23
  Requires-Dist: torch>=2.6; extra == "convert"
24
+ Provides-Extra: tensorrt
25
+ Requires-Dist: tensorrt-cu13<12,>=11.2; extra == "tensorrt"
25
26
  Provides-Extra: producer
26
27
  Requires-Dist: nvidia-cuda-nvrtc==13.2.*; extra == "producer"
27
28
  Requires-Dist: nvidia-cuda-nvcc==13.2.*; extra == "producer"
@@ -52,7 +53,21 @@ Read the [v2 user guide](https://sync-dev-org.github.io/tensoracle/) and [Migrat
52
53
 
53
54
  v2 supplies a Linux x86_64 `manylinux_2_28`, `cp312-abi3` wheel, including WSL2. The package currently declares Python 3.12 and 3.13 support. Target GPUs are sm86, sm89, and sm120 with TensorRT 11.2 or later (below 12); fp8 requires sm89 or sm120. Windows x86_64 users must keep using tensoracle 1.x until a later v2 minor release adds a Windows wheel.
54
55
 
55
- The wheel contains the C++ public headers, `libtensoracle`, CMake package configuration, and cubin plugin helper sources. TensorRT is resolved through a wheel dependency; the NVIDIA driver is not bundled. Public C++ interfaces and saved engine files remain compatible within a major version.
56
+ The wheel contains the C++ public headers, `libtensoracle`, CMake package configuration, and cubin plugin helper sources. TensorRT and the NVIDIA driver are not bundled. Public C++ interfaces and saved engine files remain compatible within a major version.
57
+
58
+ ## Install
59
+
60
+ On Linux or WSL2, configure NVIDIA's CUDA apt repository for your distribution using the [TensorRT Debian installation guide](https://docs.nvidia.com/deeplearning/tensorrt/latest/installing-tensorrt/install-debian.html), then install the TensorRT runtime and tensoracle:
61
+
62
+ ```bash
63
+ sudo apt-get update
64
+ sudo apt-get install libnvinfer11
65
+ pip install tensoracle
66
+ ```
67
+
68
+ Use TensorRT 11.2 or later, below 12, including its builder resources. The wheel is built against TensorRT SDK 11.2.1.2. A full CUDA Toolkit and TensorRT's Python bindings are not required for execution. The host must supply a compatible NVIDIA driver.
69
+
70
+ If you prefer pip to supply TensorRT, install `pip install 'tensoracle[tensorrt]'`. The extra declares `tensorrt-cu13>=11.2,<12`. The wheel looks for that extra's `tensorrt_libs` directory first, then uses the host loader's normal search for `libnvinfer.so.11`. Applications that use the host's apt installation depend on `tensoracle` without the extra. See [runtime installation](https://sync-dev-org.github.io/tensoracle/tensorrt-sdk/#install-the-runtime) for verification.
56
71
 
57
72
  ## Build and reopen an engine in C++
58
73
 
@@ -20,7 +20,21 @@ Read the [v2 user guide](https://sync-dev-org.github.io/tensoracle/) and [Migrat
20
20
 
21
21
  v2 supplies a Linux x86_64 `manylinux_2_28`, `cp312-abi3` wheel, including WSL2. The package currently declares Python 3.12 and 3.13 support. Target GPUs are sm86, sm89, and sm120 with TensorRT 11.2 or later (below 12); fp8 requires sm89 or sm120. Windows x86_64 users must keep using tensoracle 1.x until a later v2 minor release adds a Windows wheel.
22
22
 
23
- The wheel contains the C++ public headers, `libtensoracle`, CMake package configuration, and cubin plugin helper sources. TensorRT is resolved through a wheel dependency; the NVIDIA driver is not bundled. Public C++ interfaces and saved engine files remain compatible within a major version.
23
+ The wheel contains the C++ public headers, `libtensoracle`, CMake package configuration, and cubin plugin helper sources. TensorRT and the NVIDIA driver are not bundled. Public C++ interfaces and saved engine files remain compatible within a major version.
24
+
25
+ ## Install
26
+
27
+ On Linux or WSL2, configure NVIDIA's CUDA apt repository for your distribution using the [TensorRT Debian installation guide](https://docs.nvidia.com/deeplearning/tensorrt/latest/installing-tensorrt/install-debian.html), then install the TensorRT runtime and tensoracle:
28
+
29
+ ```bash
30
+ sudo apt-get update
31
+ sudo apt-get install libnvinfer11
32
+ pip install tensoracle
33
+ ```
34
+
35
+ Use TensorRT 11.2 or later, below 12, including its builder resources. The wheel is built against TensorRT SDK 11.2.1.2. A full CUDA Toolkit and TensorRT's Python bindings are not required for execution. The host must supply a compatible NVIDIA driver.
36
+
37
+ If you prefer pip to supply TensorRT, install `pip install 'tensoracle[tensorrt]'`. The extra declares `tensorrt-cu13>=11.2,<12`. The wheel looks for that extra's `tensorrt_libs` directory first, then uses the host loader's normal search for `libnvinfer.so.11`. Applications that use the host's apt installation depend on `tensoracle` without the extra. See [runtime installation](https://sync-dev-org.github.io/tensoracle/tensorrt-sdk/#install-the-runtime) for verification.
24
38
 
25
39
  ## Build and reopen an engine in C++
26
40
 
@@ -16,8 +16,9 @@ project(tensoracle VERSION ${_tensoracle_MAJOR}.${_tensoracle_MINOR}.${_tensorac
16
16
  include(GNUInstallDirs)
17
17
  include(CMakePackageConfigHelpers)
18
18
  include(cmake/TensoracleCuda.cmake)
19
+ option(BUILD_SHARED_LIBS "Build the shared tensoracle library" ON)
19
20
  option(TENSORACLE_BUILD_CUBIN_HELPER "Build the standalone cubin helper archive" ON)
20
- if(TENSORACLE_BUILD_CUBIN_HELPER)
21
+ if(TENSORACLE_BUILD_CUBIN_HELPER OR NOT BUILD_SHARED_LIBS)
21
22
  # Preserve the existing helper's discovery and diagnostics for native builds.
22
23
  _tensoracle_find_cuda()
23
24
  get_target_property(TENSORACLE_CUDA_INCLUDE tensoracle_cuda_driver INTERFACE_INCLUDE_DIRECTORIES)
@@ -34,7 +35,7 @@ get_filename_component(_tensoracle_tensorrt_root "${TENSORACLE_TENSORRT_INCLUDE}
34
35
  set(TENSORACLE_TENSORRT_LIBRARY "${_tensoracle_tensorrt_root}/lib/libnvinfer.so.11")
35
36
  message(STATUS "TensorRT SDK from Conan: ${TENSORACLE_TENSORRT_INCLUDE}; ${TENSORACLE_TENSORRT_LIBRARY}")
36
37
 
37
- add_library(tensoracle SHARED src/abi.cpp src/error.cpp src/bundle.cpp src/producer.cpp src/comparison.cpp)
38
+ add_library(tensoracle src/abi.cpp src/error.cpp src/bundle.cpp src/producer.cpp src/comparison.cpp)
38
39
  target_sources(tensoracle PRIVATE src/engine.cpp src/cache.cpp src/plugins.cpp src/cache_open.cpp)
39
40
  target_sources(tensoracle PRIVATE src/cache_management.cpp src/cache_management_internal.cpp)
40
41
  target_sources(tensoracle PRIVATE src/builder.cpp src/safetensors.cpp)
@@ -44,18 +45,33 @@ if(NOT WIN32)
44
45
  endif()
45
46
  add_library(tensoracle::tensoracle ALIAS tensoracle)
46
47
  target_compile_features(tensoracle PUBLIC cxx_std_17)
47
- target_compile_definitions(tensoracle PRIVATE TENSORACLE_BUILDING_LIBRARY)
48
+ if(BUILD_SHARED_LIBS)
49
+ target_compile_definitions(tensoracle PRIVATE TENSORACLE_BUILDING_LIBRARY)
50
+ else()
51
+ target_compile_definitions(tensoracle PUBLIC TENSORACLE_STATIC_LIBRARY)
52
+ set_target_properties(tensoracle PROPERTIES POSITION_INDEPENDENT_CODE ON)
53
+ endif()
48
54
  target_include_directories(tensoracle PUBLIC
49
55
  "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
50
56
  PRIVATE "${TENSORACLE_TENSORRT_INCLUDE}" "${TENSORACLE_CUDA_INCLUDE}")
51
- target_link_libraries(tensoracle PRIVATE "${TENSORACLE_TENSORRT_LIBRARY}" tensoracle_json tensoracle_miniz ${CMAKE_DL_LIBS})
57
+ if(BUILD_SHARED_LIBS)
58
+ target_link_libraries(tensoracle PRIVATE "${TENSORACLE_TENSORRT_LIBRARY}" tensoracle_json tensoracle_miniz ${CMAKE_DL_LIBS})
59
+ else()
60
+ # Keep third-party objects out of the archive and resolve their targets in
61
+ # the consumer's toolchain, without exporting this build's Conan paths.
62
+ target_link_libraries(tensoracle PRIVATE
63
+ "$<BUILD_INTERFACE:${TENSORACLE_TENSORRT_LIBRARY}>"
64
+ "$<BUILD_INTERFACE:tensoracle_json>" miniz::miniz
65
+ "$<BUILD_INTERFACE:tensoracle_internal_cuda_driver>"
66
+ "$<INSTALL_INTERFACE:tensoracle_cuda_driver>" ${CMAKE_DL_LIBS})
67
+ endif()
52
68
  set(TENSORACLE_INSTALL_RPATH "$ORIGIN" CACHE STRING "Relative runtime lookup paths for the installed library")
53
69
  set_target_properties(tensoracle PROPERTIES
54
70
  VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR}
55
71
  CXX_VISIBILITY_PRESET hidden VISIBILITY_INLINES_HIDDEN YES
56
72
  BUILD_RPATH_USE_ORIGIN YES
57
73
  INSTALL_RPATH "${TENSORACLE_INSTALL_RPATH}")
58
- if(UNIX AND NOT APPLE)
74
+ if(BUILD_SHARED_LIBS AND UNIX AND NOT APPLE)
59
75
  target_link_options(tensoracle PRIVATE "LINKER:--version-script=${CMAKE_CURRENT_SOURCE_DIR}/src/tensoracle.map")
60
76
  set_property(TARGET tensoracle APPEND PROPERTY LINK_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/src/tensoracle.map")
61
77
  endif()
@@ -91,7 +107,14 @@ install(TARGETS tensoracle EXPORT tensoracleTargets
91
107
  RUNTIME DESTINATION "${_tensoracle_root}${CMAKE_INSTALL_BINDIR}"
92
108
  ARCHIVE DESTINATION "${TENSORACLE_LIBRARY_DIR}")
93
109
  install(DIRECTORY include/ DESTINATION "${TENSORACLE_INCLUDE_DIR}")
94
- include("${CMAKE_BINARY_DIR}/conan/tensoracle_licenses.cmake")
110
+ # Resolve notices from the same packages as the headers, including when the
111
+ # caller supplies CMakeDeps instead of running this project's bootstrap.
112
+ find_file(TENSORACLE_NLOHMANN_JSON_LICENSE LICENSE.MIT
113
+ PATHS ${nlohmann_json_INCLUDE_DIRS} PATH_SUFFIXES ../licenses
114
+ NO_DEFAULT_PATH REQUIRED NO_CACHE)
115
+ find_file(TENSORACLE_MINIZ_LICENSE LICENSE
116
+ PATHS ${miniz_INCLUDE_DIRS} PATH_SUFFIXES ../licenses
117
+ NO_DEFAULT_PATH REQUIRED NO_CACHE)
95
118
  install(FILES "${TENSORACLE_NLOHMANN_JSON_LICENSE}"
96
119
  DESTINATION "${_tensoracle_root}licenses/nlohmann-json")
97
120
  install(FILES "${TENSORACLE_MINIZ_LICENSE}"
@@ -99,6 +122,16 @@ install(FILES "${TENSORACLE_MINIZ_LICENSE}"
99
122
  install(FILES src/cubin_plugin.cpp src/sha256.hpp DESTINATION "${_tensoracle_root}src")
100
123
  install(FILES cmake/TensoracleCuda.cmake cmake/TensoracleCubinPlugin.cmake
101
124
  DESTINATION "${TENSORACLE_HELPER_DIR}")
125
+ set(TENSORACLE_STATIC_DEPENDENCIES "")
126
+ if(NOT BUILD_SHARED_LIBS)
127
+ set(TENSORACLE_STATIC_DEPENDENCIES [=[ include(CMakeFindDependencyMacro)
128
+ find_dependency(miniz 3.1.1 EXACT CONFIG)
129
+ if(NOT WIN32)
130
+ find_dependency(Threads)
131
+ endif()
132
+ _tensoracle_find_cuda()
133
+ ]=])
134
+ endif()
102
135
  configure_package_config_file(cmake/tensoracleConfig.cmake.in
103
136
  "${CMAKE_CURRENT_BINARY_DIR}/tensoracleConfig.cmake"
104
137
  INSTALL_DESTINATION "${TENSORACLE_PACKAGE_DIR}" PATH_VARS TENSORACLE_HELPER_DIR)
@@ -6,6 +6,38 @@ GitHub Release: verify the archive's SHA256, extract it, and configure CMake wit
6
6
  recipe is maintained separately and is not included in this repository.
7
7
  The following commands build tensoracle from source.
8
8
 
9
+ The default is a shared library (`BUILD_SHARED_LIBS=ON`). To embed tensoracle
10
+ statically, build from source with `-DBUILD_SHARED_LIBS=OFF` and install the result:
11
+
12
+ ```bash
13
+ cmake -S cpp -B build/static -G Ninja -DBUILD_SHARED_LIBS=OFF -DBUILD_TESTING=OFF
14
+ cmake --build build/static --parallel 8
15
+ cmake --install build/static --prefix /path/to/prefix
16
+ ```
17
+
18
+ Both forms provide the same headers and CMake target, `tensoracle::tensoracle`.
19
+ The static archive contains only tensoracle's objects. Its installed CMake
20
+ package resolves miniz, the CUDA driver link stub, TensorRT, and the platform
21
+ thread and dynamic-loader libraries in the consumer's build environment. Use
22
+ the prepared Conan toolchain for those dependencies, as described in the
23
+ [SDK guide](../docs/cpp-sdk.md#embed-tensoracle-from-source). The static target
24
+ supplies `TENSORACLE_STATIC_LIBRARY` so public declarations do not import or
25
+ export a DLL. The standalone `tensoracle_cubin` archive and source-based cubin
26
+ plugin helpers remain available in source builds.
27
+
28
+ Release SDK archives and Python wheels contain the shared library only; static
29
+ libraries are not distributed. A source-building Conan recipe selects static
30
+ embedding with `from_source=True` and `shared=False`. TensorRT stays a shared
31
+ library supplied by the execution host. The current library uses the CUDA
32
+ Driver API and does not require the CUDA runtime.
33
+
34
+ A process must contain one tensoracle implementation shared by all its code.
35
+ If an application or library embeds tensoracle, that artifact must be the only
36
+ owner in the process: do not load another artifact embedding tensoracle or a
37
+ tensoracle shared library there. Python processes use the wheel's shared
38
+ library. Relink an artifact that embeds tensoracle whenever its embedded
39
+ tensoracle version is updated.
40
+
9
41
  C++ builds require CMake 3.26 or later, Ninja, GCC 13 on Linux x86_64, the pinned
10
42
  Conan dependencies. CUDA headers and the driver link stub come from the locked
11
43
  `cuda-toolkit/13.2.2` recipe (`compiler=False`), as described in the
@@ -76,6 +108,7 @@ consumers can use the prebuilt SDK archive without Conan or its targets.
76
108
  nanobind stays in Python's build requirements. C++ build inputs come from Conan;
77
109
  the CUDA compiler and tools used at runtime by the cubin producer stay in PyPI
78
110
  wheels. The release profile uses the CUDA toolkit in the manylinux image through
79
- the same recipe's `system` mode; development uses verified NVIDIA redist archives. Installed Python wheels resolve
80
- TensorRT through their existing runtime wheel dependency. Native applications
111
+ the same recipe's `system` mode; development uses verified NVIDIA redist archives. Installed Python wheels without the
112
+ `tensorrt` extra use the host's TensorRT runtime (installed with apt on Linux);
113
+ `tensoracle[tensorrt]` selects the optional TensorRT wheel. Native applications
81
114
  install TensorRT and its builder resources on their execution host.
@@ -1,7 +1,7 @@
1
1
  @PACKAGE_INIT@
2
2
  include("@PACKAGE_TENSORACLE_HELPER_DIR@/TensoracleCubinPlugin.cmake")
3
3
  if(NOT TARGET tensoracle::tensoracle)
4
- if(NOT TARGET TensorRT::nvinfer)
4
+ @TENSORACLE_STATIC_DEPENDENCIES@ if(NOT TARGET TensorRT::nvinfer)
5
5
  find_package(TensorRT QUIET CONFIG)
6
6
  endif()
7
7
  if(TARGET TensorRT::nvinfer)
@@ -31,7 +31,7 @@ if(NOT TARGET tensoracle::tensoracle)
31
31
  get_filename_component(_tensoracle_nvinfer_dirs "${TENSORACLE_TENSORRT_LIBRARY}" DIRECTORY)
32
32
  endif()
33
33
  include("${CMAKE_CURRENT_LIST_DIR}/tensoracleTargets.cmake")
34
- if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
34
+ if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND @BUILD_SHARED_LIBS@)
35
35
  # Resolve libtensoracle's DT_NEEDED at link time without adding a direct
36
36
  # TensorRT dependency to consumers that already rely on its RUNPATH.
37
37
  set_property(TARGET tensoracle::tensoracle APPEND PROPERTY
@@ -1,5 +1,9 @@
1
1
  # Every build entry point includes this before its first project().
2
2
  include_guard(GLOBAL)
3
+ if(CMAKE_TOOLCHAIN_FILE AND NOT CMAKE_TOOLCHAIN_FILE STREQUAL "${CMAKE_BINARY_DIR}/conan/conan_toolchain.cmake")
4
+ # The caller already resolved the dependency graph, for example in conan create.
5
+ return()
6
+ endif()
3
7
  if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
4
8
  set(CMAKE_BUILD_TYPE Release CACHE STRING "Build configuration" FORCE)
5
9
  endif()
@@ -1,11 +1,9 @@
1
1
  """Resolve the same native dependencies for standalone, test, and wheel builds."""
2
2
 
3
- import os
4
3
  from typing import ClassVar
5
4
 
6
5
  from conan import ConanFile
7
6
  from conan.tools.cmake import CMakeDeps, CMakeToolchain
8
- from conan.tools.files import save
9
7
 
10
8
 
11
9
  class TensoracleDependencies(ConanFile):
@@ -30,12 +28,3 @@ class TensoracleDependencies(ConanFile):
30
28
  "cuda-toolkit"
31
29
  ].conf_info.get("user.cuda:root")
32
30
  toolchain.generate()
33
- licenses = []
34
- for name, filename in (("nlohmann_json", "LICENSE.MIT"), ("miniz", "LICENSE")):
35
- path = os.path.join(
36
- self.dependencies[name].package_folder, "licenses", filename
37
- )
38
- licenses.append(
39
- f'set(TENSORACLE_{name.upper()}_LICENSE "{path.replace(chr(92), "/")}")'
40
- )
41
- save(self, "tensoracle_licenses.cmake", "\n".join(licenses) + "\n")
@@ -5,10 +5,12 @@
5
5
  #include <stdint.h>
6
6
 
7
7
  #define TENSORACLE_VERSION_MAJOR 2
8
- #define TENSORACLE_VERSION_MINOR 2
9
- #define TENSORACLE_VERSION_PATCH 3
8
+ #define TENSORACLE_VERSION_MINOR 4
9
+ #define TENSORACLE_VERSION_PATCH 0
10
10
 
11
- #if defined(_WIN32)
11
+ #if defined(TENSORACLE_STATIC_LIBRARY)
12
+ # define TENSORACLE_API
13
+ #elif defined(_WIN32)
12
14
  # if defined(TENSORACLE_BUILDING_LIBRARY)
13
15
  # define TENSORACLE_API __declspec(dllexport)
14
16
  # else
@@ -23,11 +23,16 @@ add_test(NAME "Installed SDK builds a separate C++ application"
23
23
  "-DCONSUMER_SOURCE=${CMAKE_CURRENT_SOURCE_DIR}/consumer"
24
24
  "-DCONFIG=$<CONFIG>"
25
25
  "-DCXX=${CMAKE_CXX_COMPILER}"
26
+ "-DSHARED=${BUILD_SHARED_LIBS}"
26
27
  "-DTENSORRT_LIBRARY=${TENSORACLE_TENSORRT_LIBRARY}"
27
28
  -P "${CMAKE_CURRENT_SOURCE_DIR}/installed.cmake")
28
29
  set_tests_properties("Installed SDK builds a separate C++ application" PROPERTIES
29
30
  ENVIRONMENT "${_tensoracle_test_environment}"
30
31
  LABELS "SP-TENSORACLE-014;SP-TENSORACLE-021;SP-TENSORACLE-055;SP-TENSORACLE-057;SP-TENSORACLE-065" TIMEOUT 60)
32
+ if(NOT BUILD_SHARED_LIBS)
33
+ set_tests_properties("Installed SDK builds a separate C++ application" PROPERTIES
34
+ LABELS "SP-TENSORACLE-014;SP-TENSORACLE-021;SP-TENSORACLE-055;SP-TENSORACLE-073;SP-TENSORACLE-074")
35
+ endif()
31
36
 
32
37
  add_executable(tensoracle_execution_test execution.cpp)
33
38
  target_link_options(tensoracle_execution_test PRIVATE "LINKER:--export-dynamic-symbol=utimensat")
@@ -2,14 +2,22 @@ file(REMOVE_RECURSE "${WORK_DIR}")
2
2
  set(prefix "${WORK_DIR}/prefix")
3
3
  execute_process(COMMAND "${CMAKE_COMMAND}" --install "${BUILD_DIR}" --prefix "${prefix}" --config "${CONFIG}"
4
4
  COMMAND_ERROR_IS_FATAL ANY)
5
- # Check relocation using only installed headers and the TensorRT link library.
5
+ # Shared installs need only the TensorRT link library; static installs also
6
+ # resolve their external link dependencies in the consumer's toolchain.
6
7
  file(RENAME "${prefix}" "${WORK_DIR}/relocated")
7
8
  set(prefix "${WORK_DIR}/relocated")
8
9
  file(COPY "${CONSUMER_SOURCE}/" DESTINATION "${WORK_DIR}/source")
10
+ set(_dependency_options)
11
+ if(NOT SHARED)
12
+ list(APPEND _dependency_options
13
+ "-DCMAKE_TOOLCHAIN_FILE=${BUILD_DIR}/conan/conan_toolchain.cmake"
14
+ "-DCMAKE_BUILD_TYPE=${CONFIG}")
15
+ endif()
9
16
  execute_process(COMMAND "${CMAKE_COMMAND}" -E env --unset=LD_LIBRARY_PATH --unset=LD_PRELOAD
10
17
  "${CMAKE_COMMAND}" -S "${WORK_DIR}/source" -B "${WORK_DIR}/build"
11
18
  "-DCMAKE_PREFIX_PATH=${prefix}" "-DCMAKE_CXX_COMPILER=${CXX}"
12
19
  "-DTENSORACLE_TENSORRT_LIBRARY=${TENSORRT_LIBRARY}"
20
+ ${_dependency_options}
13
21
  COMMAND_ERROR_IS_FATAL ANY)
14
22
  execute_process(COMMAND "${CMAKE_COMMAND}" -E env --unset=LD_LIBRARY_PATH --unset=LD_PRELOAD
15
23
  "${CMAKE_COMMAND}" --build "${WORK_DIR}/build" --config "${CONFIG}" --parallel 2
@@ -0,0 +1,20 @@
1
+ cmake_minimum_required(VERSION 3.26)
2
+ project(static_tensoracle_consumer LANGUAGES C CXX)
3
+ find_package(tensoracle 2 CONFIG REQUIRED)
4
+ find_package(tensoracle 2 CONFIG REQUIRED)
5
+ get_target_property(_type tensoracle::tensoracle TYPE)
6
+ if(NOT _type STREQUAL "STATIC_LIBRARY")
7
+ message(FATAL_ERROR "The source build must install a static tensoracle target")
8
+ endif()
9
+ if(NOT COMMAND tensoracle_add_cubin_plugin OR NOT COMMAND tensoracle_find_cuda)
10
+ message(FATAL_ERROR "Static installs must retain the public cubin helpers")
11
+ endif()
12
+ add_library(fixture OBJECT fixture.cpp)
13
+ target_link_libraries(fixture PRIVATE tensoracle::tensoracle TensorRT::nvinfer tensoracle_cuda_driver)
14
+ foreach(_language IN ITEMS c cpp)
15
+ add_executable(consumer_${_language} main.${_language} $<TARGET_OBJECTS:fixture>)
16
+ target_compile_features(consumer_${_language} PRIVATE c_std_11 cxx_std_17)
17
+ target_link_libraries(consumer_${_language} PRIVATE tensoracle::tensoracle)
18
+ target_compile_options(consumer_${_language} PRIVATE
19
+ $<$<C_COMPILER_ID:GNU,Clang>:-Wall;-Wextra;-Werror>)
20
+ endforeach()
@@ -0,0 +1,69 @@
1
+ #include "fixture.h"
2
+ #include <NvInfer.h>
3
+ #include <cuda.h>
4
+ #include <cmath>
5
+ #include <cstdio>
6
+
7
+ extern "C" int fixture_start(gpu_fixture* fixture) {
8
+ CUdevice device{};
9
+ CUcontext context{};
10
+ CUdeviceptr input{}, output{};
11
+ CUstream stream{};
12
+ if (cuInit(0) != CUDA_SUCCESS || cuDeviceGet(&device, 0) != CUDA_SUCCESS ||
13
+ cuDevicePrimaryCtxRetain(&context, device) != CUDA_SUCCESS) return 1;
14
+ fixture->context = context;
15
+ if (cuCtxPushCurrent(context) != CUDA_SUCCESS) return 1;
16
+ if (cuMemAlloc(&input, 4 * sizeof(float)) != CUDA_SUCCESS) return 1;
17
+ fixture->input = reinterpret_cast<void*>(input);
18
+ if (cuMemAlloc(&output, 4 * sizeof(float)) != CUDA_SUCCESS) return 1;
19
+ fixture->output = reinterpret_cast<void*>(output);
20
+ if (cuStreamCreate(&stream, CU_STREAM_NON_BLOCKING) != CUDA_SUCCESS) return 1;
21
+ fixture->stream = stream;
22
+ const float values[]{1, 2, 3, 4};
23
+ return cuMemcpyHtoD(input, values, sizeof(values)) != CUDA_SUCCESS;
24
+ }
25
+
26
+ extern "C" int fixture_check(gpu_fixture* fixture) {
27
+ const float expected[]{1.5f, 0, 6.25f, 3.25f};
28
+ float actual[4]{};
29
+ if (cuStreamSynchronize(fixture->stream) != CUDA_SUCCESS ||
30
+ cuMemcpyDtoH(actual, reinterpret_cast<CUdeviceptr>(fixture->output), sizeof(actual)) != CUDA_SUCCESS)
31
+ return 1;
32
+ for (int i = 0; i < 4; ++i) {
33
+ if (!std::isfinite(actual[i]) || std::abs(actual[i] - expected[i]) > 1e-5f) return 1;
34
+ }
35
+ std::puts("OUTPUT 1.5 0 6.25 3.25");
36
+ return 0;
37
+ }
38
+
39
+ extern "C" void fixture_destroy(gpu_fixture* fixture) {
40
+ if (fixture->stream) { cuStreamSynchronize(fixture->stream); cuStreamDestroy(fixture->stream); }
41
+ if (fixture->input) cuMemFree(reinterpret_cast<CUdeviceptr>(fixture->input));
42
+ if (fixture->output) cuMemFree(reinterpret_cast<CUdeviceptr>(fixture->output));
43
+ if (fixture->context) { CUcontext previous{}; cuCtxPopCurrent(&previous); cuDevicePrimaryCtxRelease(0); }
44
+ }
45
+
46
+ extern "C" tensoracle_status fixture_graph(void* context, void* opaque,
47
+ const tensoracle_weights* weights, const char** message) noexcept {
48
+ ++*static_cast<int*>(context);
49
+ tensoracle_weight bias{}; bias.struct_size = sizeof(bias);
50
+ if (tensoracle_weights_find(weights, "bias", &bias, nullptr) != TENSORACLE_SUCCESS ||
51
+ bias.dtype != TENSORACLE_FLOAT32 || bias.element_count != 4) {
52
+ *message = "Expected four float32 bias values"; return TENSORACLE_INVALID_ARGUMENT;
53
+ }
54
+ auto status = fixture_add(opaque, &bias);
55
+ if (status != TENSORACLE_SUCCESS) *message = "Network addition failed";
56
+ return status;
57
+ }
58
+
59
+ extern "C" tensoracle_status fixture_add(void* opaque, const tensoracle_weight* bias) noexcept {
60
+ auto& network = *static_cast<nvinfer1::INetworkDefinition*>(opaque);
61
+ nvinfer1::Dims shape{}; shape.nbDims = 1; shape.d[0] = 4;
62
+ auto* input = network.addInput("input", nvinfer1::DataType::kFLOAT, shape);
63
+ auto* constant = network.addConstant(shape, {nvinfer1::DataType::kFLOAT, bias->data, 4});
64
+ if (!input || !constant) return TENSORACLE_INTERNAL_ERROR;
65
+ auto* sum = network.addElementWise(*input, *constant->getOutput(0), nvinfer1::ElementWiseOperation::kSUM);
66
+ if (!sum) return TENSORACLE_INTERNAL_ERROR;
67
+ sum->getOutput(0)->setName("output"); network.markOutput(*sum->getOutput(0));
68
+ return TENSORACLE_SUCCESS;
69
+ }
@@ -0,0 +1,24 @@
1
+ #ifndef STATIC_CONSUMER_FIXTURE_H
2
+ #define STATIC_CONSUMER_FIXTURE_H
3
+ #include <tensoracle/builder.h>
4
+ #ifndef TENSORACLE_STATIC_LIBRARY
5
+ #error "The installed static target must supply its public export definition"
6
+ #endif
7
+ #ifdef __cplusplus
8
+ extern "C" {
9
+ #endif
10
+ typedef struct gpu_fixture {
11
+ void* context;
12
+ void* input;
13
+ void* output;
14
+ tensoracle_cuda_stream stream;
15
+ } gpu_fixture;
16
+ int fixture_start(gpu_fixture*);
17
+ int fixture_check(gpu_fixture*);
18
+ void fixture_destroy(gpu_fixture*);
19
+ tensoracle_status fixture_add(void*, const tensoracle_weight*) TENSORACLE_NOEXCEPT;
20
+ tensoracle_status fixture_graph(void*, void*, const tensoracle_weights*, const char**) TENSORACLE_NOEXCEPT;
21
+ #ifdef __cplusplus
22
+ }
23
+ #endif
24
+ #endif
@@ -0,0 +1,52 @@
1
+ /* SP-TENSORACLE-054, SP-TENSORACLE-073, SP-TENSORACLE-074:
2
+ * C callers build and run an engine with the installed static target. */
3
+ #include "fixture.h"
4
+ #include <stdio.h>
5
+ #include <stdlib.h>
6
+
7
+ int main(int argc, char** argv) {
8
+ tensoracle_version version = {sizeof(version), 0, 0, 0};
9
+ if (tensoracle_get_version(&version, NULL) != TENSORACLE_SUCCESS ||
10
+ version.major != TENSORACLE_VERSION_MAJOR) return 1;
11
+ if (argc == 1) return 0;
12
+ if (argc != 3) return 2;
13
+ gpu_fixture gpu = {0};
14
+ if (fixture_start(&gpu)) { fixture_destroy(&gpu); return 3; }
15
+ const int64_t shape[] = {4};
16
+ tensoracle_input_profile profile = {sizeof(profile), "input", 1, shape, shape, shape};
17
+ const tensoracle_input_profile* profiles[] = {&profile};
18
+ tensoracle_tensor_spec input = {0}, output = {0};
19
+ input.struct_size = sizeof(input); input.name = "input";
20
+ input.dtype = TENSORACLE_FLOAT32; input.rank = 1; input.dimensions = shape; input.input = 1;
21
+ output = input; output.name = "output"; output.input = 0;
22
+ const tensoracle_tensor_spec* io[] = {&input, &output};
23
+ const char* files[] = {argv[1]};
24
+ tensoracle_builder_options options = {0};
25
+ options.struct_size = sizeof(options); options.name = "static-c"; options.graph_version = "1";
26
+ options.weight_files = files; options.weight_count = 1;
27
+ options.inputs = profiles; options.input_count = 1; options.io = io; options.io_count = 2;
28
+ options.has_workspace_limit = 1; options.workspace_limit = 64 * 1024 * 1024;
29
+ int calls = 0, result = 4;
30
+ tensoracle_network_builder builder = {sizeof(builder), &calls, fixture_graph};
31
+ tensoracle_engine* engine = NULL;
32
+ tensoracle_execution* execution = NULL;
33
+ tensoracle_error* error = NULL;
34
+ if (tensoracle_open_engine(&options, &builder, &engine, &error) != TENSORACLE_SUCCESS) goto cleanup;
35
+ if (calls != atoi(argv[2])) goto cleanup;
36
+ if (tensoracle_execution_create(engine, &execution, &error) != TENSORACLE_SUCCESS) goto cleanup;
37
+ tensoracle_tensor_address source = {sizeof(source), "input", gpu.input};
38
+ tensoracle_tensor_address target = {sizeof(target), "output", gpu.output};
39
+ const tensoracle_tensor_address* addresses[] = {&source, &target};
40
+ if (tensoracle_execution_enqueue(execution, addresses, 2, gpu.stream, &error) != TENSORACLE_SUCCESS) goto cleanup;
41
+ result = fixture_check(&gpu);
42
+ cleanup:
43
+ if (error) {
44
+ const char* message = NULL;
45
+ if (tensoracle_error_message(error, &message, NULL) == TENSORACLE_SUCCESS)
46
+ fprintf(stderr, "%s\n", message);
47
+ }
48
+ tensoracle_error_destroy(error);
49
+ tensoracle_execution_destroy(execution); tensoracle_engine_destroy(engine);
50
+ fixture_destroy(&gpu);
51
+ return result;
52
+ }
@@ -0,0 +1,39 @@
1
+ // SP-TENSORACLE-054, SP-TENSORACLE-073, SP-TENSORACLE-074:
2
+ // The same installed static target supports the public C++ wrappers.
3
+ #include "fixture.h"
4
+ #include <tensoracle/builder.hpp>
5
+ #include <cstdio>
6
+ #include <cstdlib>
7
+
8
+ int main(int argc, char** argv) {
9
+ gpu_fixture gpu{};
10
+ try {
11
+ tensoracle::check_version();
12
+ if (argc == 1) return 0;
13
+ if (argc != 3 || fixture_start(&gpu)) { fixture_destroy(&gpu); return 2; }
14
+ int result = 1;
15
+ {
16
+ tensoracle::builder_options options;
17
+ options.name = "static-cpp"; options.graph_version = "1"; options.weights = {argv[1]};
18
+ options.inputs = {{"input", {4}, {4}, {4}}};
19
+ options.io = {{"input", TENSORACLE_FLOAT32, {4}, true}, {"output", TENSORACLE_FLOAT32, {4}, false}};
20
+ options.workspace_limit = 64 * 1024 * 1024; options.optimization_level = 0;
21
+ int calls = 0;
22
+ auto engine = tensoracle::open_engine(options,
23
+ [&](nvinfer1::INetworkDefinition& network, const tensoracle::weights_view& weights) {
24
+ ++calls;
25
+ auto bias = weights.at("bias");
26
+ if (fixture_add(&network, &bias) != TENSORACLE_SUCCESS)
27
+ throw std::runtime_error("Network addition failed");
28
+ });
29
+ if (calls != std::atoi(argv[2])) throw std::runtime_error("Unexpected builder callback count");
30
+ auto execution = engine.create_execution();
31
+ execution.enqueue({{"input", gpu.input}, {"output", gpu.output}}, gpu.stream);
32
+ result = fixture_check(&gpu);
33
+ }
34
+ fixture_destroy(&gpu);
35
+ return result;
36
+ } catch (const std::exception& error) {
37
+ std::fprintf(stderr, "%s\n", error.what()); fixture_destroy(&gpu); return 1;
38
+ }
39
+ }
@@ -6,6 +6,9 @@ The archive contains the shared C ABI library, public C and C++ headers, the CMa
6
6
  package and plugin helpers, their source files, and MIT and third-party licenses.
7
7
  It does not contain TensorRT. The release asset requires no authentication.
8
8
  Python applications continue to install tensoracle through PyPI.
9
+ Release SDK archives and Python wheels contain the shared library only. To
10
+ embed tensoracle statically, build it from source; static libraries are not
11
+ distributed.
9
12
  The tensoracle Conan package recipe is maintained separately and is not included
10
13
  in this repository.
11
14
 
@@ -58,6 +61,53 @@ Pass its `user.cuda:root` through `CUDAToolkit_ROOT` in the consumer toolchain,
58
61
  as shown in the SDK guide. Existing explicit CUDA SDK roots remain supported;
59
62
  the link stub is not part of the application runtime.
60
63
 
64
+ ## Embed tensoracle from source
65
+
66
+ Source builds select a shared library by default (`BUILD_SHARED_LIBS=ON`). After
67
+ [preparing the build dependencies](https://github.com/sync-dev-org/tensoracle/blob/main/cpp/README.md), select a static library
68
+ with `BUILD_SHARED_LIBS=OFF`:
69
+
70
+ ```bash
71
+ cmake -S cpp -B build/static -G Ninja -DBUILD_SHARED_LIBS=OFF -DBUILD_TESTING=OFF
72
+ cmake --build build/static --parallel 8
73
+ cmake --install build/static --prefix /path/to/prefix
74
+ ```
75
+
76
+ The installed package keeps the same public headers and
77
+ `tensoracle::tensoracle` target. The archive contains only tensoracle's objects;
78
+ miniz and the CUDA driver remain separate link dependencies. The CMake package
79
+ finds these dependencies, TensorRT's shared library, and the platform thread
80
+ and dynamic-loader libraries for the final link. The current library uses the
81
+ CUDA Driver API and does not use the CUDA runtime. If a future version uses
82
+ the CUDA runtime, its static parts must also be supplied to the final link.
83
+ TensorRT remains a host-supplied shared runtime.
84
+
85
+ Configure a consumer with the prepared Conan toolchain so it can resolve the
86
+ same miniz and CUDA build inputs. For example, from the tensoracle source root:
87
+
88
+ ```bash
89
+ cmake -S /path/to/application -B build/application \
90
+ -DCMAKE_BUILD_TYPE=Release \
91
+ -DCMAKE_TOOLCHAIN_FILE="$PWD/build/static/conan/conan_toolchain.cmake" \
92
+ -DCMAKE_PREFIX_PATH=/path/to/prefix
93
+ cmake --build build/application --parallel 8
94
+ ```
95
+
96
+ The consumer uses the same `find_package(tensoracle)` and
97
+ `target_link_libraries(... tensoracle::tensoracle)` calls shown above. The
98
+ static target supplies `TENSORACLE_STATIC_LIBRARY`, which disables DLL import
99
+ and export attributes in the public headers. Source-based cubin plugin helpers
100
+ remain available after `find_package(tensoracle)`. A source-building Conan
101
+ recipe selects this form with `from_source=True` and `shared=False`; the
102
+ prebuilt SDK route supports shared libraries only.
103
+
104
+ A process must contain exactly one tensoracle implementation, used by all its
105
+ code. An artifact that embeds tensoracle must be its only owner in that
106
+ process. Do not load another artifact embedding tensoracle or a tensoracle
107
+ shared library into the same process. Python processes use the wheel's shared
108
+ library. Relink an artifact that embeds tensoracle when updating the embedded
109
+ tensoracle version.
110
+
61
111
  ## Install the host runtime and relocate a prefix
62
112
 
63
113
  The execution host needs TensorRT 11.2 or later, below 12, compatible with its
@@ -94,8 +144,9 @@ TensorRT-specific search path. The host loader finds `libnvinfer.so.11` through
94
144
  its normal configuration. If TensorRT is installed outside the system loader's
95
145
  configured locations, configure that loader or set `LD_LIBRARY_PATH` to the
96
146
  runtime directory. Do not copy TensorRT or driver libraries into tensoracle's
97
- SDK or the application prefix. The Python wheel retains its existing SDK and
98
- its relative lookup of the separate TensorRT wheel.
147
+ SDK or the application prefix. The Python wheel uses the host runtime too;
148
+ it also checks the sibling TensorRT wheel when the optional
149
+ `tensoracle[tensorrt]` extra is installed. See [runtime installation](tensorrt-sdk.md#install-the-runtime).
99
150
 
100
151
  ## Package an application that embeds tensoracle
101
152
 
@@ -23,7 +23,19 @@ If your model package uses tensoracle 1.x, start with [Migrate from 1.x](migrati
23
23
 
24
24
  v2 supplies a Linux x86_64 `manylinux_2_28` wheel, including WSL2, with the `cp312-abi3` tag. The package currently declares Python 3.12 and 3.13 support. TensorRT 11.2 or later (below 12) and GPU generations sm86, sm89, and sm120 are the targets; fp8 requires sm89 or sm120. Windows x86_64 users must use tensoracle 1.x until a later v2 minor release supplies a Windows wheel. A Linux wheel runs under WSL2, not directly in Windows Python.
25
25
 
26
- The wheel includes the shared C++ library, public headers, CMake package configuration, and source-based cubin plugin helpers. It resolves TensorRT through its wheel dependency rather than bundling TensorRT or the NVIDIA driver. The C ABI uses opaque handles and structures with `struct_size`; the C++ headers add exceptions and automatic resource release. Public C++ interfaces and saved engine files remain compatible within the same major version.
26
+ The wheel includes the shared C++ library, public headers, CMake package configuration, and source-based cubin plugin helpers. TensorRT and the NVIDIA driver are not bundled. The C ABI uses opaque handles and structures with `struct_size`; the C++ headers add exceptions and automatic resource release. Public C++ interfaces and saved engine files remain compatible within the same major version.
27
+
28
+ ## Install
29
+
30
+ Configure NVIDIA's CUDA apt repository for your Linux or WSL2 distribution as described in the [runtime installation guide](tensorrt-sdk.md#install-the-runtime), then install:
31
+
32
+ ```bash
33
+ sudo apt-get update
34
+ sudo apt-get install libnvinfer11
35
+ pip install tensoracle
36
+ ```
37
+
38
+ The host runtime must be TensorRT 11.2 or later, below 12, with builder resources; the wheel is built against SDK 11.2.1.2. A compatible NVIDIA driver is required, but neither the CUDA Toolkit nor TensorRT's Python bindings are needed for execution. TensorRT's pip wheel is optional: use `pip install 'tensoracle[tensorrt]'` to select it. Without that extra, tensoracle uses the host loader's normal TensorRT search. Model packages that use apt's runtime declare `tensoracle` without the extra.
27
39
 
28
40
  ### Connect a C++ model package
29
41