- 1 year ago
bazel build tensorflow on windows 10 getting cudnn.h- system cannot find the file specified
When building TensorFlow with Bazel on Windows 10 and encountering an error related to cudnn.h
("system cannot find the file specified"), it indicates that Bazel is unable to locate the CUDA Deep Neural Network (cuDNN) header file. cuDNN is a library provided by NVIDIA that accelerates deep learning computations on GPUs.
To resolve this issue, you need to ensure that the cuDNN library is correctly installed and accessible by Bazel during the build process. Follow these steps to fix the problem:
Download cuDNN Library:
Download the cuDNN library from the NVIDIA website (https://developer.nvidia.com/cudnn). Make sure you download the correct version of cuDNN that matches your GPU and CUDA version.Extract the cuDNN Files:
Extract the downloaded cuDNN files to a directory on your computer. The extracted files will include thecudnn.h
header file.Set Environment Variables:
Set theCUDNN_HOME
environment variable to point to the directory where cuDNN is installed. This will allow Bazel to find thecudnn.h
header file.Open a Command Prompt or PowerShell window and run the following command:
bashsetx CUDNN_HOME "C:\path\to\cuDNN\installation\"
Replace
"C:\path\to\cuDNN\installation\"
with the actual path to the directory where you extracted cuDNN.Note: After setting the environment variable, you may need to restart your command prompt or IDE for the changes to take effect.
Rebuild TensorFlow:
After setting theCUDNN_HOME
environment variable, try rebuilding TensorFlow with Bazel:bashbazel build --config=opt --config=cuda //tensorflow:libtensorflow_cc.so
The
--config=cuda
flag enables the CUDA support in TensorFlow, and the build should now be able to find thecudnn.h
header file.
Please ensure that you have the necessary CUDA and cuDNN versions that are compatible with your GPU and TensorFlow version. Check the TensorFlow documentation for the specific version requirements and installation instructions for CUDA and cuDNN.