Hi,
I am trying to compile and run the following code:
``` fortran
program openmmp_with_associate_to_allocatable
implicit none
integer, allocatable, dimension(:) :: allocatable_array
integer :: static_array(5), i
allocate(allocatable_array(5))
do i = 1, 5
allocatable_array(i) = i
static_array(i) = i
end do
!$omp parallel do
do i = 1, 5
associate(a=>static_array, b=>allocatable_array)
write(*, *) "i, a(i)", i, a(i)
write(*, *) "i, b(i)", i, b(i)
end associate
end do
!$omp end parallel do
end program openmmp_with_associate_to_allocatable
```
Using gfortran 12.1 (with or without -fopenmp) the code compiles and runs succesfully and prints both a and b as asked.
Using itel fortran compiler 2022.2.0: Without using -qopenmp - the code compiles and runs successfully.
When using -qopenmp - the code compiles but crashes when tryihnjg to print b which associates to an allocatable array. a - which is ascociated to a static array is printed successfully.
Does any one know if this code is written with a problem or is there a problem in ifort?
Thanks,
Ygal
Le 17/07/2022 à 09:48, ygal...@gmail.com a écrit :
Hi,
I am trying to compile and run the following code:
``` fortran
program openmmp_with_associate_to_allocatable
implicit none
integer, allocatable, dimension(:) :: allocatable_array
integer :: static_array(5), i
allocate(allocatable_array(5))
do i = 1, 5
allocatable_array(i) = i
static_array(i) = i
end do
!$omp parallel do
do i = 1, 5
associate(a=>static_array, b=>allocatable_array)
write(*, *) "i, a(i)", i, a(i)
write(*, *) "i, b(i)", i, b(i)
end associate
end do
!$omp end parallel do
end program openmmp_with_associate_to_allocatable
```
Using gfortran 12.1 (with or without -fopenmp) the code compiles and runs succesfully and prints both a and b as asked.
Using itel fortran compiler 2022.2.0: Without using -qopenmp - the code compiles and runs successfully.
When using -qopenmp - the code compiles but crashes when tryihnjg to print b which associates to an allocatable array. a - which is ascociated to a static array is printed successfully.
Does any one know if this code is written with a problem or is there a problem in ifort?The validity of such code looks unclear https://community.intel.com/t5/Intel-Fortran-Compiler/OpenMP-with-associate-define-private/m-p/1180441
--
"...sois ouvert aux idées des autres pour peu qu'elles aillent dans le même sens que les tiennes.", ST sur fr.bio.medecine
ST passe le mur du çon : <j3nn2h...@mid.individual.net>
Hi,
I am trying to compile and run the following code:
``` fortran
program openmmp_with_associate_to_allocatable
implicit none
integer, allocatable, dimension(:) :: allocatable_array
integer :: static_array(5), i
allocate(allocatable_array(5))
do i = 1, 5
allocatable_array(i) = i
static_array(i) = i
end do
!$omp parallel do
do i = 1, 5
associate(a=>static_array, b=>allocatable_array)
write(*, *) "i, a(i)", i, a(i)
write(*, *) "i, b(i)", i, b(i)
end associate
end do
!$omp end parallel do
end program openmmp_with_associate_to_allocatable
```
Using gfortran 12.1 (with or without -fopenmp) the code compiles and runs succesfully and prints both a and b as asked.The validity of such code looks unclear https://community.intel.com/t5/Intel-Fortran-Compiler/OpenMP-with-associate-define-private/m-p/1180441
Using itel fortran compiler 2022.2.0: Without using -qopenmp - the code compiles and runs successfully.
When using -qopenmp - the code compiles but crashes when tryihnjg to print b which associates to an allocatable array. a - which is ascociated to a static array is printed successfully.
Does any one know if this code is written with a problem or is there a problem in ifort?
..
If anyone knows if this is an intel compiler probelm - would be gald to know
On Sunday, July 17, 2022 at 9:41:51 AM UTC-4, ygal...@gmail.com wrote:Thanks Fortran Fan.
..@Ygal,
If anyone knows if this is an intel compiler probelm - would be gald to know
You may want to post your inquiry at the Intel Fortran forum also and the replies there by Intel Support team on your question(s) may prove useful to you:
https://community.intel.com/t5/Intel-Fortran-Compiler/bd-p/fortran-compiler
Hi,
Thanks for the replies.
I saw the link in intel forum that you sent.
It is not the same code.
and supposudely not the same problem
Le 17/07/2022 à 15:41, ygal...@gmail.com a écrit :
Hi,
Thanks for the replies.
I saw the link in intel forum that you sent.
It is not the same code.
and supposudely not the same problem
Sure, but some comments tend to show that it is not always easy to know
how ASSOCIATE and OpenMP work together...
"The OpenMP and Fortran standards are not explicit on what happens to an associate name inside an OpenMP parallel do loop"
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 159 |
Nodes: | 16 (0 / 16) |
Uptime: | 98:49:22 |
Calls: | 3,209 |
Files: | 10,563 |
Messages: | 3,009,783 |