
Program driver_pc

#ifdef PETSC
#include <petscversion.h>
#if (PETSC_VERSION_MAJOR >= 3 && PETSC_VERSION_MINOR >= 8)
#include <petsc/finclude/petscsys.h>
      use petscsys
#endif
#endif

#ifdef PETSC
      use petsc_mpi_common, only : petsc_mpi_initialize,               &
                                   petsc_mpi_finalize
#endif


      implicit none
#ifdef PETSC
#if (PETSC_VERSION_MAJOR >= 3 && PETSC_VERSION_MINOR >= 6 && PETSC_VERSION_MINOR < 8)
#include <petsc/finclude/petscsys.h>
#elif (PETSC_VERSION_MAJOR >= 3 && PETSC_VERSION_MINOR < 6)
#include <finclude/petscsys.h>
#endif
#endif

      integer :: rank, nprcs


!c  initialize MPI parallel environment  
#ifdef PETSC
      call petsc_mpi_initialize(rank, nprcs)
#endif

#ifdef STANDARD_FORTRAN
      if (rank == 0) then
        write(*,*) 'compiled by STANDARD_FORTRAN compiler'
      end if
#else
      if (rank == 0) then
        write(*,*) 'compiled by other FORTRAN compiler'
      end if
#endif

      write(*,*) 'called by rank ',rank
      
!c    finalize petsc solver
#ifdef PETSC
      call petsc_mpi_finalize
#endif

      !c stop
      
End Program
