Beispiel #1
0
    def down_install_blas(self):

        print """
The reference BLAS library is being installed.
Don't expect high performance from this reference library!
If you want performance, you need to use an optimized BLAS library and,
to avoid unnecessary complications, if you need to compile this optimized BLAS
library, use the same compiler you're using here."""
        sys.stdout.flush()

        savecwd = os.getcwd()

        # creating the build,lib and log dirs if don't exist
        if not os.path.isdir(os.path.join(self.prefix, 'lib')):
            os.mkdir(os.path.join(self.prefix, 'lib'))

        if not os.path.isdir(os.path.join(os.getcwd(), 'log')):
            os.mkdir(os.path.join(os.getcwd(), 'log'))

        # Check if blas.tgz is already present in the working dir
        # otherwise download it
        if not os.path.isfile(
                os.path.join(os.getcwd(), getURLName(self.blasurl))):
            print "Downloading reference BLAS...",
            downloader(self.blasurl, self.downcmd)
            print "done"

        # unzip and untar
        print 'Unzip and untar reference BLAS...',
        comm = 'gunzip -f blas.tgz'
        (output, error, retz) = runShellCommand(comm)
        if retz:
            print '\n\nBLAS: cannot unzip blas.tgz'
            print 'stderr:\n', '*' * 40, '\n', comm, '\n', error, '\n', '*' * 40
            sys.exit()

        comm = 'mkdir BLAS && tar x --strip-components=1 -C BLAS -f blas.tar'
        (output, error, retz) = runShellCommand(comm)
        if retz:
            print '\n\nBLAS: cannot untar blas.tgz'
            print 'stderr:\n', '*' * 40, '\n', comm, '\n', error, '\n', '*' * 40
            sys.exit()
        os.remove('blas.tar')
        print 'done'

        # change to BLAS dir
        os.chdir(os.path.join(os.getcwd(), 'BLAS'))

        # compile and generate library
        print 'Compile and generate reference BLAS...',
        sys.stdout.flush()
        comm = self.config.fc + ' ' + self.config.fcflags + " -c *.f"
        (output, error, retz) = runShellCommand(comm)
        if retz:
            print "\n\nBLAS: cannot compile blas"
            print "stderr:\n", "*" * 40, "\n", comm, '\n', error, "\n", "*" * 40
            sys.exit()

        log = output + error

        comm = "ar cr librefblas.a *.o"
        (output, error, retz) = runShellCommand(comm)
        if retz:
            print "\n\nBLAS: cannot create blas library"
            print "stderr:\n", "*" * 40, "\n", comm, '\n', error, "\n", "*" * 40
            sys.exit()
        print "done"

        log = log + output + error

        comm = self.config.ranlib + " librefblas.a"
        (output, error, retz) = runShellCommand(comm)
        if retz:
            print "\n\nBLAS: cannot create table of contents for blas library"
            print "stderr:\n", "*" * 40, "\n", comm, '\n', error, "\n", "*" * 40
            sys.exit()
        print "done"

        # write the log on a file
        log = log + output + error
        fulllog = os.path.join(savecwd, 'log/blaslog')
        writefile(fulllog, log)
        print 'Installation of reference BLAS successful.'
        print '(log is in ', fulllog, ')'

        # move librefblas.a to the lib directory
        shutil.copy('librefblas.a', os.path.join(self.prefix, 'lib/libblas.a'))

        # set framework variables to point to the freshly installed BLAS library
        self.config.blaslib = '-L' + os.path.join(self.prefix,
                                                  'lib') + ' -lblas '
        self.config.blasdir = self.prefix
        os.chdir(savecwd)
Beispiel #2
0
    def down_install_cblas(self):

        print """
The reference CBLAS library is being installed.
"""
        sys.stdout.flush()

        savecwd = os.getcwd()

        # creating the build,lib and log dirs if don't exist
        if not os.path.isdir(os.path.join(self.prefix, 'lib')):
            os.mkdir(os.path.join(self.prefix, 'lib'))

        if not os.path.isdir(os.path.join(self.prefix, 'include')):
            os.mkdir(os.path.join(self.prefix, 'include'))

        if not os.path.isdir(os.path.join(os.getcwd(), 'log')):
            os.mkdir(os.path.join(os.getcwd(), 'log'))

        # Check if cblas.tgz is already present in the working dir
        # otherwise download it
        if not os.path.isfile(
                os.path.join(os.getcwd(), getURLName(self.cblasurl))):
            print "Downloading reference CBLAS...",
            downloader(self.cblasurl, self.downcmd)
            print "done"

        # unzip and untar
        print 'Unzip and untar reference CBLAS...',
        comm = 'gunzip -f cblas.tgz'
        (output, error, retz) = runShellCommand(comm)
        if retz:
            print '\n\nCBLAS: cannot unzip cblas.tgz'
            print 'stderr:\n', '*' * 40, '\n', comm, '\n', error, '\n', '*' * 40
            sys.exit()

        comm = 'tar xf cblas.tar'
        (output, error, retz) = runShellCommand(comm)
        if retz:
            print '\n\nCBLAS: cannot untar cblas.tgz'
            print 'stderr:\n', '*' * 40, '\n', comm, '\n', error, '\n', '*' * 40
            sys.exit()
        os.remove('cblas.tar')
        print 'done'

        # change to BLAS dir
        os.chdir(os.path.join(os.getcwd(), 'CBLAS'))

        # Write Makefile.in
        writefile(
            'Makefile.in', """
# Makefile.in (Bblas Installer)
#
#-----------------------------------------------------------------------------
# Shell
#-----------------------------------------------------------------------------
SHELL = /bin/sh

#-----------------------------------------------------------------------------
# Platform
#-----------------------------------------------------------------------------

PLAT = """ + self.plat + """

#-----------------------------------------------------------------------------
# Libraries and includs
#-----------------------------------------------------------------------------

BLLIB = """ + self.config.blaslib + """
CBDIR = """ + os.getcwd() + """
CBLIBDIR = $(CBDIR)/lib
CBLIB = $(CBLIBDIR)/libcblas.a

#-----------------------------------------------------------------------------
# Compilers
#-----------------------------------------------------------------------------

CC = """ + self.config.cc + """
FC = """ + self.config.fc + """
LOADER = $(FC)

#-----------------------------------------------------------------------------
# Flags for Compilers
#-----------------------------------------------------------------------------

CFLAGS = """ + self.config.ccflags + """ """ + self.mangling + """
FFLAGS = """ + self.config.fcflags + """

#-----------------------------------------------------------------------------
# Archive programs and flags
#-----------------------------------------------------------------------------

ARCH      = ar
ARCHFLAGS = """ + self.config.arflags + """
RANLIB    = """ + self.config.ranlib + """
""")

        # compile and generate library
        print 'Compile and generate reference CBLAS...',
        sys.stdout.flush()
        comm = self.make + ' alllib'
        (output, error, retz) = runShellCommand(comm)
        if retz:
            print "\n\nCBLAS: cannot compile cblas"
            print "stderr:\n", "*" * 40, "\n", comm, '\n', error, "\n", "*" * 40
            sys.exit()

        log = output + error

        # write the log on a file
        log = log + output + error
        fulllog = os.path.join(savecwd, 'log/cblaslog')
        writefile(fulllog, log)
        print 'Installation of reference CBLAS successful.'
        print '(log is in ', fulllog, ')'

        # move libcblas.a to the lib directory
        shutil.copy('lib/libcblas.a',
                    os.path.join(self.prefix, 'lib/libcblas.a'))

        # move cblas.h to the include directory
        shutil.copy('include/cblas.h',
                    os.path.join(self.prefix, 'include/cblas.h'))

        # set framework variables to point to the freshly installed BLAS library
        self.config.cblasdir = self.prefix
        self.config.cblaslib = '-L' + os.path.join(self.prefix,
                                                   'lib') + ' -lcblas'
        os.chdir(savecwd)

        # Check if the installation is successful
        self.bblas.verbose = 1
        ret = self.check_cblas()
        self.bblas.verbose = 0
        if ret != 0:
            sys.exit()
