more detailed comments

This commit is contained in:
Martin Diehl 2018-02-12 11:46:01 +01:00
parent b6abbfca9d
commit 4e62d7793a
2 changed files with 6 additions and 2 deletions

View File

@ -831,6 +831,8 @@ subroutine quit(stop_id)
call PETScFinalize(ierr) call PETScFinalize(ierr)
if (ierr /= 0) write(6,'(a)') ' Error in PETScFinalize' if (ierr /= 0) write(6,'(a)') ' Error in PETScFinalize'
#ifdef _OPENMP #ifdef _OPENMP
! If openMP is enabled, MPI is initialized before and independently of PETSc. Hence, also
! take care of the finalization
call MPI_finalize(error) call MPI_finalize(error)
if (error /= 0) write(6,'(a)') ' Error in MPI_finalize' if (error /= 0) write(6,'(a)') ' Error in MPI_finalize'
#endif #endif

View File

@ -82,8 +82,10 @@ subroutine DAMASK_interface_init()
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! PETSc Init ! PETSc Init
#ifdef _OPENMP #ifdef _OPENM
call MPI_Init_Thread(MPI_THREAD_FUNNELED,threadLevel,ierr);CHKERRQ(ierr) ! in case of OpenMP, don't rely on PETScInitialize doing MPI init ! If openMP is enabled, check if the MPI libary supports it and initialize accordingly.
! Otherwise, the first call to PETSc will do the initialization.
call MPI_Init_Thread(MPI_THREAD_FUNNELED,threadLevel,ierr);CHKERRQ(ierr)
if (threadLevel<MPI_THREAD_FUNNELED) then if (threadLevel<MPI_THREAD_FUNNELED) then
write(6,'(a)') ' MPI library does not support OpenMP' write(6,'(a)') ' MPI library does not support OpenMP'
call quit(1_pInt) call quit(1_pInt)