Compiler dies at OpenMP entry region

SUBROUTINE SetRtSrc(Core, Fxr, src, phis, psi, axsrc, xstr1g, &
                    eigv, iz, ig, ng, GroupInfo, l3dim, lxslib, lscat1, lNegFix, PE)
USE PARAM
USE TYPEDEF,        ONLY : coreinfo_type,          Fxrinfo_type,          Cell_Type,      & 
                           pin_Type,               GroupInfo_Type,        PE_TYPE,        &
                           XsMac_Type
USE BenchXs,        ONLY : GetChiBen,              xssben
USE MacXsLib_mod,   ONLY : MacXsScatMatrix
USE BasicOperation, ONLY : CP_CA
USE OMP_LIB
IMPLICIT NONE

TYPE(CoreInfo_Type) :: Core
TYPE(FxrInfo_Type) :: Fxr(:)
TYPE(GroupInfo_Type) :: GroupInfo
TYPE(PE_TYPE) :: PE
REAL(8) :: src(:), phis(:, :, :), psi(:, :), AxSrc(:), xstr1g(:)
REAL(8) :: eigv
INTEGER :: myzb, myze, ig, ng, iz, ifsr, ifxr
LOGICAL :: lxslib, lscat1, l3dim
LOGICAL :: lNegFix


TYPE(Pin_Type), POINTER :: Pin(:)
TYPE(Cell_Type), POINTER :: CellInfo(:)
TYPE(XsMac_Type), SAVE :: XsMac(nTHREADMAX)
INTEGER :: nxy, nCoreFsr, nCoreFxr, FsrIdxSt, FxrIdxSt, nlocalFxr, nFsrInFxr, nchi
INTEGER :: ipin, icel, ifsrlocal, itype, ig2, tid
INTEGER :: i, j, k

REAL(8) :: reigv
REAL(8) ::  chi(ng)
REAL(8), POINTER :: xsmacs(:,:)

LOGICAL :: lscat1sum
LOGICAL :: lNegSrcFix
Pin => Core%Pin
CellInfo => Core%CellInfo
nCoreFsr = Core%nCoreFsr
nCoreFxr = Core%nCoreFxr
nxy = Core%nxy

reigv = one/eigv
lscat1sum = lscat1

lNegSrcFix = FALSE
IF(lNegFix) lNegSrcFix = TRUE


IF(.NOT. lxsLib) THEN
  DO i = 1, PE%nThread
    ALLOCATE(XsMac(i)%XsMacSm(ng, ng))
  ENDDO
ENDIF

CALL CP_CA(src(:), zero, nCoreFxr)
!IF(.NOT. lxsLib) CALL CP_CA(xsmacs, zero, ng, ng)
IF(lxsLib) nchi = GroupInfo%nchi

tid = 1
!$  call omp_set_dynamic(.FALSE.)
!$  call omp_set_num_threads(PE%nThread) 
!$OMP PARALLEL DEFAULT(SHARED)      &
!$OMP PRIVATE(i, j, k, ifsr, ifxr, ipin, icel, ifsrlocal, itype, ig2, tid, FsrIdxSt, FxrIdxSt, nlocalFxr, nFsrInFxr, xsmacs, chi)
!$  tid = omp_get_thread_num()+1
!$OMP DO
...

The pgserv.exe and VS2013 literally die (no error message, just stop functioning) when the parallel region starts.

What is the problem?

What is the problem?

Could be any number of things. Can you run the code within a debugger?

  • Mat

I’m already running it within debugger. I’m using Visual Fortran and VS2013 just die.

That is, I can’t see any error message.

One possibility is that you’re encountering a stack overflow. Try increasing your stack size.

On Windows, this is done at link time via the flag “-stack=[no]check||” where “check” indicates if you want to insert a stack check so the program exits gracefully when encountering the stack limit, “reserve” indicates the maximum stack size can grow, and “commit” is how much of that memory the OS should commit at load time.

For example: “-stack=check,72000000,72000000”.

  • Mat

Stack overflow is the first thing I suspected, so I was using stack check option and stack size of 100MB.

It seems that stack is not the matter.

What else could be the reason?

Sorry that I can’t give you any information.

Is there any potential danger of using uninitialized pointer in OpenMP region? Not deferencing it while uninitialized; just using it for targeting another pointer.

What else could be the reason?

There’s not enough information for me to tell.

Sorry that I can’t give you any information.

No worries, it just limits my ability to help. At best I can only offer guesses.

Is there any potential danger of using uninitialized pointer in OpenMP region? Not deferencing it while uninitialized; just using it for targeting another pointer.

Doubtful but I can’t say for certain.


What happens if you run your application from a DOS command windows instead of withing VS? Do you get any more information about why it crashes? Does it crash with 1 threads or only multiple threads?

Are you able to compile and run on a Linux systems? If so, you can run running the code under Valgrind to hunt for uninitialized memory. Also, Linux would provide you another data point.