我通过以下命令安装了TensorFlow的夜间版本:pip install tf-nightly-gpu --prefix=/tf/install/path
当我尝试运行任何XLA示例时,TensorFlow会出现错误“无法找到libdevice dir。使用'.'编译ptx失败。将尝试让GPU驱动程序编译ptx。未找到:/usr/local/cuda-10.0/bin/ptxas not found”。
显然,TensorFlow无法找到我的CUDA路径。在我的系统中,CUDA安装在/cm/shared/apps/cuda/toolkit/10.0.130中。由于我没有从源代码构建TensorFlow,默认情况下,XLA会搜索/user/local/cuda-*文件夹。但由于我没有这个文件夹,它会发出错误。
目前我的解决方法是创建符号链接。我检查了tensorflow/compiler/xla/service/gpu/nvptx_compiler.cc中的TensorFlow源代码。该文件中有一条注释:“//通过--xla_gpu_cuda_data_dir明确指定的CUDA位置具有最高优先级。”那么如何传递值给此标志?我尝试了以下两个环境变量,但都不起作用:
export XLA_FLAGS="--xla_gpu_cuda_data_dir=/cm/shared/apps/cuda10.0/toolkit/10.0.130/"
export TF_XLA_FLAGS="--xla_gpu_cuda_data_dir=/cm/shared/apps/cuda10.0/toolkit/10.0.130/"
那么如何使用标志 "--xla_gpu_cuda_data_dir" 呢?谢谢。
/path/to/cuda
应该是什么? - Logic1~/.profile
文件中,以便自动执行。 - RustyToms/path/to/cuda
是包含nvvm/libdevice/libdevice.10.bc
的目录。对于conda环境,您可以使用export XLA_FLAGS=--xla_gpu_cuda_data_dir=$CONDA_PREFIX
。 - John