[petsc-users] How to configure PETSc with gcc-4.9

Satish Balay balay at mcs.anl.gov
Fri Apr 25 00:46:04 CDT 2014


if you are primarily intesrested in -fopenmp - and not mpi - just
configure petsc with --with-mpi=0

If you have currently working build with clang - and would
like to just compile your code with gcc-4.9 - you can try:

export MPICH_CC=gcc-4.9
make [your-target]

It might work. Or you might get link errors. [If you get
errors - its best to rebuild PETSc with gcc-4.9]

BTW: you can use a different PETSC_ARCH for each of your builds - so
that they don't overwrite each other..

./configure PETSC_ARCH=arch-gcc --with-cc=gcc-4.9 --with-cxx=0 --with-mpi=0

[on osx petsc can use VecLib so --download-f-blas-lapack shouldn't be needed]

Satish

On Fri, 25 Apr 2014, Justin Dong wrote:

> I'll leave it running for a few hours and see what happens.
> 
> In the meantime, is it possible to tell PETSc to compile a specific .c file
> using gcc-4.9? Something along the lines of this:
> 
> ALL:
> 
> include ${PETSC_DIR}/conf/variables
> include ${PETSC_DIR}/conf/rules
> include ${PETSC_DIR}/conf/test
> 
> main: main.o
> gcc-4.9 -${CLINKER} -fopenmp -o main main.o ${PETSC_LIB}
> ${RM} -f main.o
> 
> The main reason I want to compile with gcc-4.9 is because I need to use
> openmp for a simple parallel for loop. With the gcc compiler I have now
> (clang), there's no support for openmp. I can get gcc-4.9 to work outside
> of PETSc, but am not sure how to get it to work here if I want to do it for
> a single example, or if that's even possible.
> 
> 
> On Thu, Apr 24, 2014 at 10:03 PM, Barry Smith <bsmith at mcs.anl.gov> wrote:
> 
> >
> >    Leave it to run for several hours it could be that gcc-4.9 is just
> > taking a very long time on mpich.
> >
> >    Barry
> >
> > On Apr 24, 2014, at 8:35 PM, Matthew Knepley <knepley at gmail.com> wrote:
> >
> > > On Thu, Apr 24, 2014 at 9:27 PM, Justin Dong <jsd1 at rice.edu> wrote:
> > > Hi all,
> > >
> > > I'm trying to configure PETSc on Mac OS X with gcc-4.9. Currently, it's
> > configured with gcc that comes with Xcode, but I want to use gcc-4.9 that I
> > installed myself. I try:
> > >
> > >
> > > ./configure --with-cc=gcc-4.9 --with-fc=gfortran
> > --download-f-blas-lapack --download-mpich
> > >
> > >
> > >
> > > But while configuring MPICH it gets stuck indefinitely. I've included
> > the output below after I terminate the process. I don't have this issue if
> > I just configure with cc=gcc. Any ideas what the problem is here?
> > >
> > > From the stack trace, its just taking a long time. If it overruns the
> > timeout, it should just die. You can try
> > > running using -useThreads=0 if you suspect the timeout is not working.
> > >
> > >    Matt
> > >
> > > ^CTraceback (most recent call last):
> > >
> > >   File "./configure", line 10, in <module>
> > >
> > >     execfile(os.path.join(os.path.dirname(__file__), 'config',
> > 'configure.py'))
> > >
> > >   File "./config/configure.py", line 372, in <module>
> > >
> > >     petsc_configure([])
> > >
> > >   File "./config/configure.py", line 287, in petsc_configure
> > >
> > >     framework.configure(out = sys.stdout)
> > >
> > >   File
> > "/Users/justindong/Classes/CAAMResearch/petsc-3.4.4/config/BuildSystem/config/framework.py",
> > line 933, in configure
> > >
> > >     child.configure()
> > >
> > >   File
> > "/Users/justindong/Classes/CAAMResearch/petsc-3.4.4/config/BuildSystem/config/package.py",
> > line 558, in configure
> > >
> > >     self.executeTest(self.configureLibrary)
> > >
> > >   File
> > "/Users/justindong/Classes/CAAMResearch/petsc-3.4.4/config/BuildSystem/config/base.py",
> > line 115, in executeTest
> > >
> > >     ret = apply(test, args,kargs)
> > >
> > >   File
> > "/Users/justindong/Classes/CAAMResearch/petsc-3.4.4/config/BuildSystem/config/packages/MPI.py",
> > line 748, in configureLibrary
> > >
> > >     config.package.Package.configureLibrary(self)
> > >
> > >   File
> > "/Users/justindong/Classes/CAAMResearch/petsc-3.4.4/config/BuildSystem/config/package.py",
> > line 486, in configureLibrary
> > >
> > >     for location, directory, lib, incl in self.generateGuesses():
> > >
> > >   File
> > "/Users/justindong/Classes/CAAMResearch/petsc-3.4.4/config/BuildSystem/config/package.py",
> > line 232, in generateGuesses
> > >
> > >     d = self.checkDownload(1)
> > >
> > >   File
> > "/Users/justindong/Classes/CAAMResearch/petsc-3.4.4/config/BuildSystem/config/packages/MPI.py",
> > line 351, in checkDownload
> > >
> > >     return config.package.Package.checkDownload(self, requireDownload)
> > >
> > >   File
> > "/Users/justindong/Classes/CAAMResearch/petsc-3.4.4/config/BuildSystem/config/package.py",
> > line 340, in checkDownload
> > >
> > >     return self.getInstallDir()
> > >
> > >   File
> > "/Users/justindong/Classes/CAAMResearch/petsc-3.4.4/config/BuildSystem/config/package.py",
> > line 187, in getInstallDir
> > >
> > >     return os.path.abspath(self.Install())
> > >
> > >   File
> > "/Users/justindong/Classes/CAAMResearch/petsc-3.4.4/config/BuildSystem/config/packages/MPI.py",
> > line 366, in Install
> > >
> > >     return self.InstallMPICH()
> > >
> > >   File
> > "/Users/justindong/Classes/CAAMResearch/petsc-3.4.4/config/BuildSystem/config/packages/MPI.py",
> > line 544, in InstallMPICH
> > >
> > >     output,err,ret  = config.base.Configure.executeShellCommand('cd
> > '+mpichDir+' && ./configure '+args, timeout=2000, log = self.framework.log)
> > >
> > >   File
> > "/Users/justindong/Classes/CAAMResearch/petsc-3.4.4/config/BuildSystem/script.py",
> > line 254, in executeShellCommand
> > >
> > >     (output, error, status) = runInShell(command, log, cwd)
> > >
> > >   File
> > "/Users/justindong/Classes/CAAMResearch/petsc-3.4.4/config/BuildSystem/script.py",
> > line 243, in runInShell
> > >
> > >     thread.join(timeout)
> > >
> > >   File
> > "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py",
> > line 958, in join
> > >
> > >     self.__block.wait(delay)
> > >
> > >   File
> > "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py",
> > line 358, in wait
> > >
> > >     _sleep(delay)
> > >
> > >
> > > KeyboardInterrupt
> > >
> > >
> > >
> > >
> > >
> > > Sincerely,
> > >
> > > Justin
> > >
> > >
> > >
> > >
> > > --
> > > What most experimenters take for granted before they begin their
> > experiments is infinitely more interesting than any results to which their
> > experiments lead.
> > > -- Norbert Wiener
> >
> >
> 



More information about the petsc-users mailing list