Commit 6ba5d660 authored by Stepan Nassyr's avatar Stepan Nassyr
Browse files

Update cann_package.py and add CANN-Toolkit 5.0.4.alpha005

parent 7d38bb05
......@@ -33,7 +33,7 @@ class cann_package(Binary):
def extra_options():
"""Support for generic 'default' modules with specific real versions"""
extra_vars = {
'cann_installers': [None, "List of tuples: name, path to installation script (after extraction) and additional arguments for each package, i.e [(Ascend-acllib, acllib/scripts/install.sh, ''), ...]", CUSTOM],
'cann_installers': [None, "List of tuples: name, path to installation script (after extraction), additional arguments and whetehr --install-username and --install-usergroup are supported for each package, i.e [(Ascend-acllib, acllib/scripts/install.sh, '', True), ...]", CUSTOM],
'subdir_symlinks': [None, "List of tuples: symlinks to create, alt_suf will be replaced, i.e ('opp','opp_linux.alt_suf') would create opp_linux.arm64 -> arm64-linux/opp on an aarch64 system", CUSTOM]
}
return extra_vars
......@@ -51,6 +51,7 @@ class cann_package(Binary):
subs = [
(r'`cat /etc/passwd \| cut -f1 -d\':\' \| grep -w "(\$[^"]+)" -c`',r'$(getent passwd \1 | grep -w "\1" -c)'),
(r'\$\(cat /etc/passwd \| cut -f1 -d\':\' \| grep -w "(\$[^"]+)" -c\)',r'$(getent passwd \1 | grep -w "\1" -c)'),
(r'^(un|)chattrFiles\(\)\s*{',r'\1chattrFiles() {'+'\n'+'return'+'\n'+'}'+'\n'+r'\1chattrFiles_disabled() {'),
(r'^(function\s*|)checkEmptyUserAndGroup\(\)\s*{',r'\1checkEmptyUserAndGroup() {'+'\n'+'return'+'\n'+'}'+'\n'+r'\1checkEmptyUserAndGroup_disabled() {'),
(r'^checkInstallCondition\(\)\s*{',r'checkInstallCondition() {'+'\n'+'return'+'\n'+'}'+'\n'+r'checkInstallCondition_disabled() {'),
......@@ -112,14 +113,18 @@ class cann_package(Binary):
cann_installers = self.cfg['cann_installers']
parent_dir = os.getcwd()
common_args = " --quiet --full --install-username=$USER --install-usergroup=" + hiai_group + " --install-path=" + installdir_toolkit + ' '
common_args = " --quiet --full --install-path=" + installdir_toolkit + ' '
ug_args = " --install-usergroup="+hiai_group+" --install-username=$USER "
for package in cann_installers:
package_name = package[0]
installer_path = package[1]
custom_args = package[2]
supports_usrgrp = package[3]
os.chdir(self.package_dirs[package_name])
(out,ret) = run_cmd("/bin/sh " + installer_path + " --placeholder --placeholder " + custom_args + ' ' + common_args)
if supports_usrgrp:
custom_args += ug_args
(out,ret) = run_cmd("/bin/sh " + installer_path + " --placeholder --\"" + os.getcwd() + "\" " + custom_args + ' ' + common_args)
if 0 != ret:
raise EasyBuildError("Installing " + package_name + " failed: " + out)
os.chdir(parent_dir)
......
# Stepan Nassyr (JSC)
#easyblock = 'Binary'
easyblock = 'cann_package'
name = 'CANN-Toolkit'
version = '5.0.4.alpha005'
homepage = 'https://e.huawei.com/en/products/cloud-computing-dc/atlas/cann'
description = 'CANN (Compute Architecture for Neural Networks) is the development kit for Huaweis Atlas/Ascend AI/ML products'
versionsuffix = '-Python-%(pyver)s'
toolchain = {'name': 'goolf', 'version': '2021a.9'}
import platform as local_platform
local_arch_suf = local_platform.machine()
local_alt_suf = {
'x86_64' : 'x64',
'aarch64' : 'arm64'
}
local_arch_sums = {
'x86_64' : '916f3aea0fbad4d22bc9fe6ac2f19f8f17a73812cbc2f557e50d8b9f32d140f4',
'aarch64' : '968e537ff414bfc8cb29190d4ef939b61fbb89cfd3c18b51e2eb2de6e210aa1b',
}
sources = [{
'source_urls' : ['https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/CANN/%(version)s/'],
'filename': 'Ascend-cann-toolkit_%%(version)s_linux-%s.run' % local_arch_suf,
}]
#patches = [('cann-toolkit-getuserinfo.patch','run_package')]
checksums = [
local_arch_sums[local_arch_suf],
# '9c6e7cd4e543b0b23de1472a63c8a1b5b83f2ff60918a313ffe526c1131b71ff',
]
dependencies = [
('CMake', '3.20.0'),
('Python', '3.7.5'),
('SciPy-Stack', '2021a', versionsuffix),
]
cann_installers=[
('CANN-runtime','runtime/scripts/install.sh','',True),
('CANN-compiler','compiler/scripts/install.sh','--pylocal',False),
('CANN-opp','opp/script/install.sh','',False),
('CANN-toolkit','toolkit/scripts/install.sh','--pylocal',False),
('Ascend-mindstudio-toolkit','mindstudio-toolkit/script/install.sh','',False),
('Ascend-test-ops','script/install.sh','',True),
('Ascend-pyACL','script/install.sh','',False),
]
subdir_symlinks=[
('acllib','acllib'),
('acllib','acllib_linux.alt_suf'),
('atc','atc'),
('bin','bin'),
('compiler','compiler'),
('conf','conf'),
('fwkacllib','fwkacllib'),
('include','include'),
('lib64','lib64'),
('mindstudio-toolkit','mindstudio-toolkit'),
('opp','opp'),
('opp','opp_linux.alt_suf'),
('pyACL','pyACL'),
('python','python'),
('runtime','runtime'),
('runtime','runtime_linux.alt_suf'),
('toolkit','toolkit'),
('tools','tools'),
('var','var'),
]
sanity_check_paths = {
'files': ['ascend-toolkit/%(version)s/atc/bin/atc'],
'dirs' :['ascend-toolkit/%%(version)s/%s' % d[1] for d in subdir_symlinks] + \
['ascend-toolkit/%%(version)s/atc/%s' % d for d in ['include','lib64','bin']] + \
['ascend-toolkit/%%(version)s/acllib/%s' % d for d in ['include','lib64','bin']] + \
['ascend-toolkit/%%(version)s/fwkacllib/%s' % d for d in ['lib64','bin']] + \
['ascend-toolkit/%%(version)s/%s/python/site-packages' % d for d in ['toolkit','python','compiler']] + \
['ascend-toolkit/%(version)s/pyACL/python/site-packages/acl']
}
modextrapaths = {
'PATH' : ['ascend-toolkit/%(version)s/compiler/ccec_compiler/bin',
'ascend-toolkit/%(version)s/bin',
'ascend-toolkit/%(version)s/atc/bin',
'ascend-toolkit/%(version)s/fwkacllib/bin',
'ascend-toolkit/%(version)s/toolkit/bin',
'ascend-toolkit/%(version)s/atc/bin',
'ascend-toolkit/%(version)s/runtime/bin',
'ascend-toolkit/%(version)s/compiler/bin'],
'PYTHONPATH' : ['ascend-toolkit/%(version)s/toolkit/python/site-packages',
'ascend-toolkit/%(version)s/compiler/python/site-packages',
'ascend-toolkit/%(version)s/python/site-packages',
'ascend-toolkit/%(version)s/opp/op_impl/built-in/ai_core/tbe',
'ascend-toolkit/%(version)s/pyACL/python/site-packages/acl'],
'LD_LIBRARY_PATH' : ['ascend-toolkit/%(version)s/lib64',
'ascend-toolkit/%(version)s/fwkacllib/lib64',
'ascend-toolkit/%(version)s/atc/lib64',
'ascend-toolkit/%(version)s/runtime/lib64',
'ascend-toolkit/%(version)s/compiler/lib64/plugin/opskernel',
'ascend-toolkit/%(version)s/compiler/lib64/plugin/nnengine'],
'LIBRARY_PATH' : ['ascend-toolkit/%(version)s/lib64',
'ascend-toolkit/%(version)s/fwkacllib/lib64',
'ascend-toolkit/%(version)s/atc/lib64',
'ascend-toolkit/%(version)s/runtime/lib64'],
'CPATH' : ['ascend-toolkit/%(version)s/fwkacllib/include',
'ascend-toolkit/%(version)s/atc/include',
'ascend-toolkit/%(version)s/runtime/include',
'ascend-toolkit/%(version)s/compiler/include',
'ascend-toolkit/%(version)s/include']
}
modextravars = {
'ASCEND_AICPU_PATH' : '%(installdir)s/ascend-toolkit/%(version)s',
'ASCEND_OPP_PATH' : '%(installdir)s/ascend-toolkit/%(version)s/opp',
'TOOLCHAIN_HOME' : '%(installdir)s/ascend-toolkit/%(version)s/toolkit',
'ASCEND_AUTOML_PATH' : '%(installdir)s/ascend-toolkit/%(version)s/tools',
}
moduleclass = 'lib'
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment