12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- !### macro's #####################################################
- !
- #define TRACEBACK write (gol,'("in ",a," (",a,", line",i5,")")') rname, __FILE__, __LINE__; call goErr
- #define IF_NOTOK_RETURN(action) if (status/=0) then; TRACEBACK; action; return; end if
- #define IF_ERROR_RETURN(action) if (status> 0) then; TRACEBACK; action; return; end if
- !
- #include "tm5.inc"
- !
- !#################################################################
- module OMP_ParTools
- use GO, only : gol, goPr, goErr
- use partools, only : isRoot
- public :: TM5_OMP_Init
-
- ! --- const --------------------------------------
- character(len=*), parameter :: mname = 'OMP_ParTools'
-
- ! --- var --------------------------------------
-
- integer :: omp_mytask, omp_ntasks
- !$OMP THREADPRIVATE (omp_mytask, omp_ntasks)
-
- contains
- ! ===================================================
- subroutine TM5_OMP_Init ( status )
- implicit none
- integer, intent(out) :: status
-
- ! Functions
- integer :: omp_get_thread_num, omp_get_num_threads
- !$OMP PARALLEL &
- !$OMP default (none)
- #ifdef _OPENMP
- omp_mytask = omp_get_thread_num()
- omp_ntasks = omp_get_num_threads()
- write(gol,*)'OMP. ntasks: ',omp_ntasks,', my_task: ',omp_mytask ; call goPr
- #else
- omp_mytask = 0
- omp_ntasks = 1
- if(isRoot) then
- write(gol,*)'No OpenMP parallelization used' ; call goPr
- endif
- #endif
-
- !$OMP END PARALLEL
- status = 0
- return
- end subroutine TM5_OMP_Init
- end module OMP_ParTools
-
-
-
|