From 3c02f7574705673574c0dfaed06bd1bd662a54c3 Mon Sep 17 00:00:00 2001 From: edmondac-admin Date: Wed, 18 Dec 2019 15:00:11 +0000 Subject: [PATCH 01/17] Change options based on arch for Mesa --- easybuild/easyblocks/m/mesa.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 easybuild/easyblocks/m/mesa.py diff --git a/easybuild/easyblocks/m/mesa.py b/easybuild/easyblocks/m/mesa.py new file mode 100644 index 0000000000..dab01c411e --- /dev/null +++ b/easybuild/easyblocks/m/mesa.py @@ -0,0 +1,17 @@ +# This easyblock was created by the BEAR Software team at the University of Birmingham + +from easybuild.easyblocks.generic.mesonninja import MesonNinja +from easybuild.tools.systemtools import POWER, X86_64, get_cpu_architecture + + +class EB_Mesa(MesonNinja): + def configure_step(self, cmd_prefix=''): + """ + Customise the configopts based on the platform + """ + arch = get_cpu_architecture() + if arch == X86_64: + self.cfg.update('configopts', "-Dgallium-drivers='swrast,swr' -Dswr-arches=avx,avx2,skx,knl") + elif arch == POWER: + self.cfg.update('configopts', "-Dgallium-drivers='swrast'") + return super(EB_Mesa, self).configure_step(cmd_prefix=cmd_prefix) From 4e42c5223e1d2ee559a25924686099992536b116 Mon Sep 17 00:00:00 2001 From: Ed Date: Thu, 16 Jan 2020 16:24:24 +0000 Subject: [PATCH 02/17] Update mesa.py "-Dswr-arches=avx,avx2,skx,knl" fails on too many types of system, so removing it --- easybuild/easyblocks/m/mesa.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/easybuild/easyblocks/m/mesa.py b/easybuild/easyblocks/m/mesa.py index dab01c411e..f2684197bb 100644 --- a/easybuild/easyblocks/m/mesa.py +++ b/easybuild/easyblocks/m/mesa.py @@ -11,7 +11,7 @@ def configure_step(self, cmd_prefix=''): """ arch = get_cpu_architecture() if arch == X86_64: - self.cfg.update('configopts', "-Dgallium-drivers='swrast,swr' -Dswr-arches=avx,avx2,skx,knl") + self.cfg.update('configopts', "-Dgallium-drivers='swrast,swr') elif arch == POWER: self.cfg.update('configopts', "-Dgallium-drivers='swrast'") return super(EB_Mesa, self).configure_step(cmd_prefix=cmd_prefix) From 725459ccc41999a7360bbfe1b32ebbefdbd2e558 Mon Sep 17 00:00:00 2001 From: Ed Date: Thu, 16 Jan 2020 16:24:53 +0000 Subject: [PATCH 03/17] Update mesa.py --- easybuild/easyblocks/m/mesa.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/easybuild/easyblocks/m/mesa.py b/easybuild/easyblocks/m/mesa.py index f2684197bb..e03afc5966 100644 --- a/easybuild/easyblocks/m/mesa.py +++ b/easybuild/easyblocks/m/mesa.py @@ -11,7 +11,7 @@ def configure_step(self, cmd_prefix=''): """ arch = get_cpu_architecture() if arch == X86_64: - self.cfg.update('configopts', "-Dgallium-drivers='swrast,swr') + self.cfg.update('configopts', "-Dgallium-drivers='swrast,swr'") elif arch == POWER: self.cfg.update('configopts', "-Dgallium-drivers='swrast'") return super(EB_Mesa, self).configure_step(cmd_prefix=cmd_prefix) From c22925313fe2ff68460000bbf03d08196d99b349 Mon Sep 17 00:00:00 2001 From: edmondac-admin Date: Fri, 6 Mar 2020 09:40:26 +0000 Subject: [PATCH 04/17] Copyright notice --- easybuild/easyblocks/m/mesa.py | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/easybuild/easyblocks/m/mesa.py b/easybuild/easyblocks/m/mesa.py index e03afc5966..00410b64be 100644 --- a/easybuild/easyblocks/m/mesa.py +++ b/easybuild/easyblocks/m/mesa.py @@ -1,4 +1,31 @@ -# This easyblock was created by the BEAR Software team at the University of Birmingham +## +# Copyright 2009-2020 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 . +## +""" +EasyBuild support for installing Mesa, implemented as an easyblock + +@author: Andrew Edmondson (University of Birmingham) from easybuild.easyblocks.generic.mesonninja import MesonNinja from easybuild.tools.systemtools import POWER, X86_64, get_cpu_architecture From f4862040e1c5962bf92b07d9b55048f4ff969ebb Mon Sep 17 00:00:00 2001 From: edmondac-admin Date: Fri, 6 Mar 2020 09:40:59 +0000 Subject: [PATCH 05/17] Missing quotes --- easybuild/easyblocks/m/mesa.py | 1 + 1 file changed, 1 insertion(+) diff --git a/easybuild/easyblocks/m/mesa.py b/easybuild/easyblocks/m/mesa.py index 00410b64be..b8ad0ba994 100644 --- a/easybuild/easyblocks/m/mesa.py +++ b/easybuild/easyblocks/m/mesa.py @@ -26,6 +26,7 @@ EasyBuild support for installing Mesa, implemented as an easyblock @author: Andrew Edmondson (University of Birmingham) +""" from easybuild.easyblocks.generic.mesonninja import MesonNinja from easybuild.tools.systemtools import POWER, X86_64, get_cpu_architecture From e0cf7acd76c6b92de74ced9dbb620f84607d1f27 Mon Sep 17 00:00:00 2001 From: edmondac-admin Date: Mon, 9 Mar 2020 14:55:50 +0000 Subject: [PATCH 06/17] Set the swr-arches based on the available CPU features --- easybuild/easyblocks/m/mesa.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/easybuild/easyblocks/m/mesa.py b/easybuild/easyblocks/m/mesa.py index b8ad0ba994..b0e62faace 100644 --- a/easybuild/easyblocks/m/mesa.py +++ b/easybuild/easyblocks/m/mesa.py @@ -29,7 +29,7 @@ """ from easybuild.easyblocks.generic.mesonninja import MesonNinja -from easybuild.tools.systemtools import POWER, X86_64, get_cpu_architecture +from easybuild.tools.systemtools import POWER, X86_64, get_cpu_architecture, get_cpu_features class EB_Mesa(MesonNinja): @@ -42,4 +42,20 @@ def configure_step(self, cmd_prefix=''): self.cfg.update('configopts', "-Dgallium-drivers='swrast,swr'") elif arch == POWER: self.cfg.update('configopts', "-Dgallium-drivers='swrast'") + + features = set(get_cpu_features()) + arches = [] + if 'avx' in features: + arches.append('avx') + if 'avx2' in features: + arches.append('avx2') + if 'avx512f' in features: + # AVX-512 Foundation - introduced in Skylake + arches.append('skx') + if 'avx512er' in features: + # AVX-512 Exponential and Reciprocal Instructions implemented in Knights Landing + arches.append('knl') + if arches: + self.cfg.update('configopts', "-Dswr-arches=%s" % ','.join(arches)) + return super(EB_Mesa, self).configure_step(cmd_prefix=cmd_prefix) From 82538ab66b485a584f89a22507f707733db8398b Mon Sep 17 00:00:00 2001 From: Ed Date: Mon, 9 Mar 2020 15:33:04 +0000 Subject: [PATCH 07/17] Update easybuild/easyblocks/m/mesa.py Co-Authored-By: Sam Moors --- easybuild/easyblocks/m/mesa.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/easybuild/easyblocks/m/mesa.py b/easybuild/easyblocks/m/mesa.py index b0e62faace..9d4ee5b887 100644 --- a/easybuild/easyblocks/m/mesa.py +++ b/easybuild/easyblocks/m/mesa.py @@ -45,7 +45,7 @@ def configure_step(self, cmd_prefix=''): features = set(get_cpu_features()) arches = [] - if 'avx' in features: + if 'avx' in features or 'avx1.0' in features: arches.append('avx') if 'avx2' in features: arches.append('avx2') From 8aee552e665910d9dd490adf2476f518ee6d2c4c Mon Sep 17 00:00:00 2001 From: Ed Date: Fri, 20 Mar 2020 10:33:43 +0000 Subject: [PATCH 08/17] Update easybuild/easyblocks/m/mesa.py Co-Authored-By: Sam Moors --- easybuild/easyblocks/m/mesa.py | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/easybuild/easyblocks/m/mesa.py b/easybuild/easyblocks/m/mesa.py index 9d4ee5b887..288e2de21e 100644 --- a/easybuild/easyblocks/m/mesa.py +++ b/easybuild/easyblocks/m/mesa.py @@ -45,17 +45,18 @@ def configure_step(self, cmd_prefix=''): features = set(get_cpu_features()) arches = [] - if 'avx' in features or 'avx1.0' in features: - arches.append('avx') - if 'avx2' in features: - arches.append('avx2') - if 'avx512f' in features: - # AVX-512 Foundation - introduced in Skylake - arches.append('skx') - if 'avx512er' in features: - # AVX-512 Exponential and Reciprocal Instructions implemented in Knights Landing - arches.append('knl') - if arches: - self.cfg.update('configopts', "-Dswr-arches=%s" % ','.join(arches)) + if arch == X86_64: + if 'avx' in features or 'avx1.0' in features: + arches.append('avx') + if 'avx2' in features: + arches.append('avx2') + if 'avx512f' in features: + # AVX-512 Foundation - introduced in Skylake + arches.append('skx') + if 'avx512er' in features: + # AVX-512 Exponential and Reciprocal Instructions implemented in Knights Landing + arches.append('knl') + if arches: + self.cfg.update('configopts', "-Dswr-arches=%s" % ','.join(arches)) return super(EB_Mesa, self).configure_step(cmd_prefix=cmd_prefix) From ecdfec6570b6a46c3670b1512b29e1c85cea5829 Mon Sep 17 00:00:00 2001 From: Ed Date: Fri, 20 Mar 2020 14:04:32 +0000 Subject: [PATCH 09/17] Update easybuild/easyblocks/m/mesa.py Co-Authored-By: Alex Domingo --- easybuild/easyblocks/m/mesa.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/easybuild/easyblocks/m/mesa.py b/easybuild/easyblocks/m/mesa.py index 288e2de21e..2395608b92 100644 --- a/easybuild/easyblocks/m/mesa.py +++ b/easybuild/easyblocks/m/mesa.py @@ -38,10 +38,12 @@ def configure_step(self, cmd_prefix=''): Customise the configopts based on the platform """ arch = get_cpu_architecture() - if arch == X86_64: - self.cfg.update('configopts', "-Dgallium-drivers='swrast,swr'") - elif arch == POWER: - self.cfg.update('configopts', "-Dgallium-drivers='swrast'") + if 'gallium-drivers' not in self.cfg['configopts']: + # Install appropriate Gallium drivers for current architecture + if arch == X86_64: + self.cfg.update('configopts', "-Dgallium-drivers='swrast,swr'") + elif arch == POWER: + self.cfg.update('configopts', "-Dgallium-drivers='swrast'") features = set(get_cpu_features()) arches = [] From cac0c0cb88e405e838803a3ba560237ceda0a823 Mon Sep 17 00:00:00 2001 From: Ed Date: Fri, 20 Mar 2020 14:04:57 +0000 Subject: [PATCH 10/17] Update easybuild/easyblocks/m/mesa.py Co-Authored-By: Alex Domingo --- easybuild/easyblocks/m/mesa.py | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/easybuild/easyblocks/m/mesa.py b/easybuild/easyblocks/m/mesa.py index 2395608b92..c08914167d 100644 --- a/easybuild/easyblocks/m/mesa.py +++ b/easybuild/easyblocks/m/mesa.py @@ -45,20 +45,16 @@ def configure_step(self, cmd_prefix=''): elif arch == POWER: self.cfg.update('configopts', "-Dgallium-drivers='swrast'") - features = set(get_cpu_features()) - arches = [] - if arch == X86_64: - if 'avx' in features or 'avx1.0' in features: - arches.append('avx') - if 'avx2' in features: - arches.append('avx2') - if 'avx512f' in features: - # AVX-512 Foundation - introduced in Skylake - arches.append('skx') - if 'avx512er' in features: - # AVX-512 Exponential and Reciprocal Instructions implemented in Knights Landing - arches.append('knl') - if arches: - self.cfg.update('configopts', "-Dswr-arches=%s" % ','.join(arches)) + if 'swr-arches' not in self.cfg['configopts']: + # Set cpu features of SWR for current architecture + cpu_features = set(get_cpu_features()) + swr_arches = [] + if arch == X86_64: + # avx512f: AVX-512 Foundation - introduced in Skylake + # avx512er: AVX-512 Exponential and Reciprocal Instructions implemented in Knights Landing + x86_features = {'avx': 'avx', 'avx1.0': 'avx', 'avx2': 'avx2', 'avx512f': 'skx', 'avx512er': 'knl'} + swr_arches = [farch for fname, farch in x86_features.items() if fname in cpu_features] + if swr_arches: + self.cfg.update('configopts', "-Dswr-arches=%s" % ','.join(swr_arches)) return super(EB_Mesa, self).configure_step(cmd_prefix=cmd_prefix) From 54826eccc9412504739d91e28d6b28671292643a Mon Sep 17 00:00:00 2001 From: Kenneth Hoste Date: Sat, 21 Mar 2020 19:41:05 +0100 Subject: [PATCH 11/17] minor style cleanup in configure step of Mesa easyblock --- easybuild/easyblocks/m/mesa.py | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/easybuild/easyblocks/m/mesa.py b/easybuild/easyblocks/m/mesa.py index c08914167d..002b0dc6ba 100644 --- a/easybuild/easyblocks/m/mesa.py +++ b/easybuild/easyblocks/m/mesa.py @@ -26,6 +26,7 @@ EasyBuild support for installing Mesa, implemented as an easyblock @author: Andrew Edmondson (University of Birmingham) +@author: Kenneth Hoste (HPC-UGent) """ from easybuild.easyblocks.generic.mesonninja import MesonNinja @@ -46,15 +47,19 @@ def configure_step(self, cmd_prefix=''): self.cfg.update('configopts', "-Dgallium-drivers='swrast'") if 'swr-arches' not in self.cfg['configopts']: - # Set cpu features of SWR for current architecture - cpu_features = set(get_cpu_features()) - swr_arches = [] + # set cpu features of SWR for current architecture (only on x86_64) if arch == X86_64: - # avx512f: AVX-512 Foundation - introduced in Skylake - # avx512er: AVX-512 Exponential and Reciprocal Instructions implemented in Knights Landing - x86_features = {'avx': 'avx', 'avx1.0': 'avx', 'avx2': 'avx2', 'avx512f': 'skx', 'avx512er': 'knl'} - swr_arches = [farch for fname, farch in x86_features.items() if fname in cpu_features] - if swr_arches: - self.cfg.update('configopts', "-Dswr-arches=%s" % ','.join(swr_arches)) + feat_to_swrarch = { + 'avx': 'avx', + 'avx1.0': 'avx', # on macOS, AVX is indicated with 'avx1.0' rather than 'avx' + 'avx2': 'avx2', + 'avx512f': 'skx', # AVX-512 Foundation - introduced in Skylake + 'avx512er': 'knl', # AVX-512 Exponential and Reciprocal Instructions implemented in Knights Landing + } + # determine list of values to pass to swr-arches configuration option + cpu_features = set(get_cpu_features()) + swr_arches = [feat_to_swrarch[key] for key in feat_to_swrarch if key in cpu_features] + + self.cfg.update('configopts', '-Dswr-arches=' + ','.join(sorted(swr_arches))) return super(EB_Mesa, self).configure_step(cmd_prefix=cmd_prefix) From 99d9f8018ad4d554e37dbcd362b5ce07652bd35a Mon Sep 17 00:00:00 2001 From: Kenneth Hoste Date: Sat, 21 Mar 2020 20:45:03 +0100 Subject: [PATCH 12/17] always copy include/GL/internal headers + implement custom sanity check step in Mesa easyblock --- easybuild/easyblocks/m/mesa.py | 42 ++++++++++++++++++++++++++++++---- 1 file changed, 38 insertions(+), 4 deletions(-) diff --git a/easybuild/easyblocks/m/mesa.py b/easybuild/easyblocks/m/mesa.py index 002b0dc6ba..76d9df0a01 100644 --- a/easybuild/easyblocks/m/mesa.py +++ b/easybuild/easyblocks/m/mesa.py @@ -28,15 +28,20 @@ @author: Andrew Edmondson (University of Birmingham) @author: Kenneth Hoste (HPC-UGent) """ +import os from easybuild.easyblocks.generic.mesonninja import MesonNinja -from easybuild.tools.systemtools import POWER, X86_64, get_cpu_architecture, get_cpu_features +from easybuild.tools.filetools import copy_dir +from easybuild.tools.systemtools import POWER, X86_64, get_cpu_architecture, get_cpu_features, get_shared_lib_ext class EB_Mesa(MesonNinja): - def configure_step(self, cmd_prefix=''): + """Custom easyblock for building and installing Mesa.""" + + def configure_step(self): """ - Customise the configopts based on the platform + Customise the configure options based on the processor architecture of the host + (x86_64 or not, CPU features, ...) """ arch = get_cpu_architecture() if 'gallium-drivers' not in self.cfg['configopts']: @@ -62,4 +67,33 @@ def configure_step(self, cmd_prefix=''): self.cfg.update('configopts', '-Dswr-arches=' + ','.join(sorted(swr_arches))) - return super(EB_Mesa, self).configure_step(cmd_prefix=cmd_prefix) + return super(EB_Mesa, self).configure_step() + + def install_step(self): + """Also copy additional header files after installing Mesa.""" + + super(EB_Mesa, self).install_step() + + # also install header files located include/GL/internal/ + # we can't enable both DRI and Gallium drivers, but we can provide the DRI header file (GL/internal/dri_interface.h) + src_inc_GL_internal = os.path.join(self.start_dir, 'include', 'GL', 'internal') + target_inc_GL_internal = os.path.join(self.installdir, 'include', 'GL', 'internal') + copy_dir(src_inc_GL_internal, target_inc_GL_internal) + self.log.info("Copied %s to %s" % (src_inc_GL_internal, target_inc_GL_internal)) + + def sanity_check_step(self): + """Custom sanity check for Mesa.""" + + shlib_ext = get_shared_lib_ext() + + gl_inc_files = ['glext.h', 'gl_mangle.h', 'glx.h', 'osmesa.h', 'gl.h', 'glxext.h', 'glx_mangle.h'] + gles_inc_files = [('GLES', 'gl.h'), ('GLES2', 'gl2.h'), ('GLES3', 'gl3.h')] + + custom_paths = { + 'files': [os.path.join('lib', 'libOSMesa.%s' % shlib_ext)] + + [os.path.join('include', 'GL', x) for x in gl_inc_files] + + [os.path.join('include', x, y) for (x, y) in gles_inc_files], + 'dirs': [os.path.join('include', 'GL', 'internal')], + } + + super(EB_Mesa, self).sanity_check_step(custom_paths=custom_paths) From 1904d14bcbabe748664f74c8a5f085b9a25503d3 Mon Sep 17 00:00:00 2001 From: Kenneth Hoste Date: Sat, 21 Mar 2020 21:12:37 +0100 Subject: [PATCH 13/17] also check for libswr*.so libraries in sanity check for Mesa --- easybuild/easyblocks/m/mesa.py | 43 ++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 15 deletions(-) diff --git a/easybuild/easyblocks/m/mesa.py b/easybuild/easyblocks/m/mesa.py index 76d9df0a01..3bd2f90ee0 100644 --- a/easybuild/easyblocks/m/mesa.py +++ b/easybuild/easyblocks/m/mesa.py @@ -38,11 +38,33 @@ class EB_Mesa(MesonNinja): """Custom easyblock for building and installing Mesa.""" + def __init__(self, *args, **kwargs): + """Constructor for custom Mesa easyblock: figure out which vales to pass to swr-arches configuration option.""" + + super(EB_Mesa, self).__init__(*args, **kwargs) + + self.swr_arches = [] + + if 'swr-arches' not in self.cfg['configopts']: + # set cpu features of SWR for current architecture (only on x86_64) + if get_cpu_architecture() == X86_64: + feat_to_swrarch = { + 'avx': 'avx', + 'avx1.0': 'avx', # on macOS, AVX is indicated with 'avx1.0' rather than 'avx' + 'avx2': 'avx2', + 'avx512f': 'skx', # AVX-512 Foundation - introduced in Skylake + 'avx512er': 'knl', # AVX-512 Exponential and Reciprocal Instructions implemented in Knights Landing + } + # determine list of values to pass to swr-arches configuration option + cpu_features = get_cpu_features() + self.swr_arches = sorted([feat_to_swrarch[key] for key in feat_to_swrarch if key in cpu_features]) + def configure_step(self): """ Customise the configure options based on the processor architecture of the host (x86_64 or not, CPU features, ...) """ + arch = get_cpu_architecture() if 'gallium-drivers' not in self.cfg['configopts']: # Install appropriate Gallium drivers for current architecture @@ -51,21 +73,8 @@ def configure_step(self): elif arch == POWER: self.cfg.update('configopts', "-Dgallium-drivers='swrast'") - if 'swr-arches' not in self.cfg['configopts']: - # set cpu features of SWR for current architecture (only on x86_64) - if arch == X86_64: - feat_to_swrarch = { - 'avx': 'avx', - 'avx1.0': 'avx', # on macOS, AVX is indicated with 'avx1.0' rather than 'avx' - 'avx2': 'avx2', - 'avx512f': 'skx', # AVX-512 Foundation - introduced in Skylake - 'avx512er': 'knl', # AVX-512 Exponential and Reciprocal Instructions implemented in Knights Landing - } - # determine list of values to pass to swr-arches configuration option - cpu_features = set(get_cpu_features()) - swr_arches = [feat_to_swrarch[key] for key in feat_to_swrarch if key in cpu_features] - - self.cfg.update('configopts', '-Dswr-arches=' + ','.join(sorted(swr_arches))) + if self.swr_arches: + self.cfg.update('configopts', '-Dswr-arches=' + ','.join(self.swr_arches)) return super(EB_Mesa, self).configure_step() @@ -96,4 +105,8 @@ def sanity_check_step(self): 'dirs': [os.path.join('include', 'GL', 'internal')], } + if self.swr_arches: + swr_arch_libs = [os.path.join('lib', 'libswr%s.%s' % (a.upper(), shlib_ext)) for a in self.swr_arches] + custom_paths['files'].extend(swr_arch_libs) + super(EB_Mesa, self).sanity_check_step(custom_paths=custom_paths) From bc18448e1b3843e3ba544d01cc071f96a8363c87 Mon Sep 17 00:00:00 2001 From: Kenneth Hoste Date: Sat, 21 Mar 2020 21:43:31 +0100 Subject: [PATCH 14/17] only copy include/GL/internal if it's missing in Mesa easyblock --- easybuild/easyblocks/m/mesa.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/easybuild/easyblocks/m/mesa.py b/easybuild/easyblocks/m/mesa.py index 3bd2f90ee0..856b662e95 100644 --- a/easybuild/easyblocks/m/mesa.py +++ b/easybuild/easyblocks/m/mesa.py @@ -83,12 +83,14 @@ def install_step(self): super(EB_Mesa, self).install_step() - # also install header files located include/GL/internal/ - # we can't enable both DRI and Gallium drivers, but we can provide the DRI header file (GL/internal/dri_interface.h) - src_inc_GL_internal = os.path.join(self.start_dir, 'include', 'GL', 'internal') + # also install header files located in include/GL/internal, unless they're available already; + # we can't enable both DRI and Gallium drivers, + # but we can provide the DRI header file (GL/internal/dri_interface.h) target_inc_GL_internal = os.path.join(self.installdir, 'include', 'GL', 'internal') - copy_dir(src_inc_GL_internal, target_inc_GL_internal) - self.log.info("Copied %s to %s" % (src_inc_GL_internal, target_inc_GL_internal)) + if not os.path.exists(target_inc_GL_internal): + src_inc_GL_internal = os.path.join(self.start_dir, 'include', 'GL', 'internal') + copy_dir(src_inc_GL_internal, target_inc_GL_internal) + self.log.info("Copied %s to %s" % (src_inc_GL_internal, target_inc_GL_internal)) def sanity_check_step(self): """Custom sanity check for Mesa.""" From 3986f0f43d12ead2ead43adffd0e1db65831b49c Mon Sep 17 00:00:00 2001 From: Kenneth Hoste Date: Sat, 21 Mar 2020 21:55:07 +0100 Subject: [PATCH 15/17] appease the Hound --- easybuild/easyblocks/m/mesa.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/easybuild/easyblocks/m/mesa.py b/easybuild/easyblocks/m/mesa.py index 856b662e95..ca378152c6 100644 --- a/easybuild/easyblocks/m/mesa.py +++ b/easybuild/easyblocks/m/mesa.py @@ -102,8 +102,8 @@ def sanity_check_step(self): custom_paths = { 'files': [os.path.join('lib', 'libOSMesa.%s' % shlib_ext)] + - [os.path.join('include', 'GL', x) for x in gl_inc_files] + - [os.path.join('include', x, y) for (x, y) in gles_inc_files], + [os.path.join('include', 'GL', x) for x in gl_inc_files] + + [os.path.join('include', x, y) for (x, y) in gles_inc_files], 'dirs': [os.path.join('include', 'GL', 'internal')], } From 61f5389d74471114f1d9d43bcfb017a5c648d9ec Mon Sep 17 00:00:00 2001 From: Kenneth Hoste Date: Sun, 22 Mar 2020 11:29:45 +0100 Subject: [PATCH 16/17] use .items() to compose self.swr_arches in Mesa easyblock --- easybuild/easyblocks/m/mesa.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/easybuild/easyblocks/m/mesa.py b/easybuild/easyblocks/m/mesa.py index ca378152c6..9e5183dc77 100644 --- a/easybuild/easyblocks/m/mesa.py +++ b/easybuild/easyblocks/m/mesa.py @@ -57,7 +57,7 @@ def __init__(self, *args, **kwargs): } # determine list of values to pass to swr-arches configuration option cpu_features = get_cpu_features() - self.swr_arches = sorted([feat_to_swrarch[key] for key in feat_to_swrarch if key in cpu_features]) + self.swr_arches = sorted([swrarch for feat, swrarch in feat_to_swrarch.items() if feat in cpu_features]) def configure_step(self): """ From 4255b238f4192e166d6a99c5abba647e4aa2db11 Mon Sep 17 00:00:00 2001 From: Kenneth Hoste Date: Mon, 23 Mar 2020 11:29:58 +0100 Subject: [PATCH 17/17] make Mesa sanity check compatible with Mesa 20.x --- easybuild/easyblocks/m/mesa.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/easybuild/easyblocks/m/mesa.py b/easybuild/easyblocks/m/mesa.py index 9e5183dc77..cf8f299469 100644 --- a/easybuild/easyblocks/m/mesa.py +++ b/easybuild/easyblocks/m/mesa.py @@ -29,6 +29,7 @@ @author: Kenneth Hoste (HPC-UGent) """ import os +from distutils.version import LooseVersion from easybuild.easyblocks.generic.mesonninja import MesonNinja from easybuild.tools.filetools import copy_dir @@ -97,13 +98,20 @@ def sanity_check_step(self): shlib_ext = get_shared_lib_ext() - gl_inc_files = ['glext.h', 'gl_mangle.h', 'glx.h', 'osmesa.h', 'gl.h', 'glxext.h', 'glx_mangle.h'] - gles_inc_files = [('GLES', 'gl.h'), ('GLES2', 'gl2.h'), ('GLES3', 'gl3.h')] + if LooseVersion(self.version) >= LooseVersion('20.0'): + header_files = [os.path.join('include', 'EGL', x) for x in ['eglmesaext.h', 'eglextchromium.h']] + header_files.extend([ + os.path.join('include', 'GL', 'osmesa.h'), + os.path.join('include', 'GL', 'internal', 'dri_interface.h'), + ]) + else: + gl_inc_files = ['glext.h', 'gl_mangle.h', 'glx.h', 'osmesa.h', 'gl.h', 'glxext.h', 'glx_mangle.h'] + gles_inc_files = [('GLES', 'gl.h'), ('GLES2', 'gl2.h'), ('GLES3', 'gl3.h')] + header_files = [os.path.join('include', 'GL', x) for x in gl_inc_files] + header_files.extend([os.path.join('include', x, y) for (x, y) in gles_inc_files]) custom_paths = { - 'files': [os.path.join('lib', 'libOSMesa.%s' % shlib_ext)] + - [os.path.join('include', 'GL', x) for x in gl_inc_files] + - [os.path.join('include', x, y) for (x, y) in gles_inc_files], + 'files': [os.path.join('lib', 'libOSMesa.%s' % shlib_ext)] + header_files, 'dirs': [os.path.join('include', 'GL', 'internal')], }