amd/5.6.1 (amd-5.6.1.eb)
To access module help and find out for which stacks and partitions the module is
installed, use module spider amd/5.6.1
.
EasyConfig:
easyblock = 'Bundle'
name = 'amd'
version = '5.6.1'
homepage = 'https://docs.lumi-supercomputer.eu/'
whatis = [
'Description: defines the system paths and environment variables needed to use the AMD ROCm compilers.'
]
description = """
The amd module defines the system paths and environment variables needed to use
the AMD ROCm compilers.
This module is not part of the official Cray Programming Environment. It's
provided by the LUMI user support team to allow the users to use the
rocm/%s module with the Cray compiler wrappers as if it was the official
Cray amd compiler module.
""" % version
toolchain = SYSTEM
builddependencies = [
('rocm', version),
]
import subprocess
local_rocm_root = subprocess.run(
'module load rocm/%s && echo $ROCM_PATH' % version,
shell=True,
stdout=subprocess.PIPE
).stdout.decode('utf-8').strip()
local_pkgconfig_content = """
Name: amdcompiler
Description: ROCm AMD compiler
Version: %(rocm_version)s
Requires.private: gcc-toolchain
Cflags: -Wno-unused-command-line-argument
Libs: -Wl,-rpath=%(rocm_root)s/llvm/lib -Wl,-rpath=/opt/cray/pe/gcc-libs
""" % {
'rocm_root' : local_rocm_root,
'rocm_version' : '%(version)s',
}
postinstallcmds = [
'mkdir -p %(installdir)s/pkgconfig',
'cd %(installdir)s/pkgconfig ; cat >amdcompiler-%(version)s.pc <<EOF\n' + local_pkgconfig_content.replace('$', '\$') + '\nEOF\n',
'cd %(installdir)s/pkgconfig ; ln -s amdcompiler-%(version)s.pc amdcompiler.pc',
]
modluafooter = """
family("compiler")
conflict("amd-mixed")
local rocm_root = "%(rocm_root)s"
local rocm_was_loaded = isloaded("rocm")
if rocm_was_loaded then
unload("rocm")
end
prepend_path("MODULEPATH", "/opt/cray/pe/lmod/modulefiles/mix_compilers")
prepend_path("MODULEPATH", "/opt/cray/pe/lmod/modulefiles/compiler/amd/4.0")
prepend_path("MODULEPATH", "/opt/cray/pe/lmod/modulefiles/comnet/amd/4.0/ofi/1.0")
prepend_path("PATH", pathJoin(rocm_root, "bin"))
prepend_path("LIBRARY_PATH", pathJoin(rocm_root, "llvm/lib"))
prepend_path("LD_LIBRARY_PATH", pathJoin(rocm_root, "llvm/lib"))
prepend_path("C_INCLUDE_PATH", pathJoin(rocm_root, "llvm/include"))
prepend_path("CPLUS_INCLUDE_PATH", pathJoin(rocm_root, "llvm/include"))
prepend_path("CMAKE_PREFIX_PATH", rocm_root)
prepend_path("CMAKE_PREFIX_PATH", pathJoin(rocm_root, "hip"))
setenv("ROCM_COMPILER_PATH", pathJoin(rocm_root, "llvm"))
setenv("ROCM_COMPILER_VERSION", "%(rocm_version)s")
setenv("CRAY_AMD_COMPILER_PREFIX", rocm_root)
setenv("CRAY_AMD_COMPILER_VERSION", "%(rocm_version)s")
setenv("ROCM_PATH", rocm_root)
setenv("CRAY_LMOD_COMPILER","amd/4.0")
append_path("PE_PRODUCT_LIST", "AMD_COMPILER")
prepend_path("PKG_CONFIG_PATH", pathJoin("%(install_root)s", "pkgconfig"))
prepend_path("PKG_CONFIG_PATH", "/opt/cray/pe/gcc-libs/pkgconfig")
prepend_path("PE_PKGCONFIG_LIBS", "amdcompiler-%(rocm_version)s")
local old_hipcc_compile = os.getenv("HIPCC_COMPILE_FLAGS_APPEND") or ""
local old_hipcc_link = os.getenv("HIPCC_LINK_FLAGS_APPEND") or ""
local gcc_toolchain = ""
if mode() == "load" then
gcc_toolchain = capture("pkg-config --cflags gcc-toolchain"):gsub("\\n$","")
end
local gcc_rpath = "-Wl,-rpath=/opt/cray/pe/gcc-libs"
local hip_rpath = "-Wl,-rpath=" .. pathJoin(rocm_root, "lib")
local llvm_rpath = "-Wl,-rpath=" .. pathJoin(rocm_root, "llvm/lib")
pushenv("HIPCC_COMPILE_FLAGS_APPEND", "--offload-arch=gfx90a " .. gcc_toolchain .. " " .. old_hipcc_compile)
pushenv("HIPCC_LINK_FLAGS_APPEND", gcc_rpath .. " " .. hip_rpath .. " " .. llvm_rpath .. " " .. old_hipcc_link)
if os.getenv("LMOD_FAMILY_PRGENV") ~= nil then
if not isloaded("PrgEnv-amd") then
load("PrgEnv-amd")
end
end
if rocm_was_loaded then
load("rocm/%(rocm_version)s")
end
""" % {
'rocm_root' : local_rocm_root,
'rocm_version' : '%(version)s',
'install_root' : '%(installdir)s',
}
moduleclass = 'compiler'