OpenMP allocation on private allocatable, possible ifort bug

OpenMP allocation on private allocatable, possible ifort bug

Hello,I'm having a problem using ifort 12.1 on the following codefile tmem.f90:

program tmem
  use mem_mod
  real(kind(1.d0)), allocatable :: work(:)
  integer :: err
  
  !$omp parallel private(work, err)
  ! allocate(work(10), stat=err)
  call aalloc_d(work, 10, err)
  write(*,*)'err:',err
  !$omp end parallel

  stop
end program tmem

and file mem_mod.f90:

module mem_mod

contains

  subroutine aalloc_d(a, n, err)
    real(kind(1.d0)), allocatable :: a(:)
    integer, intent(in)           :: n
    integer :: err

    err = 0
    write(*,*)allocated(a)
    allocate(a(n), stat=err)

    return
  end subroutine aalloc_d
end module mem_mod

The problem is that when I run this code (with any number of OpenMP threads, even 1) I get an error 151, which, according to the ifort guide means that I'm trying to allocate something already allocated. Now, I suspect that this is an ifort bug for the following reasons:

  1. the code works with intel 12.1 if I put both the module and the program in the same file
  2. the code works (either in separate files or in the same one) with ifort 11.1, ifort 12.0, gfortran 4.6 and xlf2003 13.1
  3. the code works if the allocation is done with a simple "allocate" instead of calling the alloc_d subroutine (see the commented line in the program)

Can anybody help?Regards,alfredo

8 post / 0 nuovi
Ultimo contenuto
Per informazioni complete sulle ottimizzazioni del compilatore, consultare l'Avviso sull'ottimizzazione

Hello Alfredo,

Thank you for reporting this to us. This is abug in the compiler. I have escalated this to the developers. The issue number is DPD200178119.

I will post any updates I receive on the issue to this thread.

Regards,
Annalee

Annalee,thanks for taking care of informing the devs about this. I'm looking forward for the fix.Kind regards,alfredo

Hello,
it looks like this bug has not yet been fixed in ifort v13.1.0. Is there any plan to have it fixed in a future release?
Best regards,
alfredo

From a different thread, a work around is to add copyin(work)

This will copy the empty (void) array descriptor for work (then it will look un-allocated).

Jim Dempsey

www.quickthreadprogramming.com

Citazione:

jimdempseyatthecove ha scritto:

From a different thread, a work around is to add copyin(work)

This will copy the empty (void) array descriptor for work (then it will look un-allocated).

Jim Dempsey

Thanks Jim,

actually adding copyin(work) does not change anything for me. Following the same idea, I tried firstprivate(work) but the result is still the same, I always get error 151.

Could you pease point me to the other thread?

regards,

alfredo

www.quickthreadprogramming.com

Alfredo,

The "moderated" reply with the link may show later, for now the other thread is within the top few on this forum as of Feb 23

Jim

www.quickthreadprogramming.com

Lascia un commento

Eseguire l'accesso per aggiungere un commento. Non siete membri? Iscriviti oggi