From 7a239d4952a671a557c553e8a8380aa05c451f58 Mon Sep 17 00:00:00 2001 From: Christian Sigg Date: Sun, 7 Jun 2020 22:03:55 -0700 Subject: [PATCH] Assemble CUDA and cuDNN DLL name in build_info from version. The version strings from cuda_configure.bzl are cuda_version: x.y on Linux, 64_xy on Windows cudnn_version: x on Linux, 64_x on Windows The DLL names can be assembled from those, instead of passing them in from environment variables. This hopefully fixes the Windows build. PiperOrigin-RevId: 315212567 Change-Id: Ia9709297f8eff1baece1722e58e58f5bb469bbbf --- tensorflow/tensorflow.bzl | 4 ++-- tensorflow/tools/build_info/gen_build_info.py | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/tensorflow/tensorflow.bzl b/tensorflow/tensorflow.bzl index 9029e76fef5..2730685a26f 100644 --- a/tensorflow/tensorflow.bzl +++ b/tensorflow/tensorflow.bzl @@ -2633,8 +2633,8 @@ def tf_py_build_info_genrule(name, out): "msvcp_dll_names": "msvcp140.dll,msvcp140_1.dll", }), "") + if_windows_cuda(_dict_to_kv({ "nvcuda_dll_name": "nvcuda.dll", - "cudart_dll_name": "cudart64_$$(echo $${TF_CUDA_VERSION:-} | sed \"s/\\.//\").dll", - "cudnn_dll_name": "cudnn64_$${TF_CUDNN_VERSION:-}.dll", + "cudart_dll_name": "cudart{cuda_version}.dll", + "cudnn_dll_name": "cudnn{cudnn_version}.dll", }), ""), ) diff --git a/tensorflow/tools/build_info/gen_build_info.py b/tensorflow/tools/build_info/gen_build_info.py index 964a882874f..19478ab4dc2 100755 --- a/tensorflow/tools/build_info/gen_build_info.py +++ b/tensorflow/tools/build_info/gen_build_info.py @@ -39,6 +39,10 @@ def write_build_info(filename, key_value_list): """ build_info = {} + + if cuda_config: + build_info.update(cuda_config.config) + for arg in key_value_list: key, value = six.ensure_str(arg).split("=") if value.lower() == "true": @@ -46,10 +50,7 @@ def write_build_info(filename, key_value_list): elif value.lower() == "false": build_info[key] = False else: - build_info[key] = value - - if cuda_config: - build_info.update(cuda_config.config) + build_info[key] = value.format(**build_info) contents = """ # Copyright 2020 The TensorFlow Authors. All Rights Reserved.