Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bazel] Use tmp dir for intermediate NVCC source files #22950

Merged
merged 3 commits into from Mar 18, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
23 changes: 15 additions & 8 deletions third_party/gpus/cuda_configure.bzl
Expand Up @@ -144,14 +144,19 @@ def _get_python_bin(repository_ctx):
)

def _get_nvcc_tmp_dir_for_windows(repository_ctx):
"""Return the tmp directory for nvcc to generate intermediate source files."""
escaped_tmp_dir = escape_string(
get_env_var(repository_ctx, "TMP", "C:\\Windows\\Temp").replace(
"\\",
"\\\\",
),
)
return escaped_tmp_dir + "\\\\nvcc_inter_files_tmp_dir"
"""Return the Windows tmp directory for nvcc to generate intermediate source files."""
escaped_tmp_dir = escape_string(
get_env_var(repository_ctx, "TMP", "C:\\Windows\\Temp").replace(
"\\", "\\\\"),)
return escaped_tmp_dir + "\\\\nvcc_inter_files_tmp_dir"


def _get_nvcc_tmp_dir_for_unix(repository_ctx):
"""Return the UNIX tmp directory for nvcc to generate intermediate source files."""
escaped_tmp_dir = escape_string(
get_env_var(repository_ctx, "TMPDIR", "/tmp"))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add TMP and TMPDIR here:

environ = [
_GCC_HOST_COMPILER_PATH,
_CLANG_CUDA_COMPILER_PATH,
"TF_NEED_CUDA",
"TF_CUDA_CLANG",
_TF_DOWNLOAD_CLANG,

So that when the environment variable changes, the CROSSTOOL will get reconfigured.

return escaped_tmp_dir + "/nvcc_inter_files_tmp_dir"


def _get_msvc_compiler(repository_ctx):
vc_path = find_vc_path(repository_ctx)
Expand Down Expand Up @@ -1516,6 +1521,8 @@ cuda_configure = repository_rule(
_TF_CUDA_CONFIG_REPO,
"NVVMIR_LIBRARY_DIR",
_PYTHON_BIN_PATH,
"TMP",
"TMPDIR",
],
)

Expand Down