Actual source code: ex38f.F90

petsc-3.15.0 2021-03-30
Report Typos and Errors
  1: !
  2: !  Simple PETSc Program written in Fortran
  3: !
  4:        program main
  5: #include <petsc/finclude/petscsys.h>
  6:        use petscmpi  ! or mpi or mpi_f08
  7:        use petscsys
  8:        implicit none

 10:        PetscErrorCode  ierr
 11:        PetscInt f(1)
 12:        call PetscInitialize(PETSC_NULL_CHARACTER,ierr)
 13:        if (ierr .ne. 0) then
 14:          print*, 'Unable to begin PETSc program'
 15:        endif

 17:        f(1) = 1
 18:        call MPI_Allreduce(MPI_IN_PLACE,f,1,MPIU_INTEGER,MPI_MIN,PETSC_COMM_WORLD,ierr)
 19:        call PetscFinalize(ierr)
 20:        end

 22: !/*TEST
 23: !
 24: !   test:
 25: !
 26: !TEST*/