module abort_mod
   implicit none

contains

  !!!Abort execution
   subroutine dynamico_abort(message)
      use mpi_mod
      implicit none
      character(len=*), optional, intent(in) :: message
      integer :: ierr

      !$omp single
      print *, "Abort !"
      if (present(message)) print *, message
      call MPI_Abort(MPI_COMM_WORLD, -1, ierr)
      !$omp end single
   end subroutine

  !!!Abort execution when openacc is on
   subroutine abort_acc(message)
      use mpi_mod
      implicit none
      character(len=*), optional, intent(in) :: message
#ifdef _OPENACC
      call dynamico_abort("Not tested with OpenACC ! "//message)
#endif
   end subroutine
end module
