示例#1
0
 def runtime(self, _from='0'):
     """Install the runtime from a full build in a previous stage"""
     instructions = []
     instructions.append(comment('PGI compiler'))
     if self.__ospackages:
         instructions.append(packages(ospackages=self.__ospackages))
     instructions.append(
         copy(_from=_from,
              src=os.path.join(self.__basepath, self.__version, 'REDIST',
                               '*.so'),
              dest=os.path.join(self.__basepath, self.__version, 'lib',
                                '')))
     instructions.append(
         shell(commands=[
             'ln -s {0} {1}'.format(
                 os.path.join(self.__basepath, self.__version, 'lib',
                              'libpgnuma.so'),
                 os.path.join(self.__basepath, self.__version, 'lib',
                              'libnuma.so'))
         ]))
     instructions.append(
         environment(
             variables={
                 'LD_LIBRARY_PATH':
                 '{}:$LD_LIBRARY_PATH'.format(
                     os.path.join(self.__basepath, self.__version, 'lib'))
             }))
     return instructions
示例#2
0
    def __str__(self):
        """String representation of the building block"""

        ospackages = list(self.__ospackages)
        # Installer needs perl
        ospackages.append('perl')

        instructions = []
        instructions.append(
            comment('PGI compiler version {}'.format(self.__version)))
        if self.__tarball:
            # Use tarball from local build context
            instructions.append(
                copy(src=self.__tarball,
                     dest=os.path.join(self.__wd, self.__tarball)))
        else:
            # Downloading, so need wget
            ospackages.append('wget')

        if ospackages:
            instructions.append(packages(ospackages=ospackages))

        instructions.append(shell(commands=self.__commands))
        instructions.append(
            environment(
                variables={
                    'PATH':
                    '{}:$PATH'.format(
                        os.path.join(self.__basepath, self.__version, 'bin')),
                    'LD_LIBRARY_PATH':
                    '{}:$LD_LIBRARY_PATH'.format(
                        os.path.join(self.__basepath, self.__version, 'lib'))
                }))

        return '\n'.join(str(x) for x in instructions)
示例#3
0
 def test_single_export(self):
     """Single environment variable specified"""
     e = environment(variables={'A': 'B'})
     self.assertEqual(e.toString(container_type.DOCKER), 'ENV A=B')
     self.assertEqual(
         e.toString(container_type.SINGULARITY),
         '%environment\n    export A=B\n%post\n    export A=B')
示例#4
0
    def test_multiple_docker(self):
        """Multiple environment variables specified"""
        e = environment(variables={'ONE': 1, 'TWO': 2, 'THREE': 3},
                        _export=False)
        self.assertEqual(str(e),
'''ENV ONE=1 \\
    THREE=3 \\
    TWO=2''')
示例#5
0
    def test_multiple_singularity(self):
        """Multiple environment variables specified"""
        e = environment(variables={'ONE': 1, 'TWO': 2, 'THREE': 3},
                        _export=False)
        self.assertEqual(str(e),
'''%environment
    export ONE=1
    export THREE=3
    export TWO=2''')
示例#6
0
    def __str__(self):
        """String representation of the building block"""

        instructions = []
        instructions.append(comment('MKL version {}'.format(self.version)))

        if self.__ospackages:
            instructions.append(packages(ospackages=self.__ospackages))

        if not self.__eula:
            raise RuntimeError(
                'Intel EULA was not accepted.  To accept, see the documentation for this building block'
            )

        instructions.append(
            packages(
                apt_keys=[
                    'https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2019.PUB'
                ],
                apt_repositories=[
                    'deb https://apt.repos.intel.com/mkl all main'
                ],
                ospackages=['intel-mkl-64bit-{}'.format(self.version)],
                yum_keys=[
                    'https://yum.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2019.PUB'
                ],
                yum_repositories=[
                    'https://yum.repos.intel.com/mkl/setup/intel-mkl.repo'
                ]))

        # Set the environment
        if self.__mklvars:
            # Source the mklvars environment script when starting the
            # container, but the variables not be available for any
            # subsequent build steps.
            instructions.append(
                shell(commands=[
                    'echo "source /opt/intel/mkl/bin/mklvars.sh intel64" >> {}'
                    .format(self.__bashrc)
                ]))
        else:
            # Set the environment so that it will be available to
            # subsequent build steps and when starting the container,
            # but this may miss some things relative to the mklvars
            # environment script.
            instructions.append(
                environment(
                    variables={
                        'CPATH': '/opt/intel/mkl/include:$CPATH',
                        'LD_LIBRARY_PATH':
                        '/opt/intel/mkl/lib/intel64:/opt/intel/lib/intel64:$LD_LIBRARY_PATH',
                        'LIBRARY_PATH':
                        '/opt/intel/mkl/lib/intel64:/opt/intel/lib/intel64:$LIBRARY_PATH',
                        'MKLROOT': '/opt/intel/mkl'
                    }))

        return '\n'.join(str(x) for x in instructions)
