How to use the hpccm.config.g_linux_distro function in hpccm

To help you get started, we’ve selected a few hpccm examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github NVIDIA / hpc-container-maker / test / test_baseimage.py View on Github external
def test_detect_ubuntu(self):
        """Base image Linux distribution detection"""
        b = baseimage(image='ubuntu:sixteen')
        self.assertEqual(hpccm.config.g_linux_distro, linux_distro.UBUNTU)
        self.assertEqual(hpccm.config.g_linux_version, StrictVersion('16.04'))
github NVIDIA / hpc-container-maker / hpccm / building_blocks / mpich.py View on Github external
def __distro(self):
        """Based on the Linux distribution, set values accordingly.  A user
        specified value overrides any defaults."""

        if hpccm.config.g_linux_distro == linux_distro.UBUNTU:
            if not self.__ospackages:
                self.__ospackages = ['file', 'gzip', 'make', 'openssh-client',
                                     'perl', 'tar', 'wget']
            self.__runtime_ospackages = ['openssh-client']
        elif hpccm.config.g_linux_distro == linux_distro.CENTOS:
            if not self.__ospackages:
                self.__ospackages = ['file', 'gzip', 'make',
                                     'openssh-clients', 'perl', 'tar', 'wget']
            self.__runtime_ospackages = ['openssh-clients']
        else: # pragma: no cover
            raise RuntimeError('Unknown Linux distribution')
github NVIDIA / hpc-container-maker / hpccm / building_blocks / pnetcdf.py View on Github external
def __distro(self):
        """Based on the Linux distribution, set values accordingly.  A user
        specified value overrides any defaults."""

        if hpccm.config.g_linux_distro == linux_distro.UBUNTU:
            self.__runtime_ospackages = ['libatomic1']
        elif hpccm.config.g_linux_distro == linux_distro.CENTOS:
            pass
        else: # pragma: no cover
            raise RuntimeError('Unknown Linux distribution')
github NVIDIA / hpc-container-maker / hpccm / building_blocks / intel_mpi.py View on Github external
def __distro(self):
        """Based on the Linux distribution, set values accordingly.  A user
        specified value overrides any defaults."""

        if hpccm.config.g_linux_distro == linux_distro.UBUNTU:
            if not self.__ospackages:
                self.__ospackages = ['apt-transport-https', 'ca-certificates',
                                     'gnupg', 'man-db', 'openssh-client',
                                     'wget']

            self.__bashrc = '/etc/bash.bashrc'

        elif hpccm.config.g_linux_distro == linux_distro.CENTOS:
            if not self.__ospackages:
                self.__ospackages = ['man-db', 'openssh-clients']

            self.__bashrc = '/etc/bashrc'

        else: # pragma: no cover
            raise RuntimeError('Unknown Linux distribution')
github NVIDIA / hpc-container-maker / hpccm / building_blocks / apt_get.py View on Github external
super(apt_get, self).__init__()

        self.__aptitude = kwargs.get('aptitude', False)
        self.__commands = []
        self.__download = kwargs.get('download', False)
        self.__download_directory = kwargs.get('download_directory',
                                               '/var/tmp/apt_get_download')
        self.__extra_opts = kwargs.get('extra_opts', [])
        self.__extract = kwargs.get('extract', None)
        self.__keys = kwargs.get('keys', [])
        self.__opts = ['-y', '--no-install-recommends']
        self.ospackages = kwargs.get('ospackages', [])
        self.__ppas = kwargs.get('ppas', [])
        self.__repositories = kwargs.get('repositories', [])

        if hpccm.config.g_linux_distro != linux_distro.UBUNTU: # pragma: no cover
            logging.warning('Using apt-get on a non-Ubuntu Linux distribution')

        # Construct the series of commands that form the building
        # block
        self.__setup()

        # Fill in container instructions
        self.__instructions()
