STT-tensorflow/third_party/gpus/cuda/platform.bzl.tpl
gunan 58b37cf745 Add cuda_configure repository rule to autodetect cuda. (#3966)
This change reimplements the CUDA autoconfiguration mechanism in Skylark,
providing a `cuda_configure` workspace rule. We keep the same user interface,
the ./configure script, but rather than modifying source files within the
source tree, `cuda_configure` generates a `@local_config_cuda` workspace
containing:

* Symlinks to the CUDA headers and libraries
* BUILD files generated with the correct CUDA and cuDNN versions
* CROSSTOOL config with CUDA include dirs populated
* crosstool_wrapper_driver_is_not_gcc wrapper script with compiler paths and
  CUDA compute capabilities set.
* cuda_config.h header file with CUDA versions and compute capabilities set,
  which can be `#include`d by source files.

This change also makes the following fixes to `Dockerfile.gpu`:
* Change the `CUDNN_INSTALL_PATH` to point to `/usr/lib/x86_64-linux-gnu`
  rather than `/usr/local/cuda` since NVIDIA's image installs `libcudnn.so`
  under `/usr/lib/x86_64-linux-gnu`.
* Add env variable to set the minimum compute capability to 3.0.

Fixes #2873
2016-08-22 23:15:02 -07:00

58 lines
1.5 KiB
Smarty

CUDA_VERSION = "%{cuda_version}"
CUDNN_VERSION = "%{cudnn_version}"
PLATFORM = "%{platform}"
def cuda_sdk_version():
return CUDA_VERSION
def cudnn_sdk_version():
return CUDNN_VERSION
def cuda_library_path(name, version = cuda_sdk_version()):
if PLATFORM == "Darwin":
if not version:
return "lib/lib{}.dylib".format(name)
else:
return "lib/lib{}.{}.dylib".format(name, version)
else:
if not version:
return "lib64/lib{}.so".format(name)
else:
return "lib64/lib{}.so.{}".format(name, version)
def cuda_static_library_path(name):
if PLATFORM == "Darwin":
return "lib/lib{}_static.a".format(name)
else:
return "lib64/lib{}_static.a".format(name)
def cudnn_library_path(version = cudnn_sdk_version()):
if PLATFORM == "Darwin":
if not version:
return "lib/libcudnn.dylib"
else:
return "lib/libcudnn.{}.dylib".format(version)
else:
if not version:
return "lib64/libcudnn.so"
else:
return "lib64/libcudnn.so.{}".format(version)
def cupti_library_path(version = cuda_sdk_version()):
if PLATFORM == "Darwin":
if not version:
return "extras/CUPTI/lib/libcupti.dylib"
else:
return "extras/CUPTI/lib/libcupti.{}.dylib".format(version)
else:
if not version:
return "extras/CUPTI/lib64/libcupti.so"
else:
return "extras/CUPTI/lib64/libcupti.so.{}".format(version)
def readlink_command():
if PLATFORM == "Darwin":
return "greadlink"
else:
return "readlink"