Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/christian-rauch/torch_cpp
CMake wrapper for installing LibTorch (PyTorch C++ API)
https://github.com/christian-rauch/torch_cpp
cmake pytorch
Last synced: 4 days ago
JSON representation
CMake wrapper for installing LibTorch (PyTorch C++ API)
- Host: GitHub
- URL: https://github.com/christian-rauch/torch_cpp
- Owner: christian-rauch
- Created: 2020-07-06T12:34:02.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-12-28T01:45:56.000Z (11 months ago)
- Last Synced: 2024-04-20T00:53:19.144Z (7 months ago)
- Topics: cmake, pytorch
- Language: CMake
- Homepage: https://pytorch.org/cppdocs/
- Size: 7.81 KB
- Stars: 5
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# LibTorch install script for CMake
This CMake project is basically an install script for LibTorch (PyTorch C++ API). It downloads the binary archieve and installs headers, libraries and CMake configurations files to the corresponding `INCLUDEDIR`, `LIBDIR` and `DATADIR` directories.
The package can be used as part of a pure CMake catkin or colcon workspace by including:
```XML
cmake
torch_cpp
cmake
```
in your `package.xml`. The relevant files will then be installed within the workspace target folder (`install` or `devel`).Usage in a CMake project:
```CMake
find_package(Torch REQUIRED)
target_link_libraries(${PROJECT_NAME} PUBLIC torch)
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 14)
target_link_options(${PROJECT_NAME} PUBLIC ${TORCH_CXX_FLAGS})
```If you get the error `No CMAKE_CUDA_COMPILER could be found.`, then the CUDA compiler `nvcc` cannot be found in the default search paths (`$PATH`). In this case, you have to set the path to `nvcc` manually:
```sh
export CUDACXX=/usr/local/cuda/bin/nvcc
```