- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
I am using Fortran Compiler XE 15.0.1.148 .
When I compile and run the following simple program in Debug mode, it runs fine without any errors or warnings. However, it crashes if I compile it in optimized Release mode. I can prevent it from crashing if I disable the /Qopenmp option. My guess is that the problem has something to do with having a derived type variable declared as private in OpenMP loop.
program test_derived_type implicit none type T integer,allocatable:: a(:) end type T type(T):: b integer i, s s = 0 !$OMP parallel do default(none), schedule(dynamic), & !$OMP& private(i,b), reduction(+:s) do i = 1, 100 print*, i allocate( b%a(i) ) b%a = 1 s = s + sum(b%a) deallocate(b%a) end do ! i !$OMP end parallel do write(*,*) 's =', s stop end program test_derived_type
- Etiquetas:
- Intel® Fortran Compiler
Enlace copiado
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
My reading of the OpenMP 4.0 standard (Section 1.6 Normative References, page 22, line 25) suggests that allocatable components of derived types are not supported in OpenMP regions.
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
Add COPYIN(b) next to the private(i,b).
Outside the scope of the parallel region b%a surprisingly is defined as an un-allocated array. Meaning the array descriptor is initialized to represent an unallocated array (in this case of rank 1).
Without the COPYIN, the variables in the PRIVATE are undefined. Meaning not set or initialized. Therefore b%a will be undefined, which is not the same as unallocated.
Jim Dempsey

- Suscribirse a un feed RSS
- Marcar tema como nuevo
- Marcar tema como leído
- Flotar este Tema para el usuario actual
- Favorito
- Suscribir
- Página de impresión sencilla