Beispiel #3
0
    def down_install_blas(self):

        print """
The reference BLAS library is being installed.
Don't expect high performance from this reference library!
If you want performance, you need to use an optimized BLAS library and,
to avoid unnecessary complications, if you need to compile this optimized BLAS
library, use the same compiler you're using here."""
        sys.stdout.flush()

        savecwd = os.getcwd()

        # creating the build,lib and log dirs if don't exist
        if not os.path.isdir(os.path.join(self.prefix,'lib')):
            os.mkdir(os.path.join(self.prefix,'lib'))

        if not os.path.isdir(os.path.join(os.getcwd(),'log')):
            os.mkdir(os.path.join(os.getcwd(),'log'))

        # Check if blas.tgz is already present in the working dir
        # otherwise download it
        if not os.path.isfile(os.path.join(os.getcwd(),getURLName(self.blasurl))):
            print "Downloading reference BLAS...",
            downloader(self.blasurl,self.downcmd)
            print "done"

        # unzip and untar
        print 'Unzip and untar reference BLAS...',
        comm = 'gunzip -f blas.tgz'
        (output, error, retz) = runShellCommand(comm)
        if retz:
            print '\n\nBLAS: cannot unzip blas.tgz'
            print 'stderr:\n','*'*40,'\n',comm,'\n',error,'\n','*'*40
            sys.exit()

        comm = 'tar xf blas.tar'
        (output, error, retz) = runShellCommand(comm)
        if retz:
            print '\n\nBLAS: cannot untar blas.tgz'
            print 'stderr:\n','*'*40,'\n',comm,'\n',error,'\n','*'*40
            sys.exit()
        os.remove('blas.tar')
        print 'done'

        # change to BLAS dir
        os.chdir(os.path.join(os.getcwd(),'BLAS'))

        # compile and generate library
        print 'Compile and generate reference BLAS...',
        sys.stdout.flush()
        comm = self.config.fc+' '+self.config.fcflags+" -c *.f"
        (output, error, retz) = runShellCommand(comm)
        if retz:
            print "\n\nBLAS: cannot compile blas"
            print "stderr:\n","*"*40,"\n",comm,'\n',error,"\n","*"*40
            sys.exit()

        log = output+error

        comm = "ar cr librefblas.a *.o"
        (output, error, retz) = runShellCommand(comm)
        if retz:
            print "\n\nBLAS: cannot create blas library"
            print "stderr:\n","*"*40,"\n",comm,'\n',error,"\n","*"*40
            sys.exit()
        print "done"

        log = log+output+error

        comm = self.config.ranlib+" librefblas.a"
        (output, error, retz) = runShellCommand(comm)
        if retz:
            print "\n\nBLAS: cannot create table of contents for blas library"
            print "stderr:\n","*"*40,"\n",comm,'\n',error,"\n","*"*40
            sys.exit()
        print "done"
        
        # write the log on a file
        log = log+output+error
        fulllog = os.path.join(savecwd,'log/blaslog')
        writefile(fulllog, log)
        print 'Installation of reference BLAS successful.'
        print '(log is in ',fulllog,')'

        # move librefblas.a to the lib directory
        shutil.copy('librefblas.a',os.path.join(self.prefix,'lib/librefblas.a'))

        # set framework variables to point to the freshly installed BLAS library
        self.config.blaslib  = '-L'+os.path.join(self.prefix,'lib')+' -lrefblas '
        os.chdir(savecwd)
