Esempio n. 1
0
    def make(self):
        """
        Build with make and correct make options
        """

        for envvar in ["MPICC", "LIBLAPACK_MT", "CPPFLAGS", "LDFLAGS", "CFLAGS"]:
            if not os.getenv(envvar):
                self.log.error("Required environment variable %s not found (no toolkit used?)." % envvar)

        # build dir
        extra_makeopts = 'TOPdir="%s" ' % self.getcfg("startfrom")

        # compilers
        extra_makeopts += 'CC="%(mpicc)s" MPICC="%(mpicc)s" LINKER="%(mpicc)s" ' % {"mpicc": os.getenv("MPICC")}

        # libraries: LAPACK and FFTW
        extra_makeopts += 'LAlib="%s %s" ' % (os.getenv("LIBFFT"), os.getenv("LIBLAPACK_MT"))

        # HPL options
        extra_makeopts += 'HPL_OPTS="%s -DUSING_FFTW" ' % os.getenv("CPPFLAGS")

        # linker flags
        extra_makeopts += 'LINKFLAGS="%s" ' % os.getenv("LDFLAGS")

        # C compilers flags
        extra_makeopts += "CCFLAGS='$(HPL_DEFS) %s' " % os.getenv("CFLAGS")

        # set options and build
        self.updatecfg("makeopts", extra_makeopts)
        Application.make(self)
Esempio n. 2
0
    def make(self):
        """
        Only build when we're not testing.
        """
        if self.getcfg('test_only'):
            return

        else:
            # default make suffices (for now)
            Application.make(self)
Esempio n. 3
0
    def make(self):
        """Build by supplying required make options, and running make."""

        jasper = get_software_root('JASPER')
        if not jasper:
            self.log.error("JasPer module not loaded?")

        makeopts = 'CC="%s" FC="%s" INCDIR="-I%s/include"' % (os.getenv('CC'), os.getenv('F90'), jasper)
        self.updatecfg('makeopts', makeopts)

        Application.make(self)
Esempio n. 4
0
    def make(self):
        """Build by supplying required make options, and running make."""

        jasper = get_software_root("JASPER")
        if not jasper:
            self.log.error("JasPer module not loaded?")

        # beware: g2clib uses INC, while g2lib uses INCDIR !
        makeopts = 'CC="%s" FC="%s" INC="-I%s/include"' % (os.getenv("CC"), os.getenv("F90"), jasper)
        self.updatecfg("makeopts", makeopts)

        Application.make(self)
Esempio n. 5
0
    def make(self, verbose=False):

        # default make is fine
        Application.make(self, verbose=verbose)

        # optionally also build shared libs
        if self.getcfg('sharedlibs'):
            try:
                os.chdir('lib')
            except OSError, err:
                self.log.error("Failed to change to 'lib' directory for building the shared libs." % err)

            self.log.debug("Building shared libraries")
            cmd = "make shared cshared ptshared cptshared"
            run_cmd(cmd, log_all=True, simple=True)

            try:
                os.chdir('..')
            except OSError, err:
                self.log.error("Failed to get back to previous dir after building shared libs: %s " % err)
Esempio n. 6
0
    def make(self):
        """Build ScaLAPACK using make after setting make options."""

        # MPI compiler commands
        if os.getenv('MPICC') and os.getenv('MPIF77') and os.getenv('MPIF90'):
            mpicc = os.getenv('MPICC')
            mpif77 = os.getenv('MPIF77')
            mpif90 = os.getenv('MPIF90')
        elif self.toolkit().mpi_type() in [toolkit.OPENMPI, toolkit.MVAPICH2]:
            mpicc = 'mpicc'
            mpif77 = 'mpif77'
            mpif90 = 'mpif90'
        else:
            self.log.error("Don't know which compiler commands to use.")

        # set BLAS and LAPACK libs
        extra_makeopts = [
                          'BLASLIB="%s -lpthread"' % get_blas_lib(self.log), 
                          'LAPACKLIB=%s/lib/liblapack.a' % get_software_root('LAPACK')
                         ]

        # build procedure changed in v2.0.0
        if self.loosever < LooseVersion("2.0.0"):

            blacs = get_software_root('BLACS')

            # determine interface
            interface = det_interface(self.log, os.path.join(blacs, 'bin'))

            # set build and BLACS dir correctly
            extra_makeopts.append('home=%s BLACSdir=%s' % (self.getcfg('startfrom'), blacs))

            # set BLACS libs correctly
            for (var, lib) in [
                               ('BLACSFINIT', "F77init"),
                               ('BLACSCINIT', "Cinit"),
                               ('BLACSLIB', "")
                              ]:
                extra_makeopts.append('%s=%s/lib/libblacs%s.a' % (var, blacs, lib))

            # set compilers and options
            noopt = ''
            if self.toolkit().opts['noopt']:
                noopt += " -O0"
            if self.toolkit().opts['pic']:
                noopt += " -fPIC"
            extra_makeopts += [
                               'F77="%s"' % mpif77,
                               'CC="%s"' % mpicc,
                               'NOOPT="%s"' % noopt,
                               'CCFLAGS="-O3"'
                              ]

            # set interface
            extra_makeopts.append("CDEFS='-D%s -DNO_IEEE $(USEMPI)'" % interface)

        else:

            # determine interface
            if self.toolkit().mpi_type() in [toolkit.OPENMPI, toolkit.MVAPICH2]:
                interface = 'Add_'
            else:
                self.log.error("Don't know which interface to pick for the MPI library being used.")

            # set compilers and options
            extra_makeopts += [
                               'FC="%s"' % mpif90, 
                               'CC="%s"' % mpicc
                              ]

            # set interface
            extra_makeopts.append('CDEFS="-D%s"' % interface)

        # update make opts, and make
        self.updatecfg('makeopts', ' '.join(extra_makeopts))

        Application.make(self)
Esempio n. 7
0
            os.chdir(cwd)
        except OSError, err:
            self.log.error("Failed to determine interface and transcomm settings: %s" % err)

        opts.update({
                     'comm': comm,
                     'int': interface,
                     'base': base
                    })

        add_makeopts = ' MPICC=%(mpicc)s MPIF77=%(mpif77)s %(comm)s ' % opts
        add_makeopts += ' INTERFACE=%(int)s MPIdir=%(base)s BTOPdir=%(builddir)s mpi ' % opts

        self.updatecfg('makeopts', add_makeopts)

        Application.make(self)

    def make_install(self):
        """Install by copying files to install dir."""

        # include files
        src = os.path.join(self.getcfg('startfrom'), 'LIB')

        # include files and libraries
        for (srcdir, destdir, ext) in [
                                       (os.path.join("SRC", "MPI"), "include", ".h"),  # include files
                                       ("LIB", "lib", ".a"),  # libraries
                                       ]:

            src = os.path.join(self.getcfg('startfrom'), srcdir)
            dest = os.path.join(self.installdir, destdir)