diff --git a/caffe2/core/common_gpu.cc b/caffe2/core/common_gpu.cc index cb7fa3c8722..b9157b0e86d 100644 --- a/caffe2/core/common_gpu.cc +++ b/caffe2/core/common_gpu.cc @@ -206,6 +206,8 @@ const char* cublasGetErrorString(cublasStatus_t error) { return "rocblas_status_size_increased"; case rocblas_status_size_unchanged: return "rocblas_status_size_unchanged"; + default: + return "unrecognized_rocblas_error"; #endif } // To suppress compiler warning. diff --git a/tools/amd_build/build_amd.py b/tools/amd_build/build_amd.py index 70f7e7a83e1..38698631c03 100755 --- a/tools/amd_build/build_amd.py +++ b/tools/amd_build/build_amd.py @@ -116,7 +116,8 @@ ignores = [ def is_hip_clang() -> bool: try: hip_path = os.getenv('HIP_PATH', '/opt/rocm/hip') - return 'HIP_COMPILER=clang' in open(hip_path + '/lib/.hipInfo').read() + with open(hip_path + '/lib/.hipInfo') as f: + return 'HIP_COMPILER=clang' in f.read() except IOError: return False @@ -124,16 +125,17 @@ def is_hip_clang() -> bool: if is_hip_clang(): gloo_cmake_file = "third_party/gloo/cmake/Hip.cmake" do_write = False - with open(gloo_cmake_file, "r") as sources: - lines = sources.readlines() - newlines = [line.replace(' hip_hcc ', ' amdhip64 ') for line in lines] - if lines == newlines: - print("%s skipped" % gloo_cmake_file) - else: - with open(gloo_cmake_file, "w") as sources: - for line in newlines: - sources.write(line) - print("%s updated" % gloo_cmake_file) + if os.path.exists(gloo_cmake_file): + with open(gloo_cmake_file, "r") as sources: + lines = sources.readlines() + newlines = [line.replace(' hip_hcc ', ' amdhip64 ') for line in lines] + if lines == newlines: + print("%s skipped" % gloo_cmake_file) + else: + with open(gloo_cmake_file, "w") as sources: + for line in newlines: + sources.write(line) + print("%s updated" % gloo_cmake_file) gloo_cmake_file = "third_party/gloo/cmake/Modules/Findrccl.cmake" if os.path.exists(gloo_cmake_file): @@ -153,16 +155,17 @@ if os.path.exists(gloo_cmake_file): if is_hip_clang(): gloo_cmake_file = "third_party/gloo/cmake/Dependencies.cmake" do_write = False - with open(gloo_cmake_file, "r") as sources: - lines = sources.readlines() - newlines = [line.replace('HIP_HCC_FLAGS', 'HIP_CLANG_FLAGS') for line in lines] - if lines == newlines: - print("%s skipped" % gloo_cmake_file) - else: - with open(gloo_cmake_file, "w") as sources: - for line in newlines: - sources.write(line) - print("%s updated" % gloo_cmake_file) + if os.path.exists(gloo_cmake_file): + with open(gloo_cmake_file, "r") as sources: + lines = sources.readlines() + newlines = [line.replace('HIP_HCC_FLAGS', 'HIP_CLANG_FLAGS') for line in lines] + if lines == newlines: + print("%s skipped" % gloo_cmake_file) + else: + with open(gloo_cmake_file, "w") as sources: + for line in newlines: + sources.write(line) + print("%s updated" % gloo_cmake_file) hipify_python.hipify( project_directory=proj_dir,