How to use the hpccm.common.linux_distro.CENTOS 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_distro_centos7(self):
        """Base image Linux distribution specification"""
        b = baseimage(image='foo', _distro='centos7')
        self.assertEqual(hpccm.config.g_linux_distro, linux_distro.CENTOS)
        self.assertEqual(hpccm.config.g_linux_version, StrictVersion('7.0'))
github NVIDIA / hpc-container-maker / hpccm / building_blocks / boost.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 = ['bzip2', 'libbz2-dev', 'tar', 'wget',
                                     'zlib1g-dev']
        elif hpccm.config.g_linux_distro == linux_distro.CENTOS:
            if not self.__ospackages:
                self.__ospackages = ['bzip2', 'bzip2-devel', 'tar', 'wget',
                                     'which', 'zlib-devel']
        else: # pragma: no cover
            raise RuntimeError('Unknown Linux distribution')
github NVIDIA / hpc-container-maker / hpccm / config.py View on Github external
know what you are doing.

  # Arguments

  distro (string): Valid values are `centos7`, `centos8`, `rhel7`,
  `rhel8`, `ubuntu16`, and `ubuntu18`.  `ubuntu` is an alias for
  `ubuntu16`, `centos` is an alias for `centos7`, and `rhel` is an
  alias for `rhel7`.

  """
  this = sys.modules[__name__]
  if distro == 'centos':
    this.g_linux_distro = linux_distro.CENTOS
    this.g_linux_version = StrictVersion('7.0')
  elif distro == 'centos7':
    this.g_linux_distro = linux_distro.CENTOS
    this.g_linux_version = StrictVersion('7.0')
  elif distro == 'centos8':
    this.g_linux_distro = linux_distro.CENTOS
    this.g_linux_version = StrictVersion('8.0')
  elif distro == 'rhel':
    this.g_linux_distro = linux_distro.RHEL
    this.g_linux_version = StrictVersion('7.0')
  elif distro == 'rhel7':
    this.g_linux_distro = linux_distro.RHEL
    this.g_linux_version = StrictVersion('7.0')
  elif distro == 'rhel8':
    this.g_linux_distro = linux_distro.RHEL
    this.g_linux_version = StrictVersion('8.0')
  elif distro == 'ubuntu':
    this.g_linux_distro = linux_distro.UBUNTU
    this.g_linux_version = StrictVersion('16.04')
github NVIDIA / hpc-container-maker / hpccm / building_blocks / nsight_systems.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', 'wget']

            if hpccm.config.g_linux_version >= StrictVersion('18.0'):
                self.__distro_label = 'ubuntu1804'
            else:
                self.__distro_label = 'ubuntu1604'

        elif hpccm.config.g_linux_distro == linux_distro.CENTOS:
            if hpccm.config.g_linux_version >= StrictVersion('8.0'):
                self.__distro_label = 'rhel8'
            else:
                self.__distro_label = 'rhel7'

        else: # pragma: no cover
            raise RuntimeError('Unknown Linux distribution')
github NVIDIA / hpc-container-maker / hpccm / building_blocks / nv_hpc_sdk.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 = ['gcc', 'g++', 'gfortran', 'libnuma1']
                if self.__mpi:
                    self.__ospackages.append('openssh-client')
            self.__runtime_ospackages = ['libatomic1', 'libnuma1']
            if self.__mpi:
                self.__runtime_ospackages.append('openssh-client')
        elif hpccm.config.g_linux_distro == linux_distro.CENTOS:
            if not self.__ospackages:
                self.__ospackages = ['gcc', 'gcc-c++', 'gcc-gfortran',
                                     'numactl-libs']
                if self.__mpi:
                    self.__ospackages.append('openssh-clients')
            self.__runtime_ospackages = ['libatomic', 'numactl-libs']
            if self.__mpi:
                self.__runtime_ospackages.append('openssh-clients')
        else: # pragma: no cover
            raise RuntimeError('Unknown Linux distribution')
github NVIDIA / hpc-container-maker / hpccm / building_blocks / multi_ofed.py View on Github external
def __distro(self):
        if hpccm.config.g_linux_distro == linux_distro.UBUNTU:
            if not self.__ospackages:
                self.__ospackages = ['libnl-3-200', 'libnl-route-3-200',
                                     'libnuma1']
        elif hpccm.config.g_linux_distro == linux_distro.CENTOS:
            if not self.__ospackages:
                if hpccm.config.g_linux_version >= StrictVersion('8.0'):
                    self.__ospackages = ['libnl3', 'numactl-libs']
                else:
                    self.__ospackages = ['libnl', 'libnl3', 'numactl-libs']
        else: # pragma: no cover
            raise RuntimeError('Unknown Linux distribution')
github NVIDIA / hpc-container-maker / hpccm / building_blocks / intel_psxe.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 = ['build-essential', 'cpio']
            self.__bashrc = '/etc/bash.bashrc'
        elif hpccm.config.g_linux_distro == linux_distro.CENTOS:
            if not self.__ospackages:
                self.__ospackages = ['gcc', 'gcc-c++', 'make', 'which']
            self.__bashrc = '/etc/bashrc'
        else: # pragma: no cover
            raise RuntimeError('Unknown Linux distribution')
github NVIDIA / hpc-container-maker / hpccm / building_blocks / catalyst.py View on Github external
"""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 = ['git', 'gzip', 'make', 'tar', 'wget']
                if 'Rendering' in self.__edition:
                    self.__ospackages.extend([
                        'libxau-dev', 'libxext-dev', 'libxt-dev',
                        'libice-dev', 'libsm-dev', 'libx11-dev',
                        'libgl1-mesa-dev'])
            if 'Rendering' in self.__edition:
                self.__runtime_ospackages.extend([
                    'libxau6', 'libxext6', 'libxt6', 'libice6', 'libsm6',
                    'libx11-6', 'libgl1-mesa-glx'])
        elif hpccm.config.g_linux_distro == linux_distro.CENTOS:
            if not self.__ospackages:
                self.__ospackages = ['git', 'gzip', 'make', 'tar', 'wget',
                                     'which']
                if 'Rendering' in self.__edition:
                    self.__ospackages.extend([
                        'libX11-devel', 'libXau-devel', 'libXext-devel',
                        'libXt-devel', 'libICE-devel', 'libSM-devel',
                        'libglvnd-devel', 'mesa-libGL-devel'])
            if 'Rendering' in self.__edition:
                self.__runtime_ospackages.extend([
                    'libX11', 'libXau', 'libXext', 'libXt', 'libICE', 'libSM',
                    'libglvnd', 'libglvnd-opengl', 'mesa-libGL'])
        else: # pragma: no cover
            raise RuntimeError('Unknown Linux distribution')
