Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_build_environment_and_toolchain(self):
"""build environment and toolchain"""
tc = toolchain(CC='gcc', CXX='g++', FC='gfortran')
g = generic_cmake(
build_environment={'FOO': 'BAR'},
check=True,
cmake_opts=['-D CMAKE_BUILD_TYPE=Release',
'-D CUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda',
'-D GMX_BUILD_OWN_FFTW=ON',
'-D GMX_GPU=ON',
'-D GMX_MPI=OFF',
'-D GMX_OPENMP=ON',
'-D GMX_PREFER_STATIC_LIBS=ON',
'-D MPIEXEC_PREFLAGS=--allow-run-as-root',
'-D REGRESSIONTEST_DOWNLOAD=ON'],
directory='gromacs-2018.2',
prefix='/usr/local/gromacs',
toolchain=tc,
url='https://github.com/gromacs/gromacs/archive/v2018.2.tar.gz')
def test_toolchain(self):
"""Toolchain specified"""
cm = CMakeBuild()
tc = toolchain(CC='mycc', CXX='mycxx', FC='myfc', F77='myf77',
F90='myf90', CFLAGS='-g -O3', CPPFLAGS='-DFOO -DBAR',
CXXFLAGS='-g -O3', FCFLAGS='-g -O3', FFLAGS='-g -O3',
FLIBS='-ldl',
LD_LIBRARY_PATH='/opt/mysw/lib:/opt/yoursw/lib',
LDFLAGS='-Wl,--start-group foo.o bar.o -Wl,--endgroup',
LIBS='-ldl -lpthread')
configure = cm.configure_step(directory='/tmp/src', toolchain=tc)
self.assertEqual(configure,
'''mkdir -p /tmp/src/build && cd /tmp/src/build && CC=mycc CFLAGS='-g -O3' CPPFLAGS='-DFOO -DBAR' CXX=mycxx CXXFLAGS='-g -O3' F77=myf77 F90=myf90 FC=myfc FCFLAGS='-g -O3' FFLAGS='-g -O3' FLIBS=-ldl LD_LIBRARY_PATH=/opt/mysw/lib:/opt/yoursw/lib LDFLAGS='-Wl,--start-group foo.o bar.o -Wl,--endgroup' LIBS='-ldl -lpthread' cmake -DCMAKE_INSTALL_PREFIX=/usr/local /tmp/src''')
def __init__(self, **kwargs):
"""Initialize building block"""
super(mpich, self).__init__(**kwargs)
self.__baseurl = kwargs.pop('baseurl',
'https://www.mpich.org/static/downloads')
self.__check = kwargs.pop('check', False)
self.__configure_opts = kwargs.pop('configure_opts', [])
self.__ospackages = kwargs.pop('ospackages', [])
self.__prefix = kwargs.pop('prefix', '/usr/local/mpich')
self.__runtime_ospackages = [] # Filled in by __distro()
# Input toolchain, i.e., what to use when building
self.__toolchain = kwargs.pop('toolchain', toolchain())
self.__version = kwargs.pop('version', '3.3.2')
# Output toolchain
self.toolchain = toolchain(CC='mpicc', CXX='mpicxx', F77='mpif77',
F90='mpif90', FC='mpifort')
# Set the configuration options
self.__configure()
# Set the Linux distribution specific parameters
self.__distro()
# Set the environment variables
self.environment_variables['PATH'] = '{}:$PATH'.format(
posixpath.join(self.__prefix, 'bin'))
if not self.ldconfig:
self.__build_environment = kwargs.get('build_environment', {})
self.__check = kwargs.get('check', False)
self.__comment = kwargs.get('comment', True)
self.configure_opts = kwargs.get('configure_opts', [])
self.__directory = kwargs.get('directory', None)
self.environment_variables = kwargs.get('devel_environment', {})
self.__install = kwargs.get('install', True)
self.__libdir = kwargs.get('libdir', 'lib')
self.__make = kwargs.get('make', True)
self.__postconfigure = kwargs.get('postconfigure', [])
self.__postinstall = kwargs.get('postinstall', [])
self.__preconfigure = kwargs.get('preconfigure', [])
self.__recursive = kwargs.get('recursive', False)
self.__run_arguments = kwargs.get('_run_arguments', None)
self.runtime_environment_variables = kwargs.get('runtime_environment', {})
self.__toolchain = kwargs.get('toolchain', toolchain())
self.__commands = [] # Filled in by __setup()
self.__wd = '/var/tmp' # working directory
# Construct the series of steps to execute
self.__setup()
# Fill in container instructions
self.__instructions()
self.__configure_opts = kwargs.pop('configure_opts',
['--enable-optimizations',
'--disable-logging',
'--disable-debug',
'--disable-assertions',
'--disable-params-check',
'--disable-doxygen-doc'])
self.__cuda = kwargs.pop('cuda', True)
self.__default_repository = 'https://github.com/openucx/ucx.git'
self.__gdrcopy = kwargs.pop('gdrcopy', '')
self.__knem = kwargs.pop('knem', '')
self.__ofed = kwargs.pop('ofed', '')
self.__ospackages = kwargs.pop('ospackages', [])
self.__prefix = kwargs.pop('prefix', '/usr/local/ucx')
self.__runtime_ospackages = [] # Filled in by __distro()
self.__toolchain = kwargs.pop('toolchain', toolchain())
self.__version = kwargs.pop('version', '1.8.0')
self.__xpmem = kwargs.pop('xpmem', '')
# Set the configure options
self.__configure()
# Set the Linux distribution specific parameters
self.__distro()
# Set the download specific parameters
self.__download()
kwargs['repository'] = self.repository
kwargs['url'] = self.url
# Setup the environment variables
self.environment_variables['CPATH'] = '{}:$CPATH'.format(
def __init__(self, **kwargs):
"""Initialize building block"""
super(mvapich2, self).__init__(**kwargs)
self.__baseurl = kwargs.pop('baseurl',
'http://mvapich.cse.ohio-state.edu/download/mvapich/mv2')
self.__configure_opts = kwargs.pop('configure_opts', ['--disable-mcast'])
self.__cuda = kwargs.pop('cuda', True)
self.__gpu_arch = kwargs.pop('gpu_arch', None)
self.__ospackages = kwargs.pop('ospackages', [])
self.__preconfigure = []
self.__prefix = kwargs.pop('prefix', '/usr/local/mvapich2')
self.__runtime_ospackages = [] # Filled in by __distro()
# Input toolchain, i.e., what to use when building
self.__toolchain = kwargs.pop('toolchain', toolchain())
self.__version = kwargs.pop('version', '2.3.3')
# MVAPICH2 does not accept F90
self.toolchain_control = {'CC': True, 'CXX': True, 'F77': True,
'F90': False, 'FC': True}
# Output toolchain
self.toolchain = toolchain(CC='mpicc', CXX='mpicxx', F77='mpif77',
F90='mpif90', FC='mpifort')
# Set the configure options
self.__configure()
# Set the Linux distribution specific parameters
self.__distro()
self.__mpi = kwargs.get('mpi', False)
self.__ospackages = kwargs.get('ospackages', [])
self.__runtime_ospackages = [] # Filled in by __distro()
self.__prefix = kwargs.get('prefix', '/opt/pgi')
self.__referer = r'https://www.pgroup.com/products/community.htm?utm_source=hpccm\&utm_medium=wgt\&utm_campaign=CE\&nvid=nv-int-14-39155'
self.__system_cuda = kwargs.get('system_cuda', False)
self.__system_libnuma = kwargs.get('system_libnuma', True)
self.__tarball = kwargs.get('tarball', '')
self.__url_template = 'https://www.pgroup.com/support/downloader.php?file=pgi-community-linux-{}'
# The version is fragile since the latest version is
# automatically downloaded, which may not match this default.
self.__version = kwargs.get('version', '19.10')
self.__wd = '/var/tmp' # working directory
self.toolchain = toolchain(CC='pgcc', CXX='pgc++', F77='pgfortran',
F90='pgfortran', FC='pgfortran')
# Set the CPU architecture specific parameters
self.__cpu_arch()
# Set the Linux distribution specific parameters
self.__distro()
self.__basepath = posixpath.join(self.__prefix, self.__arch_directory)
self.__basepath_llvm = posixpath.join(self.__prefix,
'{}-llvm'.format(
self.__arch_directory))
# Construct the series of steps to execute
self.__setup()
self.__apt_keys = [] # Filled in below
self.__apt_repositories = [] # Filled in below
self.__commands = [] # Filled in below
self.__compiler_debs = [] # Filled in below
self.__compiler_rpms = [] # Filled in below
self.__extra_repo = kwargs.get('extra_repository', False)
self.__extra_tools = kwargs.get('extra_tools', False)
self.__nightly = kwargs.get('nightly', False)
self.__ospackages = kwargs.get('ospackages', []) # Filled in below
self.__runtime_debs = [] # Filled in below
self.__runtime_ospackages = [] # Filled in below
self.__runtime_rpms = [] # Filled in below
self.__version = kwargs.get('version', None)
# Output toolchain
self.toolchain = toolchain()
self.toolchain.CC = 'clang'
self.toolchain.CXX = 'clang++'
# Set the packages to install based on the Linux distribution
# and CPU architecture
self.__setup()
# Fill in container instructions
self.__instructions()
self.__cuda_version = kwargs.get('cuda_version', '9.2')
self.__gnu = kwargs.get('gnu', True)
self.__gnu_version = kwargs.get('gnu_version', '4.8.5')
self.__install_path_template = '/opt/mvapich2/gdr/{0}/mcast/no-openacc/{1}/{2}/mpirun/{3}'
self.__mofed_version = kwargs.get('mlnx_ofed_version', '4.5')
self.__ospackages = kwargs.get('ospackages', [])
self.__package = kwargs.get('package', '')
self.__package_template = 'mvapich2-gdr-mcast.{0}.{1}.{2}-{3}-{4}.el7.{5}.rpm'
self.__pgi = kwargs.get('pgi', False)
self.__pgi_version = kwargs.get('pgi_version', '18.10')
self.__release = kwargs.get('release', '2')
self.version = kwargs.get('version', '2.3.3')
self.__wd = '/var/tmp' # working directory
# Output toolchain
self.toolchain = toolchain(CC='mpicc', CXX='mpicxx', F77='mpif77',
F90='mpif90', FC='mpifort')
# Validate compiler choice
if self.__gnu and self.__pgi and not self.__package:
logging.warning('Multiple compilers selected, using PGI')
self.__gnu = False
elif not self.__gnu and not self.__pgi:
logging.warning('No compiler selected, using GNU')
self.__gnu = True
self.__commands = [] # Filled in by __setup()
self.__install_path = '' # Filled in by __setup()
# Set the Linux distribution specific parameters
self.__distro()
# corresponding Arm Allinea Studio End User License Agreement
# https://developer.arm.com/tools-and-software/server-and-hpc/arm-architecture-tools/arm-allinea-studio/licensing/eula
self.__eula = kwargs.get('eula', False)
self.__gcc_version = kwargs.get('gcc_version', '9.2.0')
self.__installer_template = '' # Filled in by __distro()
self.__microarchitectures = kwargs.get('microarchitectures',
['generic'])
self.__ospackages = kwargs.get('ospackages', [])
self.__package_string = '' # Filled in by __distro()
self.__prefix = kwargs.get('prefix', '/opt/arm')
self.__tarball = kwargs.get('tarball', None)
self.__version = kwargs.get('version', '20.0')
self.__wd = '/var/tmp' # working directory
self.toolchain = toolchain(CC='armclang', CXX='armclang++',
F77='armflang', F90='armflang',
FC='armflang')
if hpccm.config.g_cpu_arch != cpu_arch.AARCH64: # pragma: no cover
logging.warning('Using arm_allinea_studio on a non-aarch64 processor')
if not self.__eula:
raise RuntimeError('Arm Allinea Studio EULA was not accepted. To accept, see the documentation for this building block')
# Set the Linux distribution specific parameters
self.__distro()
# Construct the series of steps to execute
self.__setup()
# Fill in container instructions