Skip to content

Commit

Permalink
remove more cudnn dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
zewenli98 committed May 1, 2024
1 parent f8b91ed commit 3fff8df
Show file tree
Hide file tree
Showing 11 changed files with 10 additions and 279 deletions.
243 changes: 0 additions & 243 deletions cmake/Modules/FindcuDNN.cmake

This file was deleted.

2 changes: 0 additions & 2 deletions cmake/dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@ endif()

# If the custom finders are needed at this point, there are good chances that they will be needed when consuming the library as well
install(FILES "${CMAKE_SOURCE_DIR}/cmake/Modules/FindTensorRT.cmake" DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/torchtrt/Modules")
install(FILES "${CMAKE_SOURCE_DIR}/cmake/Modules/FindcuDNN.cmake" DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/torchtrt/Modules")

# CUDA
find_package(CUDAToolkit REQUIRED)
find_package(cuDNN REQUIRED) # Headers are needed somewhere

# libtorch
find_package(Torch REQUIRED)
Expand Down
1 change: 0 additions & 1 deletion core/plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ target_link_libraries(${lib_name}
TensorRT::nvinfer_plugin
torch
core_util
cuDNN::cuDNN
PRIVATE
Threads::Threads
)
Expand Down
5 changes: 2 additions & 3 deletions examples/int8/ptq/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,14 +149,13 @@ tar -xvzf libtorch_tensorrt.tar.gz
unzip libtorch.zip
```

> If cuDNN and TensorRT are not installed on your system / in your LD_LIBRARY_PATH then do the following as well
> If TensorRT is not installed on your system / in your LD_LIBRARY_PATH then do the following as well
```sh
cd deps
mkdir cudnn && tar -xvzf <cuDNN TARBALL> --directory cudnn --strip-components=1
mkdir tensorrt && tar -xvzf <TensorRT TARBALL> --directory tensorrt --strip-components=1
cd ..
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(pwd)/deps/torch_tensorrt/lib:$(pwd)/deps/libtorch/lib:$(pwd)/deps/tensorrt/lib:$(pwd)/deps/cudnn/lib64:/usr/local/cuda/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(pwd)/deps/torch_tensorrt/lib:$(pwd)/deps/libtorch/lib:$(pwd)/deps/tensorrt/lib:/usr/local/cuda/lib
```

2) Build and run `ptq`
Expand Down
5 changes: 2 additions & 3 deletions examples/int8/qat/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,13 @@ tar -xvzf libtorch_tensorrt.tar.gz
unzip libtorch.zip
```

> If cuDNN and TensorRT are not installed on your system / in your LD_LIBRARY_PATH then do the following as well
> If TensorRT is not installed on your system / in your LD_LIBRARY_PATH then do the following as well
```sh
cd deps
mkdir cudnn && tar -xvzf <cuDNN TARBALL> --directory cudnn --strip-components=1
mkdir tensorrt && tar -xvzf <TensorRT TARBALL> --directory tensorrt --strip-components=1
cd ..
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(pwd)/deps/torch_tensorrt/lib:$(pwd)/deps/libtorch/lib:$(pwd)/deps/tensorrt/lib:$(pwd)/deps/cudnn/lib64:/usr/local/cuda/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(pwd)/deps/torch_tensorrt/lib:$(pwd)/deps/libtorch/lib:$(pwd)/deps/tensorrt/lib:/usr/local/cuda/lib
```

2) Build and run `qat`
Expand Down
2 changes: 1 addition & 1 deletion examples/torchtrt_runtime_example/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
CXX=g++
DEP_DIR=$(PWD)/deps
INCLUDE_DIRS=-I$(DEP_DIR)/libtorch/include -I$(DEP_DIR)/torch_tensorrt/include
LIB_DIRS=-L$(DEP_DIR)/torch_tensorrt/lib -L$(DEP_DIR)/libtorch/lib # -Wl,-rpath $(DEP_DIR)/tensorrt/lib -Wl,-rpath $(DEP_DIR)/cudnn/lib64
LIB_DIRS=-L$(DEP_DIR)/torch_tensorrt/lib -L$(DEP_DIR)/libtorch/lib # -Wl,-rpath $(DEP_DIR)/tensorrt/lib
LIBS=-Wl,--no-as-needed -ltorchtrt_runtime -Wl,--as-needed -ltorch -ltorch_cuda -ltorch_cpu -ltorch_global_deps -lbackend_with_compiler -lc10 -lc10_cuda
SRCS=main.cpp

Expand Down
9 changes: 4 additions & 5 deletions examples/torchtrt_runtime_example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,16 @@ tar -xvzf libtorch_tensorrt.tar.gz
unzip libtorch-cxx11-abi-shared-with-deps-[PYTORCH_VERSION].zip
```

> If cuDNN and TensorRT are not installed on your system / in your LD_LIBRARY_PATH then do the following as well
> If TensorRT is not installed on your system / in your LD_LIBRARY_PATH then do the following as well
```sh
cd deps
mkdir cudnn && tar -xvzf <cuDNN TARBALL> --directory cudnn --strip-components=1
mkdir tensorrt && tar -xvzf <TensorRT TARBALL> --directory tensorrt --strip-components=1
cd ..
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(pwd)/deps/torch_tensorrt/lib:$(pwd)/deps/libtorch/lib:$(pwd)/deps/tensorrt/lib:$(pwd)/deps/cudnn/lib64:/usr/local/cuda/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(pwd)/deps/torch_tensorrt/lib:$(pwd)/deps/libtorch/lib:$(pwd)/deps/tensorrt/lib:/usr/local/cuda/lib
```

This gives maximum compatibility with system configurations for running this example but in general you are better off adding `-Wl,-rpath $(DEP_DIR)/tensorrt/lib -Wl,-rpath $(DEP_DIR)/cudnn/lib64` to your linking command for actual applications
This gives maximum compatibility with system configurations for running this example but in general you are better off adding `-Wl,-rpath $(DEP_DIR)/tensorrt/lib` to your linking command for actual applications

2) Build and run `torchtrt_runtime_example`

Expand All @@ -48,6 +47,6 @@ To build and run the app
cd examples/torchtrt_runtime_example
make
# If paths are different than the ones below, change as necessary
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(pwd)/deps/torch_tensorrt/lib:$(pwd)/deps/libtorch/lib:$(pwd)/deps/tensorrt/lib:$(pwd)/deps/cudnn/lib64:/usr/local/cuda/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(pwd)/deps/torch_tensorrt/lib:$(pwd)/deps/libtorch/lib:$(pwd)/deps/tensorrt/lib:/usr/local/cuda/lib
./torchtrt_runtime_example $PWD/examples/torchtrt_runtime_example/norm.jit
```
13 changes: 0 additions & 13 deletions notebooks/Resnet50-CPP.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -172,19 +172,6 @@
"unzip libtorch-cxx11-abi-shared-with-deps-1.11.0+cu113.zip"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "198553b7",
"metadata": {},
"outputs": [],
"source": [
"%%bash\n",
"cd deps\n",
"wget https://github.com/pytorch/TensorRT/releases/download/v1.1.0/libtorchtrt-v1.1.0-cudnn8.2-tensorrt8.2-cuda11.3-libtorch1.11.0.tar.gz\n",
"tar -xvzf libtorchtrt-v1.1.0-cudnn8.2-tensorrt8.2-cuda11.3-libtorch1.11.0.tar.gz"
]
},
{
"cell_type": "markdown",
"id": "309696b6",
Expand Down
2 changes: 1 addition & 1 deletion py/ci/build_whl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ libtorchtrt() {
TORCHTRT_VERSION=$(cd ${PROJECT_DIR} && ${PY_DIR}/bin/python3 -c "import versions; versions.torch_tensorrt_version_release()")
TRT_VERSION=$(cd ${PROJECT_DIR} && ${PY_DIR}/bin/python3 -c "import versions; versions.tensorrt_version()")
TORCH_VERSION=$(${PY_DIR}/bin/python -c "from torch import __version__;print(__version__.split('+')[0])")
cp ${PROJECT_DIR}/bazel-bin/libtorchtrt.tar.gz ${PROJECT_DIR}/py/wheelhouse/libtorchtrt-${TORCHTRT_VERSION}-cudnn${CUDNN_VERSION}-tensorrt${TRT_VERSION}-cuda${CUDA_VERSION}-libtorch${TORCH_VERSION}-x86_64-linux.tar.gz
cp ${PROJECT_DIR}/bazel-bin/libtorchtrt.tar.gz ${PROJECT_DIR}/py/wheelhouse/libtorchtrt-${TORCHTRT_VERSION}-tensorrt${TRT_VERSION}-cuda${CUDA_VERSION}-libtorch${TORCH_VERSION}-x86_64-linux.tar.gz
}

libtorchtrt_pre_cxx11_abi() {
Expand Down
1 change: 0 additions & 1 deletion py/ci/soname_excludes.params
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
--exclude libcuda.so.515
--exclude libcublasLt.so.11
--exclude libnvinfer.so.8
--exclude libcudnn.so.8
--exclude libcublas.so.12
--exclude libcublasLt.so.12
--exclude libcublas.so.12.1.3.1
Expand Down
6 changes: 0 additions & 6 deletions toolchains/ci_workspaces/WORKSPACE.win.release.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,6 @@ http_archive(
# Locally installed dependencies (use in cases of custom dependencies or aarch64)
####################################################################################

new_local_repository(
name = "cudnn",
path = "C:/",
build_file = "@//third_party/cudnn/local:BUILD"
)

new_local_repository(
name = "tensorrt",
path = "C:/",
Expand Down

0 comments on commit 3fff8df

Please sign in to comment.