mpi not working

Ben Tay zonexo at gmail.com
Mon Jan 15 08:53:10 CST 2007


hi,

i install PETSc using the following command:

./config/configure.py --with-vendor-compilers=intel --with-gnu-compilers=0
--with-blas-lapack-dir=/lsftmp/g0306332/inter/mkl/lib/32
--with-mpi-dir=/opt/mpich/intel/ --with-x=0 --with-shared

then i got:

Compilers:

  C Compiler:         /opt/mpich/intel/bin/mpicc  -fPIC -g
  Fortran Compiler:   /opt/mpich/intel/bin/mpif90  -I. -fPIC -g -w90 -w
Linkers:
  Shared linker:   /opt/mpich/intel/bin/mpicc  -shared  -fPIC -g
  Dynamic linker:   /opt/mpich/intel/bin/mpicc  -shared  -fPIC -g
PETSc:
  PETSC_ARCH: linux-mpif90
  PETSC_DIR: /nas/lsftmp/g0306332/petsc-2.3.2-p8
  **
  ** Now build and test the libraries with "make all test"
  **
  Clanguage: C
  Scalar type:real
MPI:
  Includes: ['/opt/mpich/intel/include']
  PETSc shared libraries: enabled
  PETSc dynamic libraries: disabled
BLAS/LAPACK: -Wl,-rpath,/lsftmp/g0306332/inter/mkl/lib/32
-L/lsftmp/g0306332/inter/mkl/lib/32 -lmkl_lapack -lmkl_ia32 -lguide

i ran "make all test" and everything seems fine

/opt/mpich/intel/bin/mpicc -c -fPIC -g
-I/nas/lsftmp/g0306332/petsc-2.3.2-p8-I/nas/lsftmp/g0306332/petsc-
2.3.2-p8/bmake/linux-mpif90 -I/nas/lsftmp/g0306332/petsc-2.3.2-p8/include
-I/opt/mpich/intel/include -D__SDIR__="src/snes/examples/tutorials/" ex19.c
/opt/mpich/intel/bin/mpicc -fPIC -g  -o ex19
ex19.o-Wl,-rpath,/nas/lsftmp/g0306332/petsc-
2.3.2-p8/lib/linux-mpif90
-L/nas/lsftmp/g0306332/petsc-2.3.2-p8/lib/linux-mpif90
-lpetscsnes -lpetscksp -lpetscdm -lpetscmat -lpetscvec -lpetsc
-Wl,-rpath,/lsftmp/g0306332/inter/mkl/lib/32
-L/lsftmp/g0306332/inter/mkl/lib/32 -lmkl_lapack -lmkl_ia32 -lguide
-lPEPCF90 -Wl,-rpath,/opt/intel/compiler70/ia32/lib
-Wl,-rpath,/opt/mpich/intel/lib -L/opt/mpich/intel/lib -Wl,-rpath,-rpath
-Wl,-rpath,-ldl -L-ldl -lmpich -Wl,-rpath,/opt/intel/compiler70/ia32/lib
-Wl,-rpath,/opt/intel/compiler70/ia32/lib -L/opt/intel/compiler70/ia32/lib
-Wl,-rpath,/usr/lib -Wl,-rpath,/usr/lib -L/usr/lib -limf -lirc -lcprts -lcxa
-lunwind -ldl -lmpichf90 -lPEPCF90 -Wl,-rpath,/opt/intel/compiler70/ia32/lib
-L/opt/intel/compiler70/ia32/lib -Wl,-rpath,/usr/lib -L/usr/lib -lintrins
-lIEPCF90 -lF90 -lm  -Wl,-rpath,\ -Wl,-rpath,\ -L\ -ldl -lmpich
-Wl,-rpath,/opt/intel/compiler70/ia32/lib -L/opt/intel/compiler70/ia32/lib
-Wl,-rpath,/usr/lib -L/usr/lib -limf -lirc -lcprts -lcxa -lunwind -ldl
/bin/rm -f ex19.o
C/C++ example src/snes/examples/tutorials/ex19 run successfully with 1 MPI
process
C/C++ example src/snes/examples/tutorials/ex19 run successfully with 2 MPI
processes
Fortran example src/snes/examples/tutorials/ex5f run successfully with 1 MPI
process
Completed test examples

I then tried to run my own parallel code. It's a simple code which prints
the rank of each processor.

If I compile the code using just mpif90 test.F(using just mpif.h)

I get 0,1,2,3 (4 processors).

however, if i change the code to use petsc.h etc  ie.


        program ns2d_c

        implicit none


#include "include/finclude/petsc.h"
#include "include/finclude/petscvec.h"
#include "include/finclude/petscmat.h"
#include "include/finclude/petscksp.h"
#include "include/finclude/petscpc.h"
#include "include/finclude/petscmat.h90"

        integer,parameter :: size_x=8,size_y=4

        integer :: ierr,Istart_p,Iend_p,Ntot,Istart_m,Iend_m,k

 PetscMPIInt     nprocs,rank




call PetscInitialize(PETSC_NULL_CHARACTER,ierr)

        call MPI_Comm_rank(PETSC_COMM_WORLD,rank,ierr)

        call MPI_Comm_size(PETSC_COMM_WORLD,nprocs,ierr)

end program ns2d_c



i then rename the filename to ex2f.F and use "make ex2f"

the result I get is something like 0,0,0,0.



Why is this so?

Thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20070115/1723f9f8/attachment.htm>


More information about the petsc-users mailing list