Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change options based on arch for Mesa #1892

Merged
merged 20 commits into from
Mar 23, 2020
Merged
Changes from 8 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions easybuild/easyblocks/m/mesa.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
##
# 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 <http://www.gnu.org/licenses/>.
##
"""
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, get_cpu_features


class EB_Mesa(MesonNinja):
def configure_step(self, cmd_prefix=''):
edmondac marked this conversation as resolved.
Show resolved Hide resolved
"""
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'")
edmondac marked this conversation as resolved.
Show resolved Hide resolved

features = set(get_cpu_features())
arches = []
if 'avx' in features:
edmondac marked this conversation as resolved.
Show resolved Hide resolved
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)