hi,

The attached minimal C test program to create a Vec and view it produces the output I expect:

acro018@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: [email protected]
tel: +64 (0)9 923 84611

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
#include <petscvec.h>

int main(int argc, char **argv)
{
  MPI_Comm comm;
  PetscErrorCode ierr;
  Vec v;
  PetscInt dim = 10;

  ierr = PetscInitialize(&argc, &argv, NULL, NULL);CHKERRQ(ierr);
  comm = PETSC_COMM_WORLD;
  
  ierr = VecCreateMPI(comm, PETSC_DECIDE, dim, &v); CHKERRQ(ierr);
  ierr = VecView(v, PETSC_VIEWER_STDOUT_WORLD); CHKERRQ(ierr);

  ierr = VecDestroy(&v); CHKERRQ(ierr);
  ierr = PetscFinalize();
  return 0;

}

Reply via email to