github NVIDIA / hpc-container-maker / hpccm / building_blocks / netcdf.py View on Github external
def __distro(self):
        """Based on the Linux distribution, set values accordingly.  A user
        specified value overrides any defaults."""

        if hpccm.config.g_linux_distro == linux_distro.UBUNTU:
            if not self.__ospackages:
                self.__ospackages = ['ca-certificates', 'file',
                                     'libcurl4-openssl-dev', 'm4', 'make',
                                     'wget', 'zlib1g-dev']
            self.__runtime_ospackages = ['zlib1g']
        elif hpccm.config.g_linux_distro == linux_distro.CENTOS:
            if not self.__ospackages:
                self.__ospackages = ['ca-certificates', 'file',
                                     'libcurl-devel', 'm4', 'make',
                                     'wget', 'zlib-devel']
                if self.__check:
                    self.__ospackages.append('diffutils')
            self.__runtime_ospackages = ['zlib']
        else: # pragma: no cover
            raise RuntimeError('Unknown Linux distribution')
github NVIDIA / hpc-container-maker / hpccm / building_blocks / gnu.py View on Github external
# Setup the environment so that the alternate compiler version
            # is the new default
            alternatives = {}
            if hpccm.config.g_linux_distro == linux_distro.UBUNTU:
                if self.__cc:
                    alternatives['gcc'] = '$(which gcc-{})'.format(
                        self.__version)
                if self.__cxx:
                    alternatives['g++'] = '$(which g++-{})'.format(
                        self.__version)
                if self.__fortran:
                    alternatives['gfortran'] = '$(which gfortran-{})'.format(
                        self.__version)
                alternatives['gcov'] = '$(which gcov-{})'.format(
                    self.__version)
            elif hpccm.config.g_linux_distro == linux_distro.CENTOS:
                # Default for CentOS 7
                toolset_path = '/opt/rh/devtoolset-{}/root/usr/bin'.format(
                    self.__version)
                if hpccm.config.g_linux_version >= StrictVersion('8.0'):
                    # CentOS 8
                    toolset_path = '/opt/rh/gcc-toolset-{}/root/usr/bin'.format(self.__version)

                if self.__cc:
                    alternatives['gcc'] = posixpath.join(toolset_path, 'gcc')
                if self.__cxx:
                    alternatives['g++'] = posixpath.join(toolset_path, 'g++')
                if self.__fortran:
                    alternatives['gfortran'] = posixpath.join(toolset_path,
                                                              'gfortran')
                alternatives['gcov'] = posixpath.join(toolset_path, 'gcov')
github NVIDIA / hpc-container-maker / hpccm / building_blocks / ucx.py View on Github external
if hpccm.config.g_linux_distro == linux_distro.UBUNTU:
            if not self.__ospackages:
                self.__ospackages = ['binutils-dev', 'file', 'libnuma-dev',
                                     'make', 'wget']

                if self.repository:
                    self.__ospackages.extend(['autoconf', 'automake',
                                              'ca-certificates', 'git',
                                              'libtool'])

            if hpccm.config.g_linux_version >= StrictVersion('18.0'):
                self.__runtime_ospackages = ['libbinutils']
            else:
                self.__runtime_ospackages = ['binutils']
        elif hpccm.config.g_linux_distro == linux_distro.CENTOS:
            if not self.__ospackages:
                self.__ospackages = ['binutils-devel', 'file', 'make',
                                     'numactl-devel', 'wget']

                if self.repository:
                    self.__ospackages.extend(['autoconf', 'automake',
                                              'ca-certificates', 'git',
                                              'libtool'])

            self.__runtime_ospackages = ['binutils']
        else: # pragma: no cover
            raise RuntimeError('Unknown Linux distribution')
github NVIDIA / hpc-container-maker / hpccm / building_blocks / kokkos.py View on Github external
def __distro(self):
        """Based on the Linux distribution, set values accordingly.  A user
        specified value overrides any defaults."""

        if hpccm.config.g_linux_distro == linux_distro.UBUNTU:
            if not self.__ospackages:
                self.__ospackages = ['libhwloc-dev', 'make']

        elif hpccm.config.g_linux_distro == linux_distro.CENTOS:
            if not self.__ospackages:
                self.__ospackages = ['hwloc-devel', 'make']

            if hpccm.config.g_linux_version >= StrictVersion('8.0'):
                # hwloc-devel is in the CentOS powertools repository
                self.__powertools = True
        else: # pragma: no cover
            raise RuntimeError('Unknown Linux distribution')

        if self.repository:
            self.__ospackages.extend(['ca-certificates', 'git'])
        else:
            self.__ospackages.extend(['gzip', 'tar', 'wget'])