Quantcast
Channel: Intel® Fortran Compiler
Viewing all articles
Browse latest Browse all 3270

openmp problem

$
0
0



Hi,

I'm having problems with a derived type variable containing

allocatable components declared shared in an openmp parallel

section. I've attached a minimal code to reproduce the problem

below. It executes when compiled with Ifort versions 11.0, 11.1, 12.0,

12.1, but crashes with 13.0, 13.1, 14.0, partially depending on

optimization flags. I typically get the error message:

forrtl: severe (151): allocatable array is already allocated

even though the print statement tells me it's not. I'm not completely

sure the code complies with the openmp specification, but at least I

cannot see an obvious problem. Any feedback would be appreciated.

All the best,

   John

 

MODULE DERIVED_TYPE

  IMPLICIT NONE

  TYPE ALLOCATABLE_TYPE

     REAL, DIMENSION(:), ALLOCATABLE :: vector

  END TYPE ALLOCATABLE_TYPE

CONTAINS

  SUBROUTINE INIT(var, len)

    INTEGER,                INTENT(IN)    :: len

    TYPE(ALLOCATABLE_TYPE), INTENT(INOUT) :: var

    PRINT *, ALLOCATED(var%vector)

    ALLOCATE(var%vector(1:len))

  END SUBROUTINE INIT

END MODULE DERIVED_TYPE

 

PROGRAM TEST

  USE DERIVED_TYPE

  IMPLICIT NONE

  TYPE(ALLOCATABLE_TYPE) :: var

CALL OMP_SET_NUM_THREADS(1)

!$OMP PARALLEL PRIVATE(var)

  CALL INIT(var, 1)

!$OMP END PARALLEL

END PROGRAM TEST

 


Viewing all articles
Browse latest Browse all 3270

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>