Skip to content
Snippets Groups Projects
Commit 04d5c154 authored by Stepan Nassyr's avatar Stepan Nassyr
Browse files

AMD MI200 OpenGL + Vulkan

parent c65c8d79
Branches
Tags
No related merge requests found
##
# Copyright 2020-2022 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be),
# Flemish Research Foundation (FWO) (http://www.fwo.be/en)
# and the Department of Economy, Science and Innovation (EWI) (http://www.ewi-vlaanderen.be/en).
#
# https://github.com/easybuilders/easybuild
#
# EasyBuild is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation v2.
#
# EasyBuild is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with EasyBuild. If not, see <http://www.gnu.org/licenses/>.
##
"""
EasyBuild support for building and installing LLVM, implemented as an easyblock
@author: Simon Branford (University of Birmingham)
"""
from easybuild.easyblocks.clang import CLANG_TARGETS, DEFAULT_TARGETS_MAP
from easybuild.easyblocks.generic.cmakemake import CMakeMake
from easybuild.framework.easyconfig import CUSTOM
from easybuild.tools.build_log import EasyBuildError
from easybuild.tools.modules import get_software_root
from easybuild.tools.systemtools import get_cpu_architecture
from distutils.version import LooseVersion
class EB_LLVM_AMDGPU(CMakeMake):
"""
Support for building and installing LLVM
"""
@staticmethod
def extra_options():
extra_vars = CMakeMake.extra_options()
extra_vars.update({
'build_targets': [None, "Build targets for LLVM (host architecture if None). Possible values: " +
', '.join(CLANG_TARGETS), CUSTOM],
'enable_rtti': [True, "Enable RTTI", CUSTOM],
})
return extra_vars
def __init__(self, *args, **kwargs):
"""Initialize LLVM-specific variables."""
super(EB_LLVM_AMDGPU, self).__init__(*args, **kwargs)
self.build_shared = self.cfg.get('build_shared_libs', False)
if LooseVersion(self.version) >= LooseVersion('14'):
self.cfg['start_dir'] = '%s-%s.src' % (self.name.lower(), self.version)
# avoid using -DBUILD_SHARED_LIBS directly, use -DLLVM_{BUILD,LINK}_LLVM_DYLIB flags instead
if self.build_shared:
self.cfg['build_shared_libs'] = None
def configure_step(self):
"""
Install extra tools in bin/; enable zlib if it is a dep; optionally enable rtti; and set the build target
"""
if LooseVersion(self.version) >= LooseVersion('14'):
self.cfg.update('configopts', '-DLLVM_INCLUDE_BENCHMARKS=OFF')
if self.build_shared:
self.cfg.update('configopts', '-DLLVM_BUILD_LLVM_DYLIB=ON -DLLVM_LINK_LLVM_DYLIB=ON')
self.cfg.update('configopts', '-DLLVM_INSTALL_UTILS=ON')
if get_software_root('zlib'):
self.cfg.update('configopts', '-DLLVM_ENABLE_ZLIB=ON')
if self.cfg["enable_rtti"]:
self.cfg.update('configopts', '-DLLVM_ENABLE_RTTI=ON')
build_targets = self.cfg['build_targets']
if build_targets is None:
arch = get_cpu_architecture()
try:
default_targets = DEFAULT_TARGETS_MAP[arch][:]
self.cfg['build_targets'] = build_targets = default_targets
self.log.debug("Using %s as default build targets for CPU architecture %s.", default_targets, arch)
except KeyError:
raise EasyBuildError("No default build targets defined for CPU architecture %s.", arch)
unknown_targets = [target for target in build_targets if target not in CLANG_TARGETS+['AMDGPU']]
if unknown_targets:
raise EasyBuildError("Some of the chosen build targets (%s) are not in %s.",
', '.join(unknown_targets), ', '.join(CLANG_TARGETS+['AMDGPU']))
self.cfg.update('configopts', '-DLLVM_TARGETS_TO_BUILD="%s"' % ';'.join(build_targets))
super(EB_LLVM_AMDGPU, self).configure_step()
name = 'LLVM'
easyblock = 'EB_LLVM_AMDGPU'
version = '13.0.0'
homepage = "https://llvm.org/"
description = """The LLVM Core libraries provide a modern source- and target-independent
optimizer, along with code generation support for many popular CPUs
(as well as some less common ones!) These libraries are built around a well
specified code representation known as the LLVM intermediate representation
("LLVM IR"). The LLVM Core libraries are well documented, and it is
particularly easy to invent your own language (or port an existing compiler)
to use LLVM as an optimizer and code generator."""
toolchain = {'name': 'GCCcore', 'version': '11.2.0'}
toolchainopts = {'cstd': 'gnu++11', 'pic': 'True'}
source_urls = [
'https://github.com/llvm/llvm-project/releases/download/llvmorg-%(version)s/']
sources = ['llvm-%(version)s.src.tar.xz']
checksums = ['408d11708643ea826f519ff79761fcdfc12d641a2510229eec459e72f8163020']
builddependencies = [
('binutils', '2.37'),
('CMake', '3.21.1', '', SYSTEM),
('Python', '3.9.6'),
]
dependencies = [
('ncurses', '6.2'),
('zlib', '1.2.11'),
]
build_shared_libs = True
build_targets=["AMDGPU","X86"]
sanity_check_paths = {
'files': ['bin/llvm-ar', 'bin/FileCheck'],
'dirs': ['include/llvm', 'include/llvm-c'],
}
sanity_check_commands = ["llvm-ar --help"]
moduleclass = 'compiler'
easyblock = 'MesonNinja'
name = 'libdrm'
version = '2.4.107'
homepage = 'https://dri.freedesktop.org'
description = """Direct Rendering Manager runtime library."""
toolchain = {'name': 'GCCcore', 'version': '11.2.0'}
source_urls = ['https://dri.freedesktop.org/libdrm/']
sources = [SOURCELOWER_TAR_XZ]
checksums = ['c554cef03b033636a975543eab363cc19081cb464595d3da1ec129f87370f888']
builddependencies = [
('binutils', '2.37'),
('pkg-config', '0.29.2'),
('Meson', '0.58.2'),
('Ninja', '1.10.2'),
]
dependencies = [('X11', '20210802')]
# installing manpages requires an extra build dependency (docbook xsl)
configopts = '-Dman-pages=false'
sanity_check_paths = {
'files': ['lib/libdrm.%s' % SHLIB_EXT, 'include/libdrm/drm.h'],
'dirs': ['include', 'lib'],
}
moduleclass = 'lib'
easyblock = 'MesonNinja'
name = 'libdrm'
version = '2.4.108'
homepage = 'https://dri.freedesktop.org'
description = """Direct Rendering Manager runtime library."""
toolchain = {'name': 'GCCcore', 'version': '11.2.0'}
source_urls = ['https://dri.freedesktop.org/libdrm/']
sources = [SOURCELOWER_TAR_XZ]
checksums = ['a1d7948cbc536763fde14b4beb5e4da7867607966d4cf46301087e8b8fe3d6a0']
# checksums = ['92d8ac54429b171e087e61c2894dc5399fe6a549b1fbba09fa6a3cb9d4e57bd4']
builddependencies = [
('binutils', '2.37'),
('pkg-config', '0.29.2'),
('Meson', '0.58.2'),
('Ninja', '1.10.2'),
]
dependencies = [('X11', '20210802')]
# installing manpages requires an extra build dependency (docbook xsl)
configopts = '-Dman-pages=false'
sanity_check_paths = {
'files': ['lib/libdrm.%s' % SHLIB_EXT, 'include/libdrm/drm.h'],
'dirs': ['include', 'lib'],
}
moduleclass = 'lib'
easyblock = 'MesonNinja'
name = 'libdrm'
version = '2.4.110'
homepage = 'https://dri.freedesktop.org'
description = """Direct Rendering Manager runtime library."""
toolchain = {'name': 'GCCcore', 'version': '11.2.0'}
source_urls = ['https://dri.freedesktop.org/libdrm/']
sources = [SOURCELOWER_TAR_XZ]
checksums = ['eecee4c4b47ed6d6ce1a9be3d6d92102548ea35e442282216d47d05293cf9737']
# checksums = ['92d8ac54429b171e087e61c2894dc5399fe6a549b1fbba09fa6a3cb9d4e57bd4']
builddependencies = [
('binutils', '2.37'),
('pkg-config', '0.29.2'),
('Meson', '0.58.2'),
('Ninja', '1.10.2'),
]
dependencies = [('X11', '20210802')]
# installing manpages requires an extra build dependency (docbook xsl)
configopts = '-Dman-pages=false'
sanity_check_paths = {
'files': ['lib/libdrm.%s' % SHLIB_EXT, 'include/libdrm/drm.h'],
'dirs': ['include', 'lib'],
}
moduleclass = 'lib'
easyblock = 'Bundle'
name = 'OpenGL'
version = '2021b'
homepage = 'http://www.opengl.org/'
description = """
Open Graphics Library (OpenGL) is a cross-language, cross-platform application programming interface (API) for rendering
2D and 3D vector graphics. Mesa is an open-source implementation of the OpenGL specification - a system for rendering
interactive 3D graphics. NVIDIA supports OpenGL and a complete set of OpenGL extensions, designed to give a maximum
performance on NVIDIA GPUs.
This is a GL vendor neutral dispatch (GLVND) installation with Mesa and NVIDIA in the same lib-directory. Mesa or NVIDIA
OpenGL is set individually for each XScreen.
"""
toolchain = {'name': 'GCCcore', 'version': '11.2.0'}
# swr detects and builds parts specific for AVX and AVX2. If we use
# -xHost, this always gets overwritten and will fail.
toolchainopts = {'optarch': False}
builddependencies = [
('Python', '3.9.6'),
('binutils', '2.37'),
('flex', '2.6.4'),
('Bison', '3.7.6'),
('Autotools', '20210726'),
('pkg-config', '0.29.2'),
('expat', '2.4.1'),
('libxml2', '2.9.10'),
('Meson', '0.58.2'),
('Ninja', '1.10.2'),
('CMake', '3.21.1', '', SYSTEM),
]
dependencies = [
('zlib', '1.2.11'),
('nettle', '3.7.3'),
('libdrm', '2.4.110'),
('LLVM', '13.0.0'),
('X11', '20210802'),
('libunwind', '1.5.0'),
('Vulkan-Headers', '1.3.213'),
('Vulkan-Loader', '1.3.213'),
]
default_easyblock = 'ConfigureMake'
default_component_specs = {
'sources': [SOURCE_TAR_GZ],
'start_dir': '%(name)s-%(version)s',
}
local_pkg_config = ('export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:%(installdir)s/lib/pkgconfig && '
'export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:%(installdir)s/lib64/pkgconfig && ')
components = [
# A vendor neutral dispatch layer
('libglvnd', '1.3.4', {
'source_urls': [
'https://gitlab.freedesktop.org/glvnd/libglvnd/-/archive/v%(version)s/'
],
'sources': ['%(name)s-v%(version)s.tar.gz'],
'start_dir': '%(name)s-v%(version)s',
'checksums': ['c42061da999f75234f9bca501c21144d9a5768c5911d674eceb8650ce3fb94bb'],
'preconfigopts': './autogen.sh && '
}),
# Mesa for software rendering, not hardware rendering.
('Mesa', '22.0.3', {
# We build:
# - llvmpipe: the high-performance Gallium LLVM driver (only possible with glx=gallium-xlib)
# - swr: Intel's OpenSWR
'easyblock': 'MesonNinja',
'source_urls': [
'https://mesa.freedesktop.org/archive/',
'https://mesa.freedesktop.org/archive/%(version)s',
'ftp://ftp.freedesktop.org/pub/mesa/%(version)s',
'ftp://ftp.freedesktop.org/pub/mesa/older-versions/%(version_major)s.x/%(version)s',
'ftp://ftp.freedesktop.org/pub/mesa/older-versions/%(version_major)s.x',
],
'sources': [SOURCELOWER_TAR_XZ],
'checksums': [
'9f2b30f5276a9abaf71aafc6979685e2636189de1a87aea2c9e69744a6d0ebb9',
],
'start_dir': '%(namelower)s-%(version)s',
'separate_build_dir': True,
'preconfigopts': local_pkg_config,
# https://gitlab.freedesktop.org/mesa/mesa/-/blob/master/meson_options.txt
'configopts': (' -D libdir=%(installdir)s/lib'
' -D gbm=enabled'
' -D glx=auto'
' -D osmesa=true'
' -D llvm=enabled'
' -D shared-llvm=enabled'
' -D dri-drivers=""'
' -D vulkan-drivers="amd,swrast"'
' -D gallium-drivers="radeonsi,zink,swrast"'
' -D platforms=x11' # surfaceless taken automatically, see logs
' -D glvnd=true'
' -D libunwind=disabled'
' -D valgrind=disabled'
' -D egl=enabled'
' -D gles1=enabled -Dgles2=enabled'
' -D shared-glapi=enabled'
' -D gallium-vdpau=disabled' # only for r300, r600, radeonsi, nouveau
' -D buildtype=release'),
}),
# OpenGL Utility Library - offers higher level GL-graphics functions
('glu', '9.0.2', {
'preconfigopts': local_pkg_config,
'source_urls': [
'ftp://ftp.freedesktop.org/pub/mesa/glu/'
],
'sources': [
'glu-%(version)s.tar.gz'
],
'checksums': [
'24effdfb952453cc00e275e1c82ca9787506aba0282145fff054498e60e19a65',
],
}),
# OpenGL Extension Wrangler Library - determines which OpenGL extensions are supported at run-time
# This is just GLEW for GLX (which requires DISPLAY to be set) and not GLEW for EGL as GLEW selects GLX/EGL at
# compile-time and not run-time (https://github.com/nigels-com/glew/issues/172#issuecomment-357400019)
# Compile+Load GLEW-EGL on top to enable GLEW for EGL
('glew', '2.2.0', {
'source_urls': [
'https://sourceforge.net/projects/glew/files/glew/snapshots/',
],
'sources': [
'glew-20200115.tgz',
],
'checksums': [
'314219ba1db50d49b99705e8eb00e83b230ee7e2135289a00b5b570e4a4db43a',
],
'skipsteps': ['configure'],
'buildopts': ('GLEW_PREFIX=%(installdir)s GLEW_DEST=%(installdir)s LIBDIR=%(installdir)s/lib '
'LDFLAGS.EXTRA="-L${EBROOTX11}/lib/ -lX11" LDFLAGS.GL="-L%(installdir)s/lib -lGL"'),
'installopts': 'GLEW_PREFIX=%(installdir)s GLEW_DEST=%(installdir)s LIBDIR=%(installdir)s/lib ',
'install_cmd': 'make install.all ',
}),
# MESA demos - offers the important command 'eglinfo'
('demos', '95c1a57cfdd1ef2852c828cba4659a72575c5c5d', {
'source_urls': [
'https://gitlab.freedesktop.org/mesa/demos/-/archive/%(version)s/',
],
'sources': [SOURCELOWER_TAR_GZ],
'checksums': [
'7738beca8f6f6981ba04c8a22fde24d69d6b2aaab1758ac695c9475bf704249c',
],
'preconfigopts': ('./autogen.sh && ' +
local_pkg_config +
'GLEW_CFLAGS="-I%(installdir)s/include/" GLEW_LIBS="-L%(installdir)s/lib/ -lGLEW -lGL" '
'EGL_CFLAGS="-I%(installdir)s/include/" EGL_LIBS="-L%(installdir)s/lib/ -lEGL" '),
'configopts': '--disable-osmesa ',
}),
]
postinstallcmds = [
'cd %(installdir)s/lib && ln -sf libGL.so.1.7.0 libGL.so.1',
'rm %(installdir)s/lib/*.la',
'cd %(installdir)s/lib && ln -sf libGLX_mesa.so.0 libGLX_indirect.so.0',
# EGL vendor ICDs
(
'{ cat > %(installdir)s/share/glvnd/egl_vendor.d/50_mesa.json; } << \'EOF\'\n'
'{\n'
' \"file_format_version\" : \"1.0.0\",\n'
' \"ICD\" : {\n'
' \"library_path\" : \"libEGL_mesa.so.0\"\n'
' }\n'
'}\n'
'EOF'
),
# correct pkg-config of GLEW
'sed -i "/^libdir=/c\libdir=\${exec_prefix}\/lib" %(installdir)s/lib/pkgconfig/glew.pc',
'sed -i "/^prefix=/c\prefix=%(installdir)s" %(installdir)s/lib/pkgconfig/glew.pc',
]
modextravars = {
# '__GLX_VENDOR_LIBRARY_NAME': 'mesa'
'__EGL_VENDOR_LIBRARY_FILENAMES': ('%(installdir)s/share/glvnd/egl_vendor.d/50_mesa.json'),
'EGL_PLATFORM': 'surfaceless',
'EGL_DRIVER': 'radeonsi',
'EGL_LOG_LEVEL': 'fatal',
'GALLIUM_DRIVER': 'radeonsi',
'KNOB_MAX_WORKER_THREADS': '65535',
}
modluafooter = '''
add_property("arch","gpu")
conflict("Mesa")
conflict("libGLU")
'''
sanity_check_paths = {
'files': [
'lib/libEGL_mesa.%s' % SHLIB_EXT, 'lib/libOSMesa.%s' % SHLIB_EXT,
'lib/libGLESv1_CM.%s' % SHLIB_EXT, 'lib/libGLESv2.%s' % SHLIB_EXT,
'include/GL/glext.h', 'include/GL/glx.h',
'include/GL/osmesa.h', 'include/GL/gl.h', 'include/GL/glxext.h',
'include/GLES/gl.h', 'include/GLES2/gl2.h', 'include/GLES3/gl3.h',
'lib/libOpenGL.%s' % SHLIB_EXT,
'lib/libGLEW.a', 'lib/libGLEW.%s' % SHLIB_EXT,
'bin/glewinfo', 'bin/visualinfo',
'include/GL/glew.h', 'include/GL/glxew.h', 'include/GL/wglew.h',
],
'dirs': []
}
moduleclass = 'vis'
easyblock = 'CMakeNinja'
name = 'Vulkan-Headers'
version = '1.3.213'
homepage = 'https://www.vulkan.org/'
description = """Vulkan header files and API registry"""
toolchain = {'name': 'GCCcore', 'version': '11.2.0'}
github_account = 'KhronosGroup'
source_urls = [GITHUB_SOURCE]
sources = {
'filename' : SOURCELOWER_TAR_GZ,
'download_filename' : 'v%(version)s.tar.gz'
}
checksums = ['7f4a6118dc3524703c1ce0a44089379e89eeb930fbe28188b90fdac1f10ef676']
builddependencies = [
('CMake', '3.21.1'),
('Ninja', '1.10.2'),
]
sanity_check_paths = {
'files': ['include/vulkan/vulkan.h'],
'dirs': [],
}
moduleclass = 'devel'
easyblock = 'CMakeNinja'
name = 'Vulkan-Loader'
version = '1.3.213'
homepage = 'https://www.vulkan.org/'
description = """Provides the Khronos official Vulkan ICD desktop loader for Windows, Linux, and MacOS"""
toolchain = {'name': 'GCCcore', 'version': '11.2.0'}
github_account = 'KhronosGroup'
source_urls = [GITHUB_SOURCE]
sources = {
'filename' : SOURCELOWER_TAR_GZ,
'download_filename' : 'v%(version)s.tar.gz'
}
checksums = ['3cacac2a39026ce74ff96d2bf5d2c85f2729218182cf0be07ae62f58a5301a39']
builddependencies = [
('CMake', '3.21.1'),
('Ninja', '1.10.2'),
]
dependencies = [
('Vulkan-Headers', version),
('X11', '20210802'),
]
configopts = '-DBUILD_WSI_WAYLAND_SUPPORT=OFF'
sanity_check_paths = {
'files': ['lib/libvulkan.so'],
'dirs': ['lib/pkgconfig'],
}
moduleclass = 'devel'
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment