← Back to team overview

dolfin team mailing list archive

Re: Issues when compiling DOLFIN without MPI

 

On Wed, Aug 20, 2008 at 11:54 AM, Marie Rognes <meg@xxxxxxxxxxx> wrote:
> Jed Brown wrote:
>> On Wed 2008-08-20 17:35, Marie Rognes wrote:
>>
>>> Matthew Knepley wrote:
>>>
>>>> On Wed, Aug 20, 2008 at 5:08 AM, Garth N. Wells <gnw20@xxxxxxxxx> wrote:
>>>>
>>>>
>>>>> Marie Rognes wrote:
>>>>>
>>>>>
>>>>>> Garth N. Wells wrote:
>>>>>>
>>>>>>
>>>>>>> Marie Rognes wrote:
>>>>>>>
>>>>>>>
>>>>>>>> I'm trying to compile dolfin with PETSc and SLEPc, but without MPI:
>>>>>>>>
>>>>>>>>      ./scons.local enableMpi=no withPetscDir=$PETSC_DIR
>>>>>>>>     withSlepcDir=$SLEPC_DIR
>>>>>>>>
>>>>>>>> This gives the following error:
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>> Hopefully this is fixed now, although my PETSc is built with MPI, so I
>>>>>>> can't be sure. Let me know if it's ok or otherwise.
>>>>>>>
>>>>>>>
>>>>>> I get through the compilation stage now, so that's good :)
>>>>>>
>>>>>> However, if I try to "import dolfin", I get:
>>>>>>
>>>>>>        Python 2.5.2 (r252:60911, Jun 19 2008, 15:12:17)
>>>>>>    [GCC 4.1.2 (Gentoo 4.1.2 p1.0.2)] on linux2
>>>>>>    Type "help", "copyright", "credits" or "license" for more information.
>>>>>>     >>> import dolfin
>>>>>>    Traceback (most recent call last):
>>>>>>      File "<stdin>", line 1, in <module>
>>>>>>      File
>>>>>>
>>>>>> "/home/meg/src/dolfin/dolfin/local/lib/python2.5/site-packages/dolfin/__init__.py",
>>>>>>
>>>>>>    line 13, in <module>
>>>>>>        from assemble import *
>>>>>>      File
>>>>>>
>>>>>> "/home/meg/src/dolfin/dolfin/local/lib/python2.5/site-packages/dolfin/assemble.py",
>>>>>>
>>>>>>    line 22, in <module>
>>>>>>        from dolfin import *
>>>>>>      File
>>>>>>
>>>>>> "/home/meg/src/dolfin/dolfin/local/lib/python2.5/site-packages/dolfin/dolfin.py",
>>>>>>
>>>>>>    line 7, in <module>
>>>>>>        import _dolfin
>>>>>>    ImportError: /home/meg/src/dolfin/dolfin/local/lib/libdolfin.so:
>>>>>>    undefined symbol: MPIUNI_TMP
>>>>>>
>>>>>>
>>>>>>
>>>>> Looks like a linking problem to PETSc. Can you compile C++ DOLFIN programs?
>>>>>
>>>>>
>>>>
>>>>
>>> Nope. The cpp poisson demo gives:
>>>
>>> meg in cpp >> scons
>>> scons: Reading SConscript files ...
>>> scons: done reading SConscript files.
>>> scons: Building targets ...
>>> c++ -o main.o -c -Wall -pipe -ansi -g -Werror -O2 -fno-strict-aliasing
>>> -pthread -DDEBUG -DNDEBUG -DPACKAGE_VERSION="0.8.0" -DHAS_PETSC=1
>>> -DHAS_SLEPC=1 -DHAS_UMFPACK=1 -DHAS_GTS=1
>>> -I/home/meg/src/dolfin/dolfin/local/include
>>> -I/usr/lib/python2.5/site-packages/numpy/core/include
>>> -I/home/meg/src/slepc -I/home/meg/src/slepc/include
>>> -I/usr/include/python2.5 -I/home/meg/src/petsc/bmake/linux-gnu-c-debug
>>> -I/home/meg/src/petsc/include
>>> -I/home/meg/src/petsc-2.3.3-p13/include/mpiuni -I/usr/include/libxml2
>>> -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include main.cpp
>>> c++ -o demo -Wl,-rpath,/home/meg/src/slepc/lib/linux-gnu-c-debug
>>> -Wl,-rpath,/home/meg/src/petsc/lib/linux-gnu-c-debug -pthread
>>> -Wl,--export-dynamic main.o -L/home/meg/src/dolfin/dolfin/local/lib
>>> -L/home/meg/src/slepc/lib/linux-gnu-c-debug -L/usr/lib/atlas
>>> -L/home/meg/src/petsc/lib/linux-gnu-c-debug -ldolfin -lslepc -lblas
>>> -lumfpack -lamd -lgts -lxml2 -lpetscts -lpetscsnes -lpetscksp -lpetscdm
>>> -lpetscmat -lpetscvec -lpetsc -lgthread-2.0 -lrt -lgmodule-2.0 -ldl
>>> -lglib-2.0
>>> /home/meg/src/dolfin/dolfin/local/lib/libdolfin.so: undefined reference
>>> to `Petsc_MPI_Abort'
>>>
>>>
>>>> Almost  certainly it is an incomplete link line when libdolfin.so is
>>>> constructed. When PETSc
>>>> is built without MPI, it creates an extra library (libmpiuni) which
>>>> must be linked against to
>>>> get these symbols.
>>>>
>>>>
>>> I'm not quite sure what that implies... But, I should somehow add
>>> -lmpiuni when linking dolfin? For instance in the pkgconfig file scons
>>> creates for petsc?
>>>
>>
>> What does the it look like when you build a PETSc demo?  What should be
>> on the `Libs:' line of petsc.pc is the result of the following:
>>
>> echo -e 'include ${PETSC_DIR}/bmake/common/base\nlink:\n\t-@echo ${PETSC_LIB}' | make PETSC_DIR=~/usr/petsc-2* PETSC_ARCH=ompic-opt -f - link
>>
>> It will probably be ugly and often has lots of repetition for no
>> apparent reason.  However, it should be reliable.
>>
>
>
> Hurray! My DOLFIN is back among the living. (Now, I just need to get it
> to understand that SLEPc is hanging around as well.)
>
> Just adding -lmpiuni to petsc.pc did not help. Adding the output of
>
>    echo -e 'include ${PETSC_DIR}/bmake/common/base\nlink:\n\t-@echo
> ${PETSC_LIB}' |     make -f - link
>
> did. Thanks a lot!
>
> However, there should probably be a prettier way of doing this?

Yes, of course. The prettier way is to actually use the information we give

  1) at the end of configure

  2) in the configure.log

  3) in RDict.db (Python pickle)

  4) in the makefile (make getincludedirs, make getlinklibs)

  5) in the conf files (petscvariables, petsconf.h)

instead of ignoring it and hardcoding something into scons.

  Matt

> --
> Marie E. Rognes
> Ph.D Fellow,
> Centre of Mathematics for Applications,
> University of Oslo
> http://folk.uio.no/meg
>
> _______________________________________________
> DOLFIN-dev mailing list
> DOLFIN-dev@xxxxxxxxxx
> http://www.fenics.org/mailman/listinfo/dolfin-dev
-- 
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


Follow ups

References