Beispiel #4
0
    def down_install_lapc(self):

        print """
The reference LAPACK C interface is being installed.
"""
        sys.stdout.flush()

        savecwd = os.getcwd()

        # creating the build,lib and log dirs if don't exist
        if not os.path.isdir(os.path.join(self.prefix,'lib')):
            os.mkdir(os.path.join(self.prefix,'lib'))

        if not os.path.isdir(os.path.join(self.prefix,'include')):
            os.mkdir(os.path.join(self.prefix,'include'))

        if not os.path.isdir(os.path.join(os.getcwd(),'log')):
            os.mkdir(os.path.join(os.getcwd(),'log'))

        if self.config.lapinstalled == 0:
            # Check if lapacke.tgz is already present in the working dir
            # otherwise download it
            if not os.path.isfile(os.path.join(os.getcwd(),getURLName(self.lapackurl))):
                print "Downloading reference LAPACK C interface...",
                downloader(self.lapackurl,self.downcmd)
                print "done"

            # unzip and untar
            print 'Unzip and untar reference LAPACK C interface...',
            comm = 'gunzip -f '+self.lapversion+'.tgz'
            (output, error, retz) = runShellCommand(comm)
            if retz:
                print '\n\nLAPCWRAPPER: cannot unzip '+self.lapversion+'.tgz'
                print 'stderr:\n','*'*40,'\n',comm,'\n',error,'\n','*'*40
                sys.exit()

            comm = 'tar xf '+self.lapversion+'.tar'
            (output, error, retz) = runShellCommand(comm)
            if retz:
                print '\n\nLAPCWRAPPER: cannot untar '+self.lapversion+'.tar'
                print 'stderr:\n','*'*40,'\n',comm,'\n',error,'\n','*'*40
                sys.exit()
            os.remove(self.lapversion+'.tar')
            print 'done'

            #Apply the patch to correct [sd]lantr
            print 'Apply patch on lapacke...',
            comm = '(cd '+self.lapversion+' && patch -p 0 < '+(os.path.join(savecwd,'../script/patch_lantr'))+')'
            (output, error, retz) = runShellCommand(comm)
            print 'done'
            
        # change to LAPACK C interface dir
        os.chdir(os.path.join(os.getcwd(), self.lapversion))

        # Write Makefile.in
        writefile('make.inc', """
# -*- Makefile generated by PLASMA installer -*-
####################################################################
#  LAPACK make include file.                                       #
#  LAPACK, Version 3.4.0                                           #
#  April 2012                                                      #
####################################################################
#
SHELL = /bin/sh
#
#  Modify the FORTRAN and OPTS definitions to refer to the
#  compiler and desired compiler options for your machine.  NOOPT
#  refers to the compiler options desired when NO OPTIMIZATION is
#  selected.  Define LOADER and LOADOPTS to refer to the loader and
#  desired load options for your machine.
#
FORTRAN  = """+self.config.fc+"""
OPTS     = """+self.config.fcflags+"""
DRVOPTS  = $(OPTS)
NOOPT    = """+self.config.noopt+"""
LOADER   = """+self.config.fc+"""
LOADOPTS = """+self.config.ldflags_fc+"""
MAKE     = make -j 8
#
# Timer for the SECOND and DSECND routines
#
# Default : SECOND and DSECND will use a call to the EXTERNAL FUNCTION ETIME
# TIMER    = EXT_ETIME
# For RS6K : SECOND and DSECND will use a call to the EXTERNAL FUNCTION ETIME_
# TIMER    = EXT_ETIME_
# For gfortran compiler: SECOND and DSECND will use a call to the INTERNAL FUNCTION ETIME
# TIMER    = INT_ETIME
# If your Fortran compiler does not provide etime (like Nag Fortran Compiler, etc...)
# SECOND and DSECND will use a call to the INTERNAL FUNCTION CPU_TIME
TIMER    = INT_CPU_TIME
# If neither of this works...you can use the NONE value... In that case, SECOND and DSECND will always return 0
# TIMER     = NONE
#
#  Configuration LAPACKE: Native C interface to LAPACK
#  To generate LAPACKE library: type 'make lapackelib'
#  Configuration file: turned off (default)
#  Complex types: C99 (default)
#  Name pattern: mixed case (default)
#  (64-bit) Data model: LP64 (default)
#
# CC is the C compiler, normally invoked with options CFLAGS.
#
CC     = """+self.config.cc+"""
CFLAGS = """+self.config.ccflags+' '+self.mangling+"""
#
#  The archiver and the flag(s) to use when building archive (library)
#  If you system has no ranlib, set RANLIB = echo.
#
ARCH     = ar
ARCHFLAGS= """+self.config.arflags+"""
RANLIB   = """+self.config.ranlib+"""
#
#  The location of BLAS library for linking the testing programs.
#  The target's machine-specific, optimized BLAS library should be
#  used whenever possible.
#
BLASLIB      = """+self.config.blaslib+"""
#
#  Location of the extended-precision BLAS (XBLAS) Fortran library
#  used for building and testing extended-precision routines.  The
#  relevant routines will be compiled and XBLAS will be linked only if
#  USEXBLAS is defined.
#
# USEXBLAS    = Yes
XBLASLIB     =
# XBLASLIB    = -lxblas
#
#  Names of generated libraries.
#
LAPACKLIB    = liblapack.a
TMGLIB       = libtmg.a
EIGSRCLIB    = libeigsrc.a
LINSRCLIB    = liblinsrc.a
LAPACKELIB   = liblapacke.a
""")

        # compile and generate library
        print 'Compile and generate reference LAPACK C interface...',
        sys.stdout.flush()
        comm = self.make+' -j 4 lapackelib'
        (output, error, retz) = runShellCommand(comm)
        if retz:
            print "\n\nLAPCWRAPPER: cannot compile LAPACK C interface"
            print "stderr:\n","*"*40,"\n",comm,'\n',error,"\n","*"*40
            sys.exit()

        log = output+error

        # write the log on a file
        log = log+output+error
        fulllog = os.path.join(savecwd,'log/lapackcwrapperlog')
        writefile(fulllog, log)
        print 'Installation of reference LAPACK C interface successful.'
        print '(log is in ',fulllog,')'

        # move liblapacke.a to the lib directory
        shutil.copy('liblapacke.a',os.path.join(self.prefix,'lib/liblapacke.a'))

        # move headers to the include directory
        shutil.copy('LAPACKE/include/lapacke.h', os.path.join(self.prefix,'include/lapacke.h'))
        shutil.copy('LAPACKE/include/lapacke_config.h', os.path.join(self.prefix,'include/lapacke_config.h'))
        shutil.copy('LAPACKE/include/lapacke_utils.h', os.path.join(self.prefix,'include/lapacke_utils.h'))
        shutil.copy('LAPACKE/include/lapacke_mangling.h', os.path.join(self.prefix,'include/lapacke_mangling.h'))
        shutil.copy('LAPACKE/include/lapacke_mangling_with_flags.h', os.path.join(self.prefix,'include/lapacke_mangling_with_flags.h'))

        # set framework variables to point to the freshly installed BLAS library
        self.config.lapclib   = '-L'+os.path.join(self.prefix,'lib')+' -llapacke'
        self.config.lapackinc = '-I'+os.path.join(self.prefix,'include')
        os.chdir(savecwd)

        # Check if the installation is successful
        self.plasma.verbose = 1
        ret = self.check_lapc()
        self.plasma.verbose = 0
        if ret != 0 :
            sys.exit()
