- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I want to assign an 8 byte array to a 4 byte array
The following code fails i.e. A/=B using both ifort 2020.4 and ifx 2024.2 in linux and on windows with ifx 2025.1 It works on ifort 2020.4 using the auto parallelisation and !dir$ loop count min(256) before the implicit array assignment.
PROGRAM TESTOPENMP
USE OMP_LIB
IMPLICIT NONE
INTEGER :: I
INTEGER :: NUMTHREADS
INTEGER :: NPTS = 100000000
REAL(SELECTED_REAL_KIND(15)), DIMENSION(:), ALLOCATABLE :: A
REAL, DIMENSION(:), ALLOCATABLE :: B
ALLOCATE(A(NPTS),B(NPTS))
NUMTHREADS=4
CALL OMP_SET_NUM_THREADS(NUMTHREADS)
!$OMP PARALLEL DO
DO I=1,NPTS
A(I)=REAL(I,8)
END DO
!$OMP END PARALLEL DO
!$OMP PARALLEL WORKSHARE
B=A
!$OMP END PARALLEL WORKSHARE
DO I=1,NPTS
IF (ABS(A(I)-B(I)) >0.1) WRITE(91,'("I=",I12," A=",F11.0," B=",F11.0)')I,A(I),B(I)
END DO
DEALLOCATE (A, B)
END
My production code is reading A from a file so does not contain the first parallel do loop. The problem is in the implied workshare loop
If A and B are of the same kind this works as expected.
If you don't have sufficient memory you may be able to reduce NPTS - I was starting with what I thought the problem was - big arrays
Being a bit more pedantic and converting A to 4 bytes on the fly (B=real(A,4)) does not help.
Am I doing something wrong, expecting something wrong or is this a bug?
I'm using Ubuntu 20.04 as the linux platform and Win10 as the windows.
Cheers
Kim
PS. You'll need NPTS > 16,800,000 as the mismatch does not cut in until i=16777217.
Also assigning a 4 byte array to an 8 byte array works.
So in order to fail the array needs to be relatively large and we need to go from more precision to less.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Addendum:
Replacing the implied DO with a DO loop and using OMP PARALLEL DO also fails
!$OMP PARALLEL DO
DO I=1,NPTS
B(I)=A(I)
end do
!$OMP END PARALLEL DO
My only workaround is to do it serially.
Cheers
Kim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Addendum 2:
!$OMP PARALLEL DO
DO I=1,NPTS
B(I)=REAL(A(I),4)
end do
!$OMP END PARALLEL DO
Also fails.
In case the lack of response to this post reflects a difficulty in repeating the error state and hardware is the difference, the ifort test was run on a Xeon E5-1630 v4, the Windows test on a Virtual machine (VBox) on that host and the ifx 2024.2 test on a Xeon E5-1650 v3.
Linux compiler switches were -O2 -m64 -qopenmp with the m64 being pretty much redundant but retained to match the production code which has been compiled on intel compilers since I migrated from Lahey in 2016.
Cheers
Kim

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page