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

enhance cuDNN and CUDA easyblocks to support aarch64 #2356

Merged
merged 8 commits into from
Apr 6, 2021
37 changes: 26 additions & 11 deletions easybuild/easyblocks/c/cuda.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,26 @@
##
# This file is an EasyBuild reciPY as per https://github.com/easybuilders/easybuild
# Copyright 2012-2021 Ghent University
#
# Copyright:: Copyright 2012-2019 Cyprus Institute / CaSToRC, Uni.Lu, NTUA, Ghent University,
# Forschungszentrum Juelich GmbH
# Authors:: George Tsouloupas <g.tsouloupas@cyi.ac.cy>, Fotis Georgatos <fotis@cern.ch>, Kenneth Hoste, Damian Alvarez
# License:: MIT/GPL
# $Id$
# 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).
#
# This work implements a part of the HPCBIOS project and is a component of the policy:
# http://hpcbios.readthedocs.org/en/latest/HPCBIOS_2012-99.html
# 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 CUDA, implemented as an easyblock
Expand All @@ -20,6 +32,7 @@
@author: Kenneth Hoste (Ghent University)
@author: Damian Alvarez (Forschungszentrum Juelich)
@author: Ward Poelmans (Free University of Brussels)
@author: Robert Mijakovic (LuxProvide S.A.)
"""
import os
import stat
Expand All @@ -32,7 +45,7 @@
from easybuild.tools.filetools import adjust_permissions, patch_perl_script_autoflush
from easybuild.tools.filetools import remove_file, which, write_file
from easybuild.tools.run import run_cmd, run_cmd_qa
from easybuild.tools.systemtools import POWER, X86_64, get_cpu_architecture, get_shared_lib_ext
from easybuild.tools.systemtools import AARCH64, POWER, X86_64, get_cpu_architecture, get_shared_lib_ext

# Wrapper script definition
WRAPPER_TEMPLATE = """#!/bin/sh
Expand Down Expand Up @@ -62,10 +75,12 @@ def extra_options():
def __init__(self, *args, **kwargs):
""" Init the cuda easyblock adding a new cudaarch template var """
myarch = get_cpu_architecture()
if myarch == X86_64:
cudaarch = ''
if myarch == AARCH64:
cudaarch = '_sbsa'
elif myarch == POWER:
cudaarch = '_ppc64le'
elif myarch == X86_64:
cudaarch = ''
else:
raise EasyBuildError("Architecture %s is not supported for CUDA on EasyBuild", myarch)

Expand Down
36 changes: 26 additions & 10 deletions easybuild/easyblocks/c/cudnn.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,36 @@
##
# This file is an EasyBuild reciPY as per https://github.com/easybuilders/easybuild
# Copyright 2012-2021 Ghent University
#
# Copyright:: Copyright 2012-2019 Uni.Lu/LCSB, NTUA
# Authors:: Simon Branford
# License:: MIT/GPL
# $Id$
# 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).
#
# This work implements a part of the HPCBIOS project and is a component of the policy:
# http://hpcbios.readthedocs.org/en/latest/
# 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 cuDNN, implemented as an easyblock

@author: Simon Branford (University of Birmingham)
@author: Robert Mijakovic (LuxProvide)
"""
from easybuild.easyblocks.generic.tarball import Tarball
from easybuild.tools.build_log import EasyBuildError
from easybuild.tools.systemtools import POWER, X86_64, get_cpu_architecture
from easybuild.tools.systemtools import AARCH64, POWER, X86_64, get_cpu_architecture


class EB_cuDNN(Tarball):
Expand All @@ -25,10 +39,12 @@ class EB_cuDNN(Tarball):
def __init__(self, *args, **kwargs):
""" Init the cuDNN easyblock adding a new cudnnarch template var """
myarch = get_cpu_architecture()
if myarch == X86_64:
cudnnarch = 'x64'
if myarch == AARCH64:
cudnnarch = 'aarch64sbsa'
elif myarch == POWER:
cudnnarch = 'ppc64le'
elif myarch == X86_64:
cudnnarch = 'x64'
else:
raise EasyBuildError("Architecture %s is not supported for cuDNN on EasyBuild", myarch)

Expand Down