Beispiel #5
0
    def down_install_tmg(self):

        print """
The libtmg from reference LAPACK library is being installed.
"""
        sys.stdout.flush()

        savecwd = os.getcwd()

        # creating the build,lib and log dirs if don't exist
        if not os.path.isdir(os.path.join(self.prefix,'lib')):
            os.mkdir(os.path.join(self.prefix,'lib'))

        if not os.path.isdir(os.path.join(os.getcwd(),'log')):
            os.mkdir(os.path.join(os.getcwd(),'log'))

        # Check if lapack.tgz is already present in the working dir
        # otherwise download it
        if not os.path.isfile(os.path.join(os.getcwd(),getURLName(self.lapackurl))):
            print "Downloading reference LAPACK...",
            downloader(self.lapackurl,self.downcmd)
            print "done"

        # unzip and untar
        print 'Unzip and untar reference BLAS...',
        comm = 'gunzip -f lapack.tgz'
        (output, error, retz) = runShellCommand(comm)
        if retz:
            print '\n\nlibtmg: cannot unzip lapack.tgz'
            print 'stderr:\n','*'*40,'\n',comm,'\n',error,'\n','*'*40
            sys.exit()

        comm = 'tar xf lapack.tar'
        (output, error, retz) = runShellCommand(comm)
        if retz:
            print '\n\nlibtmg: cannot untar lapack.tgz'
            print 'stderr:\n','*'*40,'\n',comm,'\n',error,'\n','*'*40
            sys.exit()
        os.remove('lapack.tar')
        print 'done'

        # change to BLAS dir
        os.chdir(os.path.join(os.getcwd(),'lapack-3.3.1'))

        # Write Makefile.in
        writefile('make.inc', """
# -*- Makefile -*-
####################################################################
#  LAPACK make include file.                                       #
#  LAPACK, Version 3.3.1                                           #
#  April 2009                                                      #
####################################################################
#
# See the INSTALL/ directory for more examples.
#
SHELL = /bin/sh
#
#  The machine (platform) identifier to append to the library names
#
PLAT = _LINUX
#
#  Modify the FORTRAN and OPTS definitions to refer to the
#  compiler and desired compiler options for your machine.  NOOPT
#  refers to the compiler options desired when NO OPTIMIZATION is
#  selected.  Define LOADER and LOADOPTS to refer to the loader
#  and desired load options for your machine.
#
FORTRAN  = """+self.config.fc+"""
OPTS     = """+self.config.fcflags+"""
DRVOPTS  = $(OPTS)
NOOPT    = """+self.config.noopt+"""
LOADER   = """+self.config.fc+"""
LOADOPTS = """+self.config.ldflags_fc+"""
#
# Timer for the SECOND and DSECND routines
#
# Default : SECOND and DSECND will use a call to the EXTERNAL FUNCTION ETIME
# TIMER    = EXT_ETIME
# For RS6K : SECOND and DSECND will use a call to the EXTERNAL FUNCTION ETIME_
# TIMER    = EXT_ETIME_
# For gfortran compiler: SECOND and DSECND will use a call to the INTERNAL FUNCTION ETIME
# TIMER    = INT_ETIME
# If your Fortran compiler does not provide etime (like Nag Fortran Compiler, etc...)
# SECOND and DSECND will use a call to the Fortran standard INTERNAL FUNCTION CPU_TIME
TIMER    = INT_CPU_TIME
# If neither of this works...you can use the NONE value... In that case, SECOND and DSECND will always return 0
# TIMER     = NONE
#
#  The archiver and the flag(s) to use when building archive (library)
#  If you system has no ranlib, set RANLIB = echo.
#
ARCH     = ar
ARCHFLAGS= """+self.config.arflags+"""
RANLIB   = """+self.config.ranlib+"""
#
#  The location of BLAS library for linking the testing programs.
#  The target's machine-specific, optimized BLAS library should be
#  used whenever possible.
#
BLASLIB      = """+self.config.cblaslib+"""
#
#  Location of the extended-precision BLAS (XBLAS) Fortran library
#  used for building and testing extended-precision routines.  The
#  relevant routines will be compiled and XBLAS will be linked only if
#  USEXBLAS is defined.
#
# USEXBLAS    = Yes
XBLASLIB     =
# XBLASLIB    = -lxblas
#
#  Names of generated libraries.
#
LAPACKLIB    = liblapack.a
TMGLIB       = libtmg.a
EIGSRCLIB    = libeigsrc.a
LINSRCLIB    = liblinsrc.a
""")

        # compile and generate library
        print 'Compile and generate libtmg...',
        sys.stdout.flush()
        comm = self.make+' tmglib'
        (output, error, retz) = runShellCommand(comm)
        if retz:
            print "\n\nlintmg: cannot compile libtmg"
            print "stderr:\n","*"*40,"\n",comm,'\n',error,"\n","*"*40
            sys.exit()

        log = output+error

        # write the log on a file
        log = log+output+error
        fulllog = os.path.join(savecwd,'log/tmglog')
        writefile(fulllog, log)
        print 'Installation of libtmg.a successful.'
        print '(log is in ',fulllog,')'

        # move libcblas.a to the lib directory
        shutil.copy('libtmg.a',os.path.join(self.prefix,'lib/libtmg.a'))

        # set framework variables to point to the freshly installed BLAS library
        self.config.lapacklib = '-L'+os.path.join(self.prefix,'lib')+' -ltmg '+self.config.lapacklib

        os.chdir(savecwd)

        # Check if the installation is successful
        self.plasma.verbose = 1
        self.check_tmg()
        self.plasma.verbose = 0
Beispiel #6
0
    def down_install_cblas(self):

        print """
The reference CBLAS library is being installed.
"""
        sys.stdout.flush()

        savecwd = os.getcwd()

        # creating the build,lib and log dirs if don't exist
        if not os.path.isdir(os.path.join(self.prefix,'lib')):
            os.mkdir(os.path.join(self.prefix,'lib'))

        if not os.path.isdir(os.path.join(self.prefix,'include')):
            os.mkdir(os.path.join(self.prefix,'include'))

        if not os.path.isdir(os.path.join(os.getcwd(),'log')):
            os.mkdir(os.path.join(os.getcwd(),'log'))

        # Check if cblas.tgz is already present in the working dir
        # otherwise download it
        if not os.path.isfile(os.path.join(os.getcwd(),getURLName(self.cblasurl))):
            print "Downloading reference CBLAS...",
            downloader(self.cblasurl,self.downcmd)
            print "done"

        # unzip and untar
        print 'Unzip and untar reference BLAS...',
        comm = 'gunzip -f cblas.tgz'
        (output, error, retz) = runShellCommand(comm)
        if retz:
            print '\n\nCBLAS: cannot unzip cblas.tgz'
            print 'stderr:\n','*'*40,'\n',comm,'\n',error,'\n','*'*40
            sys.exit()

        comm = 'tar xf cblas.tar'
        (output, error, retz) = runShellCommand(comm)
        if retz:
            print '\n\nCBLAS: cannot untar cblas.tgz'
            print 'stderr:\n','*'*40,'\n',comm,'\n',error,'\n','*'*40
            sys.exit()
        os.remove('cblas.tar')
        print 'done'

        # change to BLAS dir
        os.chdir(os.path.join(os.getcwd(),'CBLAS'))

        # Write Makefile.in
        writefile('Makefile.in', """
# Makefile.in (Plasma Installer)
#
#-----------------------------------------------------------------------------
# Shell
#-----------------------------------------------------------------------------
SHELL = /bin/sh

#-----------------------------------------------------------------------------
# Platform
#-----------------------------------------------------------------------------

PLAT = """+self.plat+"""

#-----------------------------------------------------------------------------
# Libraries and includs
#-----------------------------------------------------------------------------

BLLIB = """+self.config.blaslib+"""
CBDIR = """+os.getcwd()+"""
CBLIBDIR = $(CBDIR)/lib
CBLIB = $(CBLIBDIR)/libcblas.a

#-----------------------------------------------------------------------------
# Compilers
#-----------------------------------------------------------------------------

CC = """+self.config.cc+"""
FC = """+self.config.fc+"""
LOADER = $(FC)

#-----------------------------------------------------------------------------
# Flags for Compilers
#-----------------------------------------------------------------------------

CFLAGS = """+self.config.ccflags+""" """+self.mangling+"""
FFLAGS = """+self.config.fcflags+"""

#-----------------------------------------------------------------------------
# Archive programs and flags
#-----------------------------------------------------------------------------

ARCH      = ar
ARCHFLAGS = """+self.config.arflags+"""
RANLIB    = """+self.config.ranlib+"""
""")

        # compile and generate library
        print 'Compile and generate reference CBLAS...',
        sys.stdout.flush()
        comm = self.make+' alllib'
        (output, error, retz) = runShellCommand(comm)
        if retz:
            print "\n\nCBLAS: cannot compile cblas"
            print "stderr:\n","*"*40,"\n",comm,'\n',error,"\n","*"*40
            sys.exit()

        log = output+error

        # write the log on a file
        log = log+output+error
        fulllog = os.path.join(savecwd,'log/cblaslog')
        writefile(fulllog, log)
        print 'Installation of reference CBLAS successful.'
        print '(log is in ',fulllog,')'

        # move libcblas.a to the lib directory
        shutil.copy('lib/libcblas.a',os.path.join(self.prefix,'lib/libcblas.a'))

        # move cblas.h to the include directory
        shutil.copy('include/cblas.h',os.path.join(self.prefix,'include/cblas.h'))

        # set framework variables to point to the freshly installed BLAS library
        self.config.cblaslib  = '-L'+os.path.join(self.prefix,'lib')+' -lcblas'
        os.chdir(savecwd)

        # Check if the installation is successful
        self.plasma.verbose = 1;
        ret = self.check_cblas()
        self.plasma.verbose = 0;
        if ret != 0 :
            sys.exit()
