diff --git a/cmake/MFCTargets.cmake b/cmake/MFCTargets.cmake index 5c02fa19d6..99fb7a154c 100644 --- a/cmake/MFCTargets.cmake +++ b/cmake/MFCTargets.cmake @@ -269,10 +269,17 @@ exit 0 PRIVATE -DFRONTIER_UNIFIED) endif() - find_library(HIP_LIB amdhip64 - HINTS "$ENV{OLCF_AFAR_ROOT}/lib" "$ENV{OLCF_AFAR_ROOT}/lib/llvm/lib" REQUIRED) + # Search the AFAR drop first: the ROCm module also ships + # libhipfort-amdgcn.a, and HINTS lose to CMAKE_PREFIX_PATH, which + # would pair the drop's .mod files with another flang's archive. + find_library(HIP_LIB amdhip64 + PATHS "$ENV{OLCF_AFAR_ROOT}/lib" "$ENV{OLCF_AFAR_ROOT}/lib/llvm/lib" + NO_DEFAULT_PATH) + find_library(HIP_LIB amdhip64 REQUIRED) find_library(HIPFORT_AMDGCN_LIB hipfort-amdgcn - HINTS "$ENV{OLCF_AFAR_ROOT}/lib" "$ENV{OLCF_AFAR_ROOT}/lib/llvm/lib" REQUIRED) + PATHS "$ENV{OLCF_AFAR_ROOT}/lib" "$ENV{OLCF_AFAR_ROOT}/lib/llvm/lib" + NO_DEFAULT_PATH) + find_library(HIPFORT_AMDGCN_LIB hipfort-amdgcn REQUIRED) # The hipfort module dir moved to lib/llvm/include in newer AFAR # (therock) drops; keep the classic path for Frontier's layout. target_include_directories(${a_target} PRIVATE diff --git a/toolchain/bootstrap/modules.sh b/toolchain/bootstrap/modules.sh index 14e7e75b34..68743eec3a 100644 --- a/toolchain/bootstrap/modules.sh +++ b/toolchain/bootstrap/modules.sh @@ -234,15 +234,19 @@ if [ ! -z ${CRAY_LD_LIBRARY_PATH+x} ] && [ "$u_c" '!=' 'c' ] && [ "$u_c" '!=' ' fi if [ "$u_c" '==' 'famd' ]; then - export OLCF_AFAR_ROOT="/sw/crusher/ums/compilers/afar/therock-23.1.0-gfx90a-7.12.0-bb5005b6" + export OLCF_AFAR_ROOT="${OLCF_AFAR_ROOT:-/sw/crusher/ums/compilers/afar/therock-afar-23.2.1-gfx90a-7.13.0-7357b5084b}" export PATH=${OLCF_AFAR_ROOT}/lib/llvm/bin:${PATH} export LD_LIBRARY_PATH=${OLCF_AFAR_ROOT}/lib:${OLCF_AFAR_ROOT}/lib/llvm/lib:${LD_LIBRARY_PATH} + # Pinned: cray-mpich's libmpifort_amd.so needs the classic-flang runtimes + # (libpgmath/libflang/libflangrti/libompstub), which no AFAR drop ships and + # which ROCm dropped after 7.0.2. Do not retarget at $ROCM_PATH. export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/rocm-7.0.2/lib/llvm/lib:/opt/rocm-7.0.2/lib/ - export CRAY_MPICH_INC="-I${OLCF_AFAR_ROOT}/include/mpich3.4a2" - export CRAY_HIPFORT_INC="-I${OLCF_AFAR_ROOT}/include/hipfort/amdgcn" - export CRAY_HIPFORT_LIB="-L${OLCF_AFAR_ROOT}/lib -lhipfort-amdgcn -lhipfft -lamdhip64" + # AFAR >= 23.2: no mpich3.4a2, hipfort moved under lib/llvm. + export CRAY_MPICH_INC="-I${OLCF_AFAR_ROOT}/include/mpich4.3.1" + export CRAY_HIPFORT_INC="-I${OLCF_AFAR_ROOT}/lib/llvm/include/hipfort/amdgcn" + export CRAY_HIPFORT_LIB="-L${OLCF_AFAR_ROOT}/lib -L${OLCF_AFAR_ROOT}/lib/llvm/lib -lhipfort-amdgcn -lhipfft -lamdhip64" export CRAY_HIP_INC="-I${OLCF_AFAR_ROOT}/include/hip" export CRAY_MPICH_LIB="-L${CRAY_MPICH_PREFIX}/lib \ ${CRAY_PMI_POST_LINK_OPTS} \