program test implicit none ! Include files #include "finclude/petsc.h" PetscViewer :: bview PetscInt :: rank, ierr character (len=100) :: cstring character (len=2) :: c1 call PetscInitialize(PETSC_NULL_CHARACTER,ierr) call MPI_Comm_rank(PETSC_COMM_WORLD,rank,ierr) call PetscViewerASCIIOpen(PETSC_COMM_WORLD,'Test.txt',bview,ierr) call PetscViewerASCIISynchronizedAllow(bview,PETSC_TRUE,ierr) write(c1,'(i2)') rank cstring='My rank is '//c1//'\n' if (rank == 1) call PetscViewerASCIISynchronizedPrintf(bview,TRIM(cstring),ierr) call PetscViewerFlush(bview,ierr) call PetscFinalize(ierr) end program test