Beispiel #7
0
    def down_install_lapack(self):

        print """
The reference LAPACK library is being installed.
"""
        sys.stdout.flush()

        savecwd = os.getcwd()

        # creating the build,lib and log dirs if don't exist
        if not os.path.isdir(os.path.join(self.prefix,'lib')):
            os.mkdir(os.path.join(self.prefix,'lib'))

        if not os.path.isdir(os.path.join(os.getcwd(),'log')):
            os.mkdir(os.path.join(os.getcwd(),'log'))

        # Check if lapack.tgz is already present in the working dir
        # otherwise download it
        if not os.path.isfile(os.path.join(os.getcwd(),getURLName(self.lapackurl))):
            print "Downloading reference LAPACK...",
            downloader(self.lapackurl,self.downcmd)
            print "done"

        # unzip and untar
        print 'Unzip and untar reference BLAS...',
        comm = 'tar -xvzf  lapack-3.4.1.tgz'
        (output, error, retz) = runShellCommand(comm)
        if retz:
            print '\n\nLAPACK: cannot unzip lapack.tgz'
            print 'stderr:\n','*'*40,'\n',comm,'\n',error,'\n','*'*40
            sys.exit()

        print 'done'

#         # Overwrite [sd]lamch.f
#         shutil.copy(os.path.join(self.plasma.installerdir,'src/dlamch.f'),
#                     os.path.join(os.getcwd(),'lapack-3.3.1/INSTALL'))
#         shutil.copy(os.path.join(self.plasma.installerdir,'src/slamch.f'),
#                     os.path.join(os.getcwd(),'lapack-3.3.1/INSTALL'))

        # change to BLAS dir
        os.chdir(os.path.join(os.getcwd(), 'lapack-3.4.1')) #self.lapversion))

        # Write Makefile.in
        writefile('make.inc', """
# -*- Makefile generated by PLASMA installer -*-
####################################################################
#  LAPACK make include file.                                       #
#  LAPACK, Version 3.4.0                                           #
#  April 2012                                                      #
####################################################################
#
SHELL = /bin/sh
#
#  Modify the FORTRAN and OPTS definitions to refer to the
#  compiler and desired compiler options for your machine.  NOOPT
#  refers to the compiler options desired when NO OPTIMIZATION is
#  selected.  Define LOADER and LOADOPTS to refer to the loader and
#  desired load options for your machine.
#
FORTRAN  = """+self.config.fc+"""
OPTS     = """+self.config.fcflags+"""
DRVOPTS  = $(OPTS)
NOOPT    = """+self.config.noopt+"""
LOADER   = """+self.config.fc+"""
LOADOPTS = """+self.config.ldflags_fc+"""
#
# Timer for the SECOND and DSECND routines
#
# Default : SECOND and DSECND will use a call to the EXTERNAL FUNCTION ETIME
# TIMER    = EXT_ETIME
# For RS6K : SECOND and DSECND will use a call to the EXTERNAL FUNCTION ETIME_
# TIMER    = EXT_ETIME_
# For gfortran compiler: SECOND and DSECND will use a call to the INTERNAL FUNCTION ETIME
# TIMER    = INT_ETIME
# If your Fortran compiler does not provide etime (like Nag Fortran Compiler, etc...)
# SECOND and DSECND will use a call to the INTERNAL FUNCTION CPU_TIME
TIMER    = INT_CPU_TIME
# If neither of this works...you can use the NONE value... In that case, SECOND and DSECND will always return 0
# TIMER     = NONE
#
#  Configuration LAPACKE: Native C interface to LAPACK
#  To generate LAPACKE library: type 'make lapackelib'
#  Configuration file: turned off (default)
#  Complex types: C99 (default)
#  Name pattern: mixed case (default)
#  (64-bit) Data model: LP64 (default)
#
# CC is the C compiler, normally invoked with options CFLAGS.
#
CC     = """+self.config.cc+"""
CFLAGS = """+self.config.ccflags+"""
#
#  The archiver and the flag(s) to use when building archive (library)
#  If you system has no ranlib, set RANLIB = echo.
#
ARCH     = ar
ARCHFLAGS= """+self.config.arflags+"""
RANLIB   = """+self.config.ranlib+"""
#
#  The location of BLAS library for linking the testing programs.
#  The target's machine-specific, optimized BLAS library should be
#  used whenever possible.
#
BLASLIB      = """+self.config.blaslib+"""
#
#  Location of the extended-precision BLAS (XBLAS) Fortran library
#  used for building and testing extended-precision routines.  The
#  relevant routines will be compiled and XBLAS will be linked only if
#  USEXBLAS is defined.
#
# USEXBLAS    = Yes
XBLASLIB     =
# XBLASLIB    = -lxblas
#
#  Names of generated libraries.
#
LAPACKLIB    = liblapack.a
TMGLIB       = libtmg.a
EIGSRCLIB    = libeigsrc.a
LINSRCLIB    = liblinsrc.a
LAPACKELIB   = liblapacke.a
""")

        # compile and generate library
        print 'Compile and generate LAPACK...',
        sys.stdout.flush()
        comm = self.make+' lapacklib tmglib'
        (output, error, retz) = runShellCommand(comm)
        if retz:
            print "\n\nLAPACK: cannot compile LAPACK"
            print "stderr:\n","*"*40,"\n",comm,'\n',error,"\n","*"*40
            sys.exit()

        log = output+error

        # write the log on a file
        log = log+output+error
        fulllog = os.path.join(savecwd,'log/lapacklog')
        writefile(fulllog, log)
        print 'Installation of liblapack.a successful.'
        print '(log is in ',fulllog,')'

        # move libcblas.a to the lib directory
        shutil.copy('liblapack.a',os.path.join(self.prefix,'lib/liblapack.a'))
        shutil.copy('libtmg.a',os.path.join(self.prefix,'lib/libtmg.a'))

        # set framework variables to point to the freshly installed BLAS library
        self.config.lapacklib  = '-L'+os.path.join(self.prefix,'lib')+' -ltmg -llapack'
        os.chdir(savecwd)

        self.config.lapinstalled = 1;

        # Check if the installation is successful
        self.plasma.verbose = 1
        ret = self.check_lapack()
        self.plasma.verbose = 0
        if ret != 0:
            sys.exit()