示例#7
0
 def runtime(self, _from='0'):
     """Install the runtime from a full build in a previous stage"""
     instructions = []
     instructions.append(comment('Charm++'))
     instructions.append(
         copy(_from=_from, src=self.__installdir, dest=self.__installdir))
     instructions.append(
         environment(variables=self.__environment_variables))
     return instructions
示例#8
0
 def runtime(self, _from='0'):
     """Install the runtime from a full build in a previous stage"""
     instructions = []
     instructions.append(comment('OpenMPI'))
     instructions.append(packages(ospackages=self.__runtime_ospackages))
     instructions.append(
         copy(_from=_from, src=self.prefix, dest=self.prefix))
     instructions.append(
         environment(variables=self.__environment_variables))
     return instructions
示例#9
0
    def __str__(self):
        """String representation of the building block"""
        instructions = []
        instructions.append(
            comment('Charm++ version {}'.format(self.__version)))
        instructions.append(packages(ospackages=self.__ospackages))
        instructions.append(shell(commands=self.__commands))
        instructions.append(
            environment(variables=self.__environment_variables))

        return '\n'.join(str(x) for x in instructions)
示例#10
0
 def runtime(self, _from='0'):
     """Install the runtime from a full build in a previous stage"""
     instructions = []
     instructions.append(comment('MVAPICH2'))
     # TODO: move the definition of runtime ospackages
     instructions.append(packages(ospackages=self.__runtime_ospackages))
     instructions.append(
         copy(_from=_from, src=self.prefix, dest=self.prefix))
     # No need to workaround compiler wrapper issue for the runtime.
     # Copy the dictionary so not to modify the original.
     vars = dict(self.__environment_variables)
     del vars['PROFILE_POSTLIB']
     instructions.append(environment(variables=vars))
     return instructions
示例#11
0
 def test_multiple(self):
     """Multiple environment variables specified"""
     e = environment(variables={
         'ONE': 1,
         'TWO': 2,
         'THREE': 3
     },
                     _export=False)
     self.assertEqual(e.toString(container_type.DOCKER), '''ENV ONE=1 \\
 THREE=3 \\
 TWO=2''')
     self.assertEqual(
         e.toString(container_type.SINGULARITY), '''%environment
 export ONE=1
 export THREE=3
 export TWO=2''')
示例#12
0
    def __str__(self):
        """String representation of the building block"""
        instructions = []
        if self.__directory:
            instructions.append(comment('FFTW'))
        else:
            instructions.append(
                comment('FFTW version {}'.format(self.__version)))
        instructions.append(packages(ospackages=self.__ospackages))
        if self.__directory:
            # Use source from local build context
            instructions.append(
                copy(src=self.__directory,
                     dest=os.path.join(self.__wd, self.__directory)))
        instructions.append(shell(commands=self.__commands))
        instructions.append(
            environment(variables=self.__environment_variables))

        return '\n'.join(str(x) for x in instructions)
示例#13
0
    def __str__(self):
        """String representation of the building block"""

        instructions = []

        comments = ['NetCDF version {}'.format(self.__version)]
        if self.__cxx:
            comments.append('NetCDF C++ version {}'.format(self.__version_cxx))
        if self.__fortran:
            comments.append('NetCDF Fortran version {}'.format(
                self.__version_fortran))
        instructions.append(comment(', '.join(comments)))

        if self.__ospackages:
            instructions.append(packages(ospackages=self.__ospackages))

        instructions.append(shell(commands=self.__commands))

        instructions.append(
            environment(variables=self.__environment_variables))

        return '\n'.join(str(x) for x in instructions)
示例#14
0
 def test_empty(self):
     """No environment specified"""
     e = environment()
     self.assertEqual(e.toString(container_type.DOCKER), '')
示例#15
0
 def test_invalid_ctype(self):
     """Invalid container type specified"""
     e = environment(variables={'A': 'B'})
     with self.assertRaises(RuntimeError):
         str(e)
示例#16
0
 def test_single_export_docker(self):
     """Single environment variable specified"""
     e = environment(variables={'A': 'B'})
     self.assertEqual(str(e), 'ENV A=B')
示例#17
0
 def test_single_export_singularity(self):
     """Single environment variable specified"""
     e = environment(variables={'A': 'B'})
     self.assertEqual(str(e),
                      '%environment\n    export A=B\n%post\n    export A=B')
示例#18
0
 def test_empty(self):
     """No environment specified"""
     e = environment()
     self.assertEqual(str(e), '')
示例#19
0
 def test_invalid_ctype(self):
     """Invalid container type specified"""
     e = environment(variables={'A': 'B'})
     self.assertEqual(e.toString(None), '')