- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi all,
I noticed an odd behavior, I ran runtime debugging to see if I am violating any array size to no avail.
The sample code (hereafter), outputs a wrong value of array A, simply adding a print statement (a text) will cause the issue to disappear. Compiling in runtime debug mode also mitigates the issue.
I include the sample code:
PROGRAM inteltest
IMPLICIT NONE
INTEGER, DIMENSION(25,2) :: A
INTEGER :: i,row(2)
CALL OED(5,2,A)
DO i=1,5
row=A(i,1:2)
PRINT*,row
ENDDO
CONTAINS
SUBROUTINE OED(Q,N,A)
! @ARTICLE{Yiu-Wing_2001_OED,
! author={Yiu-Wing Leung and Yuping Wang},
! journal={IEEE Transactions on Evolutionary Computation},
! title={An orthogonal genetic algorithm with quantization for global numerical optimization},
! year={2001},
! volume={5},
! number={1},
! pages={41-53},
! keywords={Genetic algorithms;Quantization;Algorithm design and analysis;Design optimization;Design for experiments;Design methodology;Robustness;Acoustic scattering;Linear programming;Testing},
! doi={10.1109/4235.910464}}
IMPLICIT NONE
INTEGER, INTENT(IN) :: Q, N
INTEGER, DIMENSION(Q**N,N), INTENT(OUT) :: A
INTEGER :: i, J, k, jj,t,s
J = FLOOR(LOG(REAL(N)*(REAL(Q)-1.)+1.)/LOG(REAL(Q)))
IF (N .ne. ((Q**J)/(Q-1))) THEN
J = J + 1
END IF
A(:,:)=0
DO k = 1,J
jj = (Q**(k-1) - 1)/(Q-1) + 1
DO i= 1,Q**J
A(i,jj) = mod(floor((i-1.)/Q**(J-k)) ,Q)
!adding a print statement here will change the result
!PRINT*,"here"
END DO
END DO
DO k=2,J
jj = (Q**(k-1) - 1)/(Q-1) + 1;
DO s = 1, jj-1
DO t = 1,Q-1
IF (jj+(s-1)*(Q-1)+t .le. N) THEN
A(:,jj+(s-1)*(Q-1)+t) = mod(A(:,s)*t+A(:,jj),Q)
END IF
END DO
END DO
END DO
A = A + 1
END SUBROUTINE
END PROGRAM
I compile with ifort for runtime debug, this produces the correct value.
ifort -o inteltestinteldebug inteltest.f90 -C -g -warn -DEBUG -check -assume byterecl -heap-arrays 50 -check all -gen_interfaces -traceback -check bounds -fp-stack-check-fpe0 -warn all -qopenmp
Code output:
With intel:
1 1
1 1
1 2
1 3
1 4
With intel (+print statement [PRINT*,"here" added in the inner loop, see attached code lined 45]):
(only 1 print statement is shown)
here
1 1
1 2
1 3
1 4
1 5
With intel (runtime debug):
1 1
1 2
1 3
1 4
1 5
With gnu-fortran:
1 1
1 2
1 3
1 4
1 5
Compiling with ifort causes a change of the result, and I am not sure why.
I include a tarball with the source, and the bash files to compile with, ifort, ifort with runtime debug flags and gfortran.
PS: I am using intel OneAPI 2024.0 on Ubuntu 22.04
Thank you and have a wonderful day.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Interesting. I can reproduce the issue on Windows using ifort, but not with ifx. Please try ifx. SInce ifort is now deprecated, I doubt any effort will be put in to resolve issues that aren't also seen in ifx.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Interesting. I can reproduce the issue on Windows using ifort, but not with ifx. Please try ifx. SInce ifort is now deprecated, I doubt any effort will be put in to resolve issues that aren't also seen in ifx.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, it worked normally with ifx. However ifx is giving me a separate issue in debug mode (see: https://community.intel.com/t5/Intel-HPC-Toolkit/MemorySanitizer-DEADLYSIGNAL-when-compiling-for-runtime-debug/m-p/1566953)
I will mark this solved, thank you.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page