diff --git a/tools/ci_build/build.py b/tools/ci_build/build.py index 7b7bbea59e..e5447eee8a 100755 --- a/tools/ci_build/build.py +++ b/tools/ci_build/build.py @@ -962,80 +962,6 @@ def setup_cuda_vars(args): .format( cuda_home, cuda_home_valid, cudnn_home, cudnn_home_valid)) - # Our CI build machines already have the env vars setup - if is_windows() and 'AGENT_VERSION' not in os.environ: - # Validate that the cudnn_home is pointing at - # the right level. - if not os.path.exists(os.path.join(cudnn_home, "bin")): - raise BuildError( - "cudnn_home path should include the 'cuda' folder, and " - "must contain the CUDNN 'bin' directory.", - "cudnn_home='{}'".format(cudnn_home)) - - os.environ["CUDA_PATH"] = cuda_home - os.environ["CUDA_TOOLKIT_ROOT_DIR"] = cuda_home - - cuda_bin_path = os.path.join(cuda_home, 'bin') - os.environ["CUDA_BIN_PATH"] = cuda_bin_path - os.environ["PATH"] += (os.pathsep + cuda_bin_path + os.pathsep + - os.path.join(cudnn_home, 'bin')) - # Add version specific CUDA_PATH_Vx_y value as the - # Visual Studio build files require that. - version_file = os.path.join(cuda_home, 'version.txt') - if not os.path.exists(version_file): - raise BuildError( - "No version file found in CUDA install directory. " - "Looked for " + version_file) - cuda_major_version = "unknown" - - with open(version_file) as f: - # First line of version file should have something - # like 'CUDA Version 9.2.148'. - first_line = f.readline() - m = re.match(r"CUDA Version (\d+).(\d+)", first_line) - if not m: - raise BuildError( - "Couldn't read version from first line of " + - version_file) - - cuda_major_version = m.group(1) - minor = m.group(2) - os.environ["CUDA_PATH_V{}_{}".format( - cuda_major_version, minor)] = cuda_home - - vc_ver_str = os.getenv("VCToolsVersion") or "" - vc_ver = vc_ver_str.split(".") - if len(vc_ver) != 3: - log.warning( - "Unable to automatically verify VS 2017 toolset is " - "compatible with CUDA. Will attempt to use.") - log.warning( - "Failed to get valid Visual C++ Tools version from " - "VCToolsVersion environment variable value of '" + - vc_ver_str + "'") - log.warning( - "VCToolsVersion is set in a VS 2017 Developer Command " - "shell, or by running " - "'%VS2017INSTALLDIR%\\VC\\Auxiliary\\Build\\vcvars64.bat'") - log.warning( - "See build.md in the root ONNXRuntime directory for " - "instructions on installing the Visual C++ 2017 14.11 " - "toolset if needed.") - - elif (cuda_major_version == "9" and vc_ver[0] == "14" and - int(vc_ver[1]) > 11): - raise BuildError( - "Visual C++ Tools version not supported by CUDA v9. You " - "must setup the environment to use the 14.11 toolset.", - "Current version is {}. CUDA 9.2 requires version " - "14.11.*".format(vc_ver_str), "If necessary manually " - "install the 14.11 toolset using the Visual Studio 2017 " - "updater.", "See 'Windows CUDA Build' in " - "build.md in the root directory of this repository.") - - # TODO: check if cuda_version >=10.1, when cuda is enabled - # and VS version >=2019. - return cuda_home, cudnn_home