Beispiel #8
0
    def down_install_gsl(self):
        print "The GSL library is being installed."
        sys.stdout.flush()

        savecwd = os.getcwd()

        # creating the build,lib and log dirs if don't exist
        if not os.path.isdir(os.path.join(self.config.prefix, 'gsl')):
            os.mkdir(os.path.join(self.config.prefix, 'gsl'))

        if not os.path.isdir(os.path.join(os.getcwd(), 'log')):
            os.mkdir(os.path.join(os.getcwd(), 'log'))

        # Check if gsl.tgz is already present in the working dir
        # otherwise download it
        if not os.path.isfile(
                os.path.join(os.getcwd(), getURLName(self.gslurl))):
            print "Downloading GSL ...",
            #downloader(self.lapackurl,self.downcmd)
            #urllib.urlretrieve(self.gslurl, "gsl.tgz")
            geturl(self.gslurl, "gsl.tgz")

            print "done"

        # unzip and untar
        os.chdir('download')
        print 'Unzip and untar GSL...',
        comm = 'tar zxf gsl.tgz '
        (output, error, retz) = shellcmd(comm)
        if retz:
            print '\n\nlibgsl: cannot unzip ' + self.gslversion + '.tgz'
            print 'stderr:\n', '*' * 50, '\n', comm, '\n', error, '\n', '*' * 50
            sys.exit()

        print 'done'

        # change to GSL dir
        os.chdir(os.path.join(os.getcwd(), self.gslversion))

        # compile and generate library
        print 'Configure  GSL...',
        sys.stdout.flush()
        comm = './configure CC=' + self.config.cc + '  --prefix=' + os.path.join(
            self.config.prefix, 'gsl')
        (output, error, retz) = shellcmd(comm)
        if retz:
            print "\n\nlingsl: cannot configure GSL"
            print "stderr:\n", "*" * 50, "\n", comm, '\n', error, "\n", "*" * 50
            sys.exit()

        log = output + error

        # write log on a file
        log = log + output + error
        fulllog = os.path.join(savecwd, 'log/log.gsl')
        writefile(fulllog, log)
        print 'Configuration of GSL  successful.'
        print '(log is in ', fulllog, ')'

        # compile and generate library
        print 'Compile and generate GSL...',
        sys.stdout.flush()
        comm = self.make + ' -j4; ' + self.make + ' install'
        (output, error, retz) = shellcmd(comm)
        if retz:
            print "\n\nlingsl: cannot compile GSL"
            print "stderr:\n", "*" * 50, "\n", comm, '\n', error, "\n", "*" * 50
            sys.exit()

        log = output + error

        # write the log on a file
        log = log + output + error
        fulllog = os.path.join(savecwd, 'log/log.gsl')
        writefile(fulllog, log)
        print 'Installation of GSL successful.'
        print '(log is in ', fulllog, ')'

        # move libcblas.a to the lib directory
        #shutil.copy('libtmg.a',os.path.join(self.config.prefix,'gsl/libtmg.a'))

        # set framework variables to point to the freshly installed GSL library
        self.config.gsl = '-L' + os.path.join(self.config.prefix,
                                              'gsl') + ' -lgsl '

        os.chdir(savecwd)

        # Check if the installation is successful
        self.dmft.verbose = 1
        # self.check_gsl()
        self.dmft.verbose = 0