github NVIDIA / hpc-container-maker / hpccm / building_blocks / cmake.py View on Github external
"""Build from source"""

        # The download URL has the format contains vMAJOR.MINOR in the
        # path and the tarball contains MAJOR.MINOR.REVISION, so pull
        # apart the full version to get the MAJOR and MINOR
        # components.
        match = re.match(r'(?P\d+)\.(?P\d+)', self.__version)
        major_minor = '{0}.{1}'.format(match.groupdict()['major'],
                                       match.groupdict()['minor'])
        tarball = 'cmake-{}.tar.gz'.format(self.__version)
        url = '{0}/v{1}/{2}'.format(self.__baseurl, major_minor, tarball)

        # Include SSL packages
        if hpccm.config.g_linux_distro == linux_distro.UBUNTU:
            self.__ospackages.append('libssl-dev')
        elif hpccm.config.g_linux_distro == linux_distro.CENTOS:
            self.__ospackages.append('openssl-devel')
        else: # pragma: no cover
            raise RuntimeError('Unknown Linux distribution')

        # Download source from web
        self.__commands.append(self.download_step(url=url, directory=self.__wd))
        self.__commands.append(self.untar_step(
            tarball=posixpath.join(self.__wd, tarball), directory=self.__wd))

        # Build and install
        if not self.__bootstrap_opts:
            self.__bootstrap_opts.append(
                '--parallel={}'.format(self.__parallel))
        self.__commands.append('cd {} && ./bootstrap --prefix={} {}'.format(
            posixpath.join(self.__wd, 'cmake-{}'.format(self.__version)),
            self.__prefix,
github NVIDIA / hpc-container-maker / hpccm / building_blocks / yum.py View on Github external
self.__download_args = kwargs.get('download_args', '')
        self.__download_directory = kwargs.get('download_directory',
                                               '/var/tmp/yum_download')
        self.__epel = kwargs.get('epel', False)
        self.__extra_opts = kwargs.get('extra_opts', [])
        self.__extract = kwargs.get('extract', None)
        self.__keys = kwargs.get('keys', [])
        self.__opts = ['-y']
        self.ospackages = kwargs.get('ospackages', [])
        self.__powertools = kwargs.get('powertools', False)
        self.__release_stream = kwargs.get('release_stream', False)
        self.__repositories = kwargs.get('repositories', [])
        self.__scl = kwargs.get('scl', False)
        self.__yum4 = kwargs.get('yum4', False)

        if hpccm.config.g_linux_distro != linux_distro.CENTOS: # pragma: no cover
            logging.warning('Using yum on a non-RHEL based Linux distribution')

        # Set the CPU architecture specific parameters
        self.__cpu_arch()

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

        # Fill in container instructions
        self.__instructions()