- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
For the following minimal example, there appears to be a regression in Intel Fortran LLVM 2023.0.0 20221201 and Classic 2021.8.0.20221119 that works in 2022.2.1 Build 20221101. The `random_init()` second call should use a new seed, but does not.
program demo_rand
use, intrinsic :: iso_fortran_env, only : stderr=>error_unit
implicit none
real :: r1, r2
call random_init(.false., .false.)
call random_number(r1)
call random_init(.false., .false.)
call random_number(r2)
if (r1==r2) then
write(stderr,*) 'random_init fail: ', r1, ' == ', r2
error stop 'these two random number should not match if random_init is working'
endif
print *, "OK: random_init: ", r1, " /= ", r2
end program
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Intel oneAPI 2023.1 fixed this issue.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You are correct that the second call to RANDOM_INIT should result in a different sequence. The standard says (emphasis mine), "CALL RANDOM_INIT(REPEATABLE=false, IMAGE_DISTINCT=false) is equivalent to invoking RANDOM_SEED with a processor-dependent value for PUT that is the same on every invoking image. Different values for PUT shall be used for subsequent invocations, and for each execution of the program."
I've reworked your test program to more precisely match what the standard says:
program demo_rand
use, intrinsic :: iso_fortran_env, only : stderr=>error_unit
implicit none
integer :: szize
integer, allocatable :: seed1(:),seed2(:)
call random_seed(size=szize)
allocate (seed1(szize),seed2(szize))
call random_init(.false., .false.)
call random_seed (get=seed1)
print *, seed1
call random_init(.false., .false.)
call random_seed(get=seed2)
print *, seed2
if (all(seed1==seed2)) then
write(stderr,*) 'random_init fail'
error stop 'these two seeds should not match if random_init is working'
endif
print *, "OK: random_init"
end program
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In contrast to the first post that report a change in behavior in the last release, do not see any changes in behavior between 2022.1, 2022.2.1 and 2023.0 versions of ifx on Linux (I just tried these three versions as I all have them locally installed).
Here i s a link to the compiler explorer with Steve's slightly modified example in ifx 2022.2.1:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks @hakostra1 you are correct. I was checking between Windows 2022.2.1 that does NOT have this issue and Linux that has long had this issue. I also checked with ifort Version 2021.1 Build 20201112 on Linux and saw the same issue. So yes, it's NOT actually a regression, it's just long broken behavior.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I submitted this as issue 05692694.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
thanks for reporting. I opened an internal ticket and will let you know as soon as it is fixed. CMPLRLLVM-42927
Best
Tobias
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
So it is - my support ticket never got updated with this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
good that you already tried the new release. As you noticed the fix is included in the 2023.1 release. Thanks again for reporting this issue.
Best
Tobias
This issue has been resolved and we will no longer respond to this thread. If you require additional assistance from Intel, please start a new thread. Any further interaction in this thread will be considered community only
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page