本文整理汇总了Python中easybuild.easyblocks.generic.pythonpackage.PythonPackage.sanity_check_step方法的典型用法代码示例。如果您正苦于以下问题:Python PythonPackage.sanity_check_step方法的具体用法?Python PythonPackage.sanity_check_step怎么用?Python PythonPackage.sanity_check_step使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类easybuild.easyblocks.generic.pythonpackage.PythonPackage
的用法示例。
在下文中一共展示了PythonPackage.sanity_check_step方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: sanity_check_step
# 需要导入模块: from easybuild.easyblocks.generic.pythonpackage import PythonPackage [as 别名]
# 或者: from easybuild.easyblocks.generic.pythonpackage.PythonPackage import sanity_check_step [as 别名]
def sanity_check_step(self, *args, **kwargs):
"""
Custom sanity check for Python packages
"""
return PythonPackage.sanity_check_step(self, *args, **kwargs)
示例2: EB_MXNet
# 需要导入模块: from easybuild.easyblocks.generic.pythonpackage import PythonPackage [as 别名]
# 或者: from easybuild.easyblocks.generic.pythonpackage.PythonPackage import sanity_check_step [as 别名]
#.........这里部分代码省略.........
def configure_step(self):
"""Patch 'config.mk' file to use EB stuff"""
for (var, env_var) in [('CC', 'CC'), ('CXX', 'CXX'), ('ADD_CFLAGS', 'CFLAGS'), ('ADD_LDFLAGS', 'LDFLAGS')]:
self.cfg.update('buildopts', '%s="%s"' % (var, os.getenv(env_var)))
toolchain_blas = self.toolchain.definition().get('BLAS', None)[0]
if toolchain_blas == 'imkl':
blas = "mkl"
imkl_version = get_software_version('imkl')
if LooseVersion(imkl_version) >= LooseVersion('17'):
self.cfg.update('buildopts', 'USE_MKL2017=1')
self.cfg.update('buildopts', 'MKLML_ROOT="%s"' % os.getenv("MKLROOT"))
elif toolchain_blas in ['ACML', 'ATLAS']:
blas = "atlas"
elif toolchain_blas == 'OpenBLAS':
blas = "openblas"
elif toolchain_blas is None:
raise EasyBuildError("No BLAS library found in the toolchain")
self.cfg.update('buildopts', 'USE_BLAS="%s"' % blas)
if get_software_root('NNPACK'):
self.cfg.update('buildopts', 'USE_NNPACK=1')
super(EB_MXNet, self).configure_step()
def install_step(self):
"""Specify list of files to copy"""
self.cfg['files_to_copy'] = ['bin', 'include', 'lib',
(['dmlc-core/include/dmlc', 'nnvm/include/nnvm'], 'include')]
super(EB_MXNet, self).install_step()
def extensions_step(self):
"""Build & Install both Python and R extension"""
# we start with the python bindings
self.py_ext.src = os.path.join(self.mxnet_src_dir, "python")
change_dir(self.py_ext.src)
self.py_ext.prerun()
self.py_ext.run(unpack_src=False)
self.py_ext.postrun()
# next up, the R bindings
self.r_ext.src = os.path.join(self.mxnet_src_dir, "R-package")
change_dir(self.r_ext.src)
mkdir("inst")
symlink(os.path.join(self.installdir, "lib"), os.path.join("inst", "libs"))
symlink(os.path.join(self.installdir, "include"), os.path.join("inst", "include"))
# MXNet doesn't provide a list of its R dependencies by default
write_file("NAMESPACE", R_NAMESPACE)
change_dir(self.mxnet_src_dir)
self.r_ext.prerun()
# MXNet is just weird. To install the R extension, we have to:
# - First install the extension like it is
# - Let R export the extension again. By doing this, all the dependencies get
# correctly filled and some mappings are done
# - Reinstal the exported version
self.r_ext.run()
run_cmd("R_LIBS=%s Rscript -e \"require(mxnet); mxnet:::mxnet.export(\\\"R-package\\\")\"" % self.installdir)
change_dir(self.r_ext.src)
self.r_ext.run()
self.r_ext.postrun()
def sanity_check_step(self):
"""Check for main library files for MXNet"""
custom_paths = {
'files': ['lib/libmxnet.a', 'lib/libmxnet.%s' % get_shared_lib_ext()],
'dirs': [],
}
super(EB_MXNet, self).sanity_check_step(custom_paths=custom_paths)
# for the extension we are doing the loading of the fake module ourself
try:
fake_mod_data = self.load_fake_module()
except EasyBuildError as err:
raise EasyBuildError("Loading fake module failed: %s", err)
if not self.py_ext.sanity_check_step():
raise EasyBuildError("The sanity check for the Python bindings failed")
self.r_ext.options['modulename'] = self.name.lower()
if not self.r_ext.sanity_check_step():
raise EasyBuildError("The sanity check for the R bindings failed")
self.clean_up_fake_module(fake_mod_data)
def make_module_extra(self, *args, **kwargs):
"""Custom variables for MXNet module."""
txt = super(EB_MXNet, self).make_module_extra(*args, **kwargs)
for path in self.py_ext.all_pylibdirs:
fullpath = os.path.join(self.installdir, path)
# only extend $PYTHONPATH with existing, non-empty directories
if os.path.exists(fullpath) and os.listdir(fullpath):
txt += self.module_generator.prepend_paths('PYTHONPATH', path)
txt += self.module_generator.prepend_paths("R_LIBS", ['']) # prepend R_LIBS with install path
return txt