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_detect_ppc64le(self):
"""Base image CPU architecture detection"""
b = baseimage(image='ppc64le/centos:7')
self.assertEqual(hpccm.config.g_cpu_arch, cpu_arch.PPC64LE)
self.__icc = kwargs.get('icc', True)
self.__ifort = kwargs.get('ifort', True)
self.__ipp = kwargs.get('ipp', True)
self.__mkl = kwargs.get('mkl', True)
self.__mpi = kwargs.get('mpi', True)
self.__psxevars = kwargs.get('psxevars', True)
self.__ospackages = kwargs.get('ospackages', [])
self.__tbb = kwargs.get('tbb', True)
self.__version = kwargs.get('version', '2020.1-12')
self.__year = self.__version.split('.')[0]
self.__bashrc = '' # Filled in by __distro()
self.__apt = [] # Filled in by __setup()
self.__yum = [] # Filled in by __setup()
if hpccm.config.g_cpu_arch != cpu_arch.X86_64: # pragma: no cover
logging.warning('Using intel_psxe_runtime on a non-x86_64 processor')
# Set the Linux distribution specific parameters
self.__distro()
# Construct the list of runtime packages to install
self.__setup()
# Fill in container instructions
self.__instructions()
def __cpu_arch(self):
"""Based on the CPU architecture, set values accordingly. A user
specified value overrides any defaults."""
if hpccm.config.g_cpu_arch == cpu_arch.AARCH64:
# Bug in the VisIt build config
self.__arch = 'linux-intel'
elif hpccm.config.g_cpu_arch == cpu_arch.X86_64:
self.__arch = 'linux-x86_64'
else: # pragma: no cover
raise RuntimeError('Unknown CPU architecture')
def __cpu_arch(self):
"""Based on the CPU architecture, set values accordingly. A user
specified value overrides any defaults."""
if hpccm.config.g_cpu_arch == cpu_arch.AARCH64:
self.__arch_directory = 'aarch64'
self.__arch_pkg = 'aarch64'
elif hpccm.config.g_cpu_arch == cpu_arch.X86_64:
self.__arch_directory = 'x64'
self.__arch_pkg = 'x86_64'
else: # pragma: no cover
raise RuntimeError('Unknown CPU architecture')
def __make(self):
"""Based on the CPU architecture, set values accordingly. A user
specified value overrides any defaults."""
if not self.__make_opts:
if self.__toolchain.CC:
self.__make_opts.append('CC={}'.format(self.__toolchain.CC))
if self.__toolchain.FC:
self.__make_opts.append('FC={}'.format(self.__toolchain.FC))
if hpccm.config.g_cpu_arch == cpu_arch.AARCH64:
self.__make_opts.extend(['TARGET=ARMV8', 'USE_OPENMP=1'])
elif hpccm.config.g_cpu_arch == cpu_arch.PPC64LE:
self.__make_opts.extend(['TARGET=POWER8', 'USE_OPENMP=1'])
elif hpccm.config.g_cpu_arch == cpu_arch.X86_64:
self.__make_opts.extend(['USE_OPENMP=1'])
else: # pragma: no cover
raise RuntimeError('Unknown CPU architecture')
def __cpu_arch(self):
"""Based on the CPU architecture, set values accordingly. A user
specified value overrides any defaults."""
if hpccm.config.g_cpu_arch == cpu_arch.AARCH64:
self.__arch_directory = 'aarch64'
self.__arch_pkg = 'aarch64'
elif hpccm.config.g_cpu_arch == cpu_arch.X86_64:
self.__arch_directory = 'x64'
self.__arch_pkg = 'x86_64'
else: # pragma: no cover
raise RuntimeError('Unknown CPU architecture')
'libdapl2', 'libdapl-dev',
'libibcm1', 'libibcm-dev',
'libibmad5', 'libibmad-dev',
'libibverbs1', 'libibverbs-dev',
'libmlx4-1', 'libmlx4-dev',
'libmlx5-1', 'libmlx5-dev',
'librdmacm1', 'librdmacm-dev',
'rdmacm-utils']
if hpccm.config.g_cpu_arch == cpu_arch.AARCH64:
# Ubuntu 16.04 for ARM is missing these packages
for missing in ['dapl2-utils', 'libdapl2', 'libdapl-dev',
'libibcm1', 'libibcm-dev']:
if missing in self.__ospackages:
self.__ospackages.remove(missing)
elif hpccm.config.g_cpu_arch == cpu_arch.PPC64LE:
# Ubuntu 16.04 for Power is missing these packages
for missing in ['libibcm1', 'libibcm-dev']:
if missing in self.__ospackages:
self.__ospackages.remove(missing)
elif hpccm.config.g_linux_distro == linux_distro.CENTOS:
self.__extra_opts = [r'--disablerepo=mlnx\*']
if hpccm.config.g_linux_version >= StrictVersion('8.0'):
self.__deppackages = ['libnl3', 'numactl-libs']
self.__ospackages = ['libibmad', 'libibmad-devel',
'libibumad', 'libibverbs',
'libibverbs-utils', 'libmlx5',
'librdmacm',
'rdma-core', 'rdma-core-devel']
self.__powertools = True
else:
def __cpu_arch(self):
"""Based on the CPU architecture, set values accordingly. A user
specified value overrides any defaults."""
if hpccm.config.g_cpu_arch == cpu_arch.AARCH64:
if not self.__target_architecture:
self.__target_architecture = 'multicore-arm8'
elif hpccm.config.g_cpu_arch == cpu_arch.PPC64LE:
if not self.__target_architecture:
self.__target_architecture = 'multicore-linux-ppc64le'
elif hpccm.config.g_cpu_arch == cpu_arch.X86_64:
if not self.__target_architecture:
self.__target_architecture = 'multicore-linux-x86_64'
else: # pragma: no cover
raise RuntimeError('Unknown CPU architecture')