From e592e8fccb390073a51c61a529d4a52529c44aa2 Mon Sep 17 00:00:00 2001 From: Daniel Hiltgen Date: Wed, 1 May 2024 15:47:12 -0700 Subject: [PATCH] Support Fedoras standard ROCm location --- gpu/amd_common.go | 6 ++++-- gpu/amd_linux.go | 4 ++-- gpu/amd_windows.go | 4 ++-- scripts/install.sh | 4 ++-- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/gpu/amd_common.go b/gpu/amd_common.go index 6fa4fce4..27a81e3f 100644 --- a/gpu/amd_common.go +++ b/gpu/amd_common.go @@ -81,8 +81,10 @@ func commonAMDValidateLibDir() (string, error) { } // Well known location(s) - if rocmLibUsable(RocmStandardLocation) { - return RocmStandardLocation, nil + for _, path := range RocmStandardLocations { + if rocmLibUsable(path) { + return path, nil + } } // Installer payload location if we're running the installed binary diff --git a/gpu/amd_linux.go b/gpu/amd_linux.go index cbbdf030..9f9f8e74 100644 --- a/gpu/amd_linux.go +++ b/gpu/amd_linux.go @@ -25,12 +25,12 @@ const ( // Prefix with the node dir GPUTotalMemoryFileGlob = "mem_banks/*/properties" // size_in_bytes line GPUUsedMemoryFileGlob = "mem_banks/*/used_memory" - RocmStandardLocation = "/opt/rocm/lib" ) var ( // Used to validate if the given ROCm lib is usable - ROCmLibGlobs = []string{"libhipblas.so.2*", "rocblas"} // TODO - probably include more coverage of files here... + ROCmLibGlobs = []string{"libhipblas.so.2*", "rocblas"} // TODO - probably include more coverage of files here... + RocmStandardLocations = []string{"/opt/rocm/lib", "/usr/lib64"} ) // Gather GPU information from the amdgpu driver if any supported GPUs are detected diff --git a/gpu/amd_windows.go b/gpu/amd_windows.go index dfa7e974..22c9f427 100644 --- a/gpu/amd_windows.go +++ b/gpu/amd_windows.go @@ -14,7 +14,6 @@ import ( ) const ( - RocmStandardLocation = "C:\\Program Files\\AMD\\ROCm\\5.7\\bin" // TODO glob? // TODO We're lookinng for this exact name to detect iGPUs since hipGetDeviceProperties never reports integrated==true iGPUName = "AMD Radeon(TM) Graphics" @@ -22,7 +21,8 @@ const ( var ( // Used to validate if the given ROCm lib is usable - ROCmLibGlobs = []string{"hipblas.dll", "rocblas"} // TODO - probably include more coverage of files here... + ROCmLibGlobs = []string{"hipblas.dll", "rocblas"} // TODO - probably include more coverage of files here... + RocmStandardLocations = []string{"C:\\Program Files\\AMD\\ROCm\\5.7\\bin"} // TODO glob? ) func AMDGetGPUInfo() []GpuInfo { diff --git a/scripts/install.sh b/scripts/install.sh index eb3ff504..20b0db60 100644 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -166,8 +166,8 @@ fi if check_gpu lspci amdgpu || check_gpu lshw amdgpu; then # Look for pre-existing ROCm v6 before downloading the dependencies - for search in "${HIP_PATH:-''}" "${ROCM_PATH:-''}" "/opt/rocm"; do - if [ -n "${search}" ] && [ -e "${search}/lib/libhipblas.so.2" ]; then + for search in "${HIP_PATH:-''}" "${ROCM_PATH:-''}" "/opt/rocm" "/usr/lib64"; do + if [ -n "${search}" ] && [ -e "${search}/libhipblas.so.2" -o -e "${search}/lib/libhipblas.so.2" ]; then status "Compatible AMD GPU ROCm library detected at ${search}" install_success exit 0