Beispiel #9
0
    def down_install_tmg(self):

        print """
The libtmg from reference LAPACK library is being installed.
"""
        sys.stdout.flush()

        savecwd = os.getcwd()

        # creating the build,lib and log dirs if don't exist
        if not os.path.isdir(os.path.join(self.prefix, 'lib')):
            os.mkdir(os.path.join(self.prefix, 'lib'))

        if not os.path.isdir(os.path.join(os.getcwd(), 'log')):
            os.mkdir(os.path.join(os.getcwd(), 'log'))

        # Check if lapack.tgz is already present in the working dir
        # otherwise download it
        if not os.path.isfile(
                os.path.join(os.getcwd(), getURLName(self.lapackurl))):
            print "Downloading reference LAPACK...",
            downloader(self.lapackurl, self.downcmd)
            print "done"

        # unzip and untar
        print 'Unzip and untar reference BLAS...',
        comm = 'gunzip -f ' + self.lapversion + '.tgz'
        (output, error, retz) = runShellCommand(comm)
        if retz:
            print '\n\nlibtmg: cannot unzip ' + self.lapversion + '.tgz'
            print 'stderr:\n', '*' * 40, '\n', comm, '\n', error, '\n', '*' * 40
            sys.exit()

        comm = 'tar xf ' + self.lapversion + '.tar'
        (output, error, retz) = runShellCommand(comm)
        if retz:
            print '\n\nlibtmg: cannot untar ' + self.lapversion + '.tar'
            print 'stderr:\n', '*' * 40, '\n', comm, '\n', error, '\n', '*' * 40
            sys.exit()
        os.remove(self.lapversion + '.tar')
        print 'done'

        # change to BLAS dir
        os.chdir(os.path.join(os.getcwd(), self.lapversion))

        # Write Makefile.in
        writefile(
            'make.inc', """
# -*- Makefile -*-
####################################################################
#  LAPACK make include file.                                       #
#  LAPACK, Version 3.3.1                                           #
#  April 2009                                                      #
####################################################################
#
# See the INSTALL/ directory for more examples.
#
SHELL = /bin/sh
#
#  The machine (platform) identifier to append to the library names
#
PLAT = _LINUX
#
#  Modify the FORTRAN and OPTS definitions to refer to the
#  compiler and desired compiler options for your machine.  NOOPT
#  refers to the compiler options desired when NO OPTIMIZATION is
#  selected.  Define LOADER and LOADOPTS to refer to the loader
#  and desired load options for your machine.
#
FORTRAN  = """ + self.config.fc + """
OPTS     = """ + self.config.fcflags + """
DRVOPTS  = $(OPTS)
NOOPT    = """ + self.config.noopt + """
LOADER   = """ + self.config.fc + """
LOADOPTS = """ + self.config.ldflags_fc + """
MAKE     = make -j 8
#
# Timer for the SECOND and DSECND routines
#
# Default : SECOND and DSECND will use a call to the EXTERNAL FUNCTION ETIME
# TIMER    = EXT_ETIME
# For RS6K : SECOND and DSECND will use a call to the EXTERNAL FUNCTION ETIME_
# TIMER    = EXT_ETIME_
# For gfortran compiler: SECOND and DSECND will use a call to the INTERNAL FUNCTION ETIME
# TIMER    = INT_ETIME
# If your Fortran compiler does not provide etime (like Nag Fortran Compiler, etc...)
# SECOND and DSECND will use a call to the Fortran standard INTERNAL FUNCTION CPU_TIME
TIMER    = INT_CPU_TIME
# If neither of this works...you can use the NONE value... In that case, SECOND and DSECND will always return 0
# TIMER     = NONE
#
#  The archiver and the flag(s) to use when building archive (library)
#  If you system has no ranlib, set RANLIB = echo.
#
ARCH     = ar
ARCHFLAGS= """ + self.config.arflags + """
RANLIB   = """ + self.config.ranlib + """
#
#  The location of BLAS library for linking the testing programs.
#  The target's machine-specific, optimized BLAS library should be
#  used whenever possible.
#
BLASLIB      = """ + self.config.cblaslib + """
#
#  Location of the extended-precision BLAS (XBLAS) Fortran library
#  used for building and testing extended-precision routines.  The
#  relevant routines will be compiled and XBLAS will be linked only if
#  USEXBLAS is defined.
#
# USEXBLAS    = Yes
XBLASLIB     =
# XBLASLIB    = -lxblas
#
#  Names of generated libraries.
#
LAPACKLIB    = liblapack.a
TMGLIB       = libtmg.a
EIGSRCLIB    = libeigsrc.a
LINSRCLIB    = liblinsrc.a
""")

        # compile and generate library
        print 'Compile and generate libtmg...',
        sys.stdout.flush()
        comm = self.make + ' tmglib'
        (output, error, retz) = runShellCommand(comm)
        if retz:
            print "\n\nlintmg: cannot compile libtmg"
            print "stderr:\n", "*" * 40, "\n", comm, '\n', error, "\n", "*" * 40
            sys.exit()

        log = output + error

        # write the log on a file
        log = log + output + error
        fulllog = os.path.join(savecwd, 'log/tmglog')
        writefile(fulllog, log)
        print 'Installation of libtmg.a successful.'
        print '(log is in ', fulllog, ')'

        # move libcblas.a to the lib directory
        shutil.copy('libtmg.a', os.path.join(self.prefix, 'lib/libtmg.a'))

        # set framework variables to point to the freshly installed BLAS library
        self.config.lapacklib = '-L' + os.path.join(
            self.prefix, 'lib') + ' -ltmg ' + self.config.lapacklib

        os.chdir(savecwd)

        # Check if the installation is successful
        self.plasma.verbose = 1
        self.check_tmg()
        self.plasma.verbose = 0
Beispiel #10
0
    def down_install(self):
        """ Download ind install ScaLAPACK """

        savecwd = os.getcwd()

        # creating the build and lib dirs if don't exist
        if not os.path.isdir(os.path.join(self.prefix, 'lib')):
            os.mkdir(os.path.join(self.prefix, 'lib'))

        if not os.path.isdir(os.path.join(self.prefix, 'include')):
            os.mkdir(os.path.join(self.prefix, 'include'))

        if not os.path.isdir(os.path.join(os.getcwd(), 'log')):
            os.mkdir(os.path.join(os.getcwd(), 'log'))

        if (not os.path.isfile(
                os.path.join(os.getcwd(), getURLName(self.scalapackurl)))):
            print "Downloading ScaLAPACK...",
            downloader(self.scalapackurl, self.downcmd)
            print "done"
        comm = 'gunzip -f scalapack.tgz'
        (output, error, retz) = runShellCommand(comm)
        if retz:
            print '\n\nScaLAPACK: cannot unzip scalapack.tgz'
            print 'error is:\n', '*' * 40, '\n', comm, '\n', error, '\n', '*' * 40
            sys.exit()

        comm = 'tar xf scalapack.tar'
        (output, error, retz) = runShellCommand(comm)
        if retz:
            print '\n\nScaLAPACK: cannot untar scalapack.tar'
            print 'error is:\n', '*' * 40, '\n', comm, '\n', error, '\n', '*' * 40
            sys.exit()
        os.remove('scalapack.tar')

        # change to ScaLAPACK dir
        # os.chdir(os.path.join(os.getcwd(),'scalapack-2.0.0'))
        comm = 'ls -1 | grep scalapack'
        (output, error, retz) = runShellCommand(comm)
        if retz:
            print '\n\nScaLAPACK: error changing to ScaLAPACK dir'
            print 'stderr:\n', '*' * 40, '\n', '   ->  no ScaLAPACK directory found', '\n', '*' * 40
            sys.exit()
        rep_name = output.replace("\n", "")
        print 'Installing ', rep_name, '...'
        rep_name = os.path.join(os.getcwd(), rep_name)

        os.chdir(rep_name)

        self.write_slmakeinc()

        print 'Compiling BLACS, PBLAS and ScaLAPACK...',
        sys.stdout.flush()
        comm = self.make + " lib"
        (output, error, retz) = runShellCommand(comm)
        if retz:
            print '\n\nScaLAPACK: error building ScaLAPACK'
            print 'error is:\n', '*' * 40, '\n', comm, '\n', error, '\n', '*' * 40
            writefile(os.path.join(savecwd, 'log/scalog'), output + error)
            sys.exit()

        fulllog = os.path.join(savecwd, 'log/scalog')
        writefile(fulllog, output + error)
        print 'done'
        # move lib to the lib directory
        shutil.copy('libscalapack.a',
                    os.path.join(self.prefix, 'lib/libscalapack.a'))
        self.config.scalapacklib = '-L' + os.path.join(self.prefix,
                                                       'lib') + ' -lscalapack'
        print "Getting ScaLAPACK version number...",
        # This function simply calls ScaLAPACK pilaver routine and then
        # checks if compilation, linking and execution are succesful

        sys.stdout.flush()
        writefile(
            'tmpf.f', """

      PROGRAM ScaLAPACK_VERSION
*
      INTEGER MAJOR, MINOR, PATCH
*
      CALL PILAVER ( MAJOR, MINOR, PATCH )
      WRITE(*,  FMT = 9999 ) MAJOR, MINOR, PATCH
*
 9999 FORMAT(I1,'.',I1,'.',I1)
      END\n""")

        ldflg = self.config.scalapacklib + ' ' + self.config.lapacklib + ' ' + self.config.blaslib + ' ' + self.config.ldflags_fc + ' -lm'
        ccomm = self.config.fc + ' -o tmpf ' + 'tmpf.f ' + ldflg
        (output, error, retz) = runShellCommand(ccomm)

        if (retz != 0):
            print 'error is:\n', '*' * 40, '\n', ccomm, '\n', error, '\n', '*' * 40
        else:
            comm = './tmpf'
            (output, error, retz) = runShellCommand(comm)
            if (retz != 0):
                print 'cannot get ScaLAPACK version number.'
                print 'error is:\n', '*' * 40, '\n', comm, '\n', error, '\n', '*' * 40
            else:
                print output,
            killfiles(['tmpf'])
        print 'Installation of ScaLAPACK successful.'
        print '(log is in ', fulllog, ')'

        if self.testing == 1:
            filename = os.path.join(savecwd, 'log/sca_testing')
            myfile = open(filename, 'w')

            print 'Compiling test routines...',
            sys.stdout.flush()
            comm = self.make + ' exe'
            (output, error, retz) = runShellCommand(comm)
            myfile.write(output + error)
            if (retz != 0):
                print '\n\nScaLAPACK: error building ScaLAPACK test routines'
                print 'stderr:\n', '*' * 40, '\n', error, '\n', '*' * 40
                writefile(os.path.join(savecwd, 'log/scalog'), output + error)
                sys.exit()

            print 'done'

            # TESTING

            print 'Running BLACS test routines...',
            sys.stdout.flush()
            os.chdir(os.path.join(os.getcwd(), 'BLACS/TESTING'))
            a = ['xCbtest', 'xFbtest']
            for testing_exe in a:
                myfile.write(
                    '\n   *************************************************  \n'
                )
                myfile.write('   ***                   OUTPUT BLACS TESTING ' +
                             testing_exe + '                   ***  \n')
                myfile.write(
                    '   *************************************************  \n')
                comm = self.config.mpirun + ' -np 4 ./' + testing_exe
                (output, error, retz) = runShellCommand(comm)
                myfile.write(output + error)
                if (retz != 0):
                    # This is normal to exit in Error for the BLACS TESTING (good behaviour)
                    # So we are going to check that the output have the last line of the testing : DONE BLACS_GRIDEXIT
                    if output.find('DONE BLACS_GRIDEXIT') == -1:
                        print '\n\nBLACS: error running BLACS test routines ' + testing_exe
                        print '\n\nBLACS: Command ' + comm
                        print 'stderr:\n', '*' * 40, '\n', error, '\n', '*' * 40
                        myfile.close()
                        sys.exit()
            os.chdir(os.path.join(os.getcwd(), '../..'))
            print 'done'

            print 'Running PBLAS test routines...',
            sys.stdout.flush()
            os.chdir(os.path.join(os.getcwd(), 'PBLAS/TESTING'))
            a = ['xcpblas1tst', 'xdpblas1tst', 'xspblas1tst', 'xzpblas1tst']
            a.extend(
                ['xcpblas2tst', 'xdpblas2tst', 'xspblas2tst', 'xzpblas2tst'])
            a.extend(
                ['xcpblas3tst', 'xdpblas3tst', 'xspblas3tst', 'xzpblas3tst'])
            for testing_exe in a:
                myfile.write(
                    '\n   *************************************************  \n'
                )
                myfile.write('   ***                   OUTPUT PBLAS TESTING ' +
                             testing_exe + '                   ***  \n')
                myfile.write(
                    '   *************************************************  \n')
                comm = self.config.mpirun + ' -np 4 ./' + testing_exe
                (output, error, retz) = runShellCommand(comm)
                myfile.write(output + error)
                if (retz != 0):
                    print '\n\nPBLAS: error running PBLAS test routines ' + testing_exe
                    print '\n\nPBLAS: Command ' + comm
                    print 'stderr:\n', '*' * 40, '\n', error, '\n', '*' * 40
                    myfile.close()
                    sys.exit()
            os.chdir(os.path.join(os.getcwd(), '../..'))
            print 'done'

            print 'Running REDIST test routines...',
            sys.stdout.flush()
            os.chdir(os.path.join(os.getcwd(), 'REDIST/TESTING'))
            a = [
                'xcgemr', 'xctrmr', 'xdgemr', 'xdtrmr', 'xigemr', 'xitrmr',
                'xsgemr', 'xstrmr', 'xzgemr', 'xztrmr'
            ]
            for testing_exe in a:
                myfile.write(
                    '\n   *************************************************  \n'
                )
                myfile.write(
                    '   ***                   OUTPUT REDIST TESTING ' +
                    testing_exe + '                   ***  \n')
                myfile.write(
                    '   *************************************************  \n')
                comm = self.config.mpirun + ' -np 4 ./' + testing_exe
                (output, error, retz) = runShellCommand(comm)
                myfile.write(output + error)
                if (retz != 0):
                    print '\n\nREDIST: error running REDIST test routines ' + testing_exe
                    print '\n\nREDIST: Command ' + comm
                    print 'stderr:\n', '*' * 40, '\n', error, '\n', '*' * 40
                    myfile.close()
                    sys.exit()
            os.chdir(os.path.join(os.getcwd(), '../..'))
            print 'done'

            print 'Running (some) ScaLAPACK test routines...',
            sys.stdout.flush()
            os.chdir(os.path.join(os.getcwd(), 'TESTING'))
            a = ['xslu', 'xdlu', 'xclu', 'xzlu']
            a.extend(['xsqr', 'xdqr', 'xcqr', 'xzqr'])
            a.extend(['xsinv', 'xdinv', 'xcinv', 'xzinv'])
            a.extend(['xsllt', 'xdllt', 'xcllt', 'xzllt'])
            a.extend(['xshrd', 'xdhrd', 'xchrd', 'xzhrd'])
            a.extend(['xsls', 'xdls', 'xcls', 'xzls'])
            a.extend(['xssyevr', 'xdsyevr', 'xcheevr', 'xzheevr'])
            a.extend(['xshseqr', 'xdhseqr'])

            for testing_exe in a:
                myfile.write(
                    '\n   *************************************************  \n'
                )
                myfile.write(
                    '   ***                   OUTPUT ScaLAPACK TESTING ' +
                    testing_exe + '                   ***  \n')
                myfile.write(
                    '   *************************************************  \n')
                comm = self.config.mpirun + ' -np 4 ./' + testing_exe
                (output, error, retz) = runShellCommand(comm)
                myfile.write(output + error)
                if (retz != 0):
                    print '\n\nScaLAPACK: error running ScaLAPACK test routines ' + testing_exe
                    print '\n\nScaLAPACK: Command ' + comm
                    print 'stderr:\n', '*' * 40, '\n', error, '\n', '*' * 40
                    myfile.close()
                    sys.exit()
            os.chdir(os.path.join(os.getcwd(), '..'))
            print 'done'
            myfile.close()

        os.chdir(savecwd)
        print "ScaLAPACK is installed. Use it in moderation :-)"