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)
def __str__(self): """String representation of the building block""" instructions = [] instructions.append(comment('OFED')) instructions.append( packages(apt=self.__ospackages_deb, yum=self.__ospackages_rpm)) return '\n'.join(str(x) for x in instructions)
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
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)
def __str__(self): """String representation of the building block""" instructions = [] instructions.append(comment('Python')) instructions.append( packages(apt=self.__debs, epel=self.__epel, yum=self.__rpms)) return '\n'.join([str(x) for x in instructions])
def runtime(self, _from='0'): """Runtime specification""" instructions = [] instructions.append(comment('Python')) instructions.append( packages(apt=self.__debs, epel=self.__epel, yum=self.__rpms)) return instructions
def runtime(self, _from='0'): """Runtime specification""" instructions = [] instructions.append(comment('GNU compiler runtime')) instructions.append( packages(apt=self.__runtime_debs, yum=self.__runtime_rpms)) return instructions
def __str__(self): """String representation of the building block""" instructions = [] instructions.append(comment('GNU compiler')) instructions.append( packages(apt=self.__compiler_debs, yum=self.__compiler_rpms)) return '\n'.join(str(x) for x in instructions)
def __str__(self): """String representation of the building block""" instructions = [] instructions.append(comment('CMake version {}'.format(self.__version))) instructions.append(packages(ospackages=self.__ospackages)) instructions.append(shell(commands=self.__commands)) return '\n'.join(str(x) for x in instructions)
def test_basic_centos(self): """Basic packages""" p = packages(ospackages=['gcc', 'gcc-c++', 'gcc-fortran']) self.assertEqual( str(p), r'''RUN yum install -y \ gcc \ gcc-c++ \ gcc-fortran && \ rm -rf /var/cache/yum/*''')
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
def test_basic_ubuntu(self): """Basic packages""" p = packages(ospackages=['gcc', 'g++', 'gfortran']) self.assertEqual( str(p), r'''RUN apt-get update -y && \ apt-get install -y --no-install-recommends \ gcc \ g++ \ gfortran && \ rm -rf /var/lib/apt/lists/*''')
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
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)
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)
def test_invalid_distro(self): """Invalid package type specified""" p = packages(ospackages=['gcc', 'g++', 'gfortran']) with self.assertRaises(RuntimeError): str(p)