[petsc-dev] VecView problem in fortran

Barry Smith bsmith at mcs.anl.gov
Mon Mar 16 21:21:09 CDT 2015


  Works fine for me:

$ petscmpiexec -n 2 ./ex1f
Vec Object: 2 MPI processes
  type: mpi
Process [0]
0
0
0
0
0
Process [1]
0
0
0
0
0
~/Src/petsc/test-dir (next=) arch-debug
$ cat ./ex1f.F90 
program test

  implicit none

#include <petsc-finclude/petscsys.h>
#include <petsc-finclude/petscvec.h>

  MPI_Comm :: comm
  PetscErrorCode :: ierr
  Vec :: v
  PetscInt, parameter :: dim = 10

  call PetscInitialize(PETSC_NULL_CHARACTER, ierr); CHKERRQ(ierr)
  comm = PETSC_COMM_WORLD

  call VecCreateMPI(comm, PETSC_DECIDE, dim, v, ierr); CHKERRQ(ierr)

  call VecView(v, PETSC_VIEWER_STDOUT_WORLD, ierr); CHKERRQ(ierr)

  call VecDestroy(v, ierr); CHKERRQ(ierr)
  call PetscFinalize(ierr); CHKERRQ(ierr)

end program test
~/Src/petsc/test-dir (next=) arch-debug


I cannot explain why it doesn't work for you. What about one process? Can you run in the debugger and put a break point in VecView()

Barry


> On Mar 16, 2015, at 8:00 PM, Adrian Croucher <a.croucher at auckland.ac.nz> wrote:
> 
> hi,
> 
> The attached minimal C test program to create a Vec and view it produces the output I expect:
> 
> acro018 at des108:~/software/PETSc/tests/dmda$ mpirun -np 2 testc
> Vec Object: 2 MPI processes
>  type: mpi
> Process [0]
> 0
> 0
> 0
> 0
> 0
> Process [1]
> 0
> 0
> 0
> 0
> 0
> 
> But the attached Fortran program, which I thought should do the same, produces no output at all. Am I missing something? I'm running 'next' branch.
> 
> Cheers, Adrian
> 
> -- 
> Dr Adrian Croucher
> Senior Research Fellow
> Department of Engineering Science
> University of Auckland, New Zealand
> email: a.croucher at auckland.ac.nz
> tel: +64 (0)9 923 84611
> 
> <test.F90><testc.c>




More information about the petsc-dev mailing list