Opened 4 months ago

Last modified 4 months ago

#69108 new defect

gfortran-mp-13: gfortran-compiled binary randomly gives right or wrong outcome

Reported by: tpcklaver Owned by:
Priority: Normal Milestone:
Component: ports Version: 2.8.1
Keywords: Cc:
Port: gcc13

Description

I have a piece of f90 research code that I've compiled on an M2 Pro Apple Silicon Macbook, running macOS Sonoma 14.2.1, Xcode 15.2. I've compiled it with gfortran-mp-13, part of gcc-13, which was installed with MacPorts 2.8.1. About half the time the binary produces the right outcome (checked against the same code compiled with gfortran on an Intel Macbook), about half the time it produces a wrong outcome (but always the same wrong outcome, it's wrong but not random noise). This random alternating happens when running the same calculation with the same input in the same working directory with the same binary like 10 times in a row. As it works fine with a gfortran-compiled binary on an Intel Macbook, I wonder if the gfortran portion of gcc-13 on Apple Silicon has a problem. Then again, I also tried with gfortran from Homebrew on my Apple Silicon Macbook, and there I had the exact same problem, sometimes the binary gives the right outcome, sometimes the wrong outcome. I guess this may indicate a more generral problem in gfortran on Apple Silicon, not necessarily the MacPort port of it? I attach an archive to this ticket that contains the f90 source code (Aneto, a code to determine elastic interaction energy between periodic defect images), two input files (OUTCAR, input_elast) for a test case, and the binary I compiled. The calculation is run by simply running the binary from a directory containing the two input files. If the calculation goes right, the outcome contains a line Delta E = 1.65765823 eV If it goes wrong, the outcome contains a line Delta E = 0.137904249 eV If anyone can make sence of this, please let me know.

Attachments (1)

files.zip (766.5 KB) - added by tpcklaver 4 months ago.

Download all attachments as: .zip

Change History (4)

Changed 4 months ago by tpcklaver

Attachment: files.zip added

comment:1 Changed 4 months ago by kencu (Ken)

the person who has been doing the gcc gfortran arm fixes for MacOS would definitely like to know about this.

Please open an issue with him, with the code that generates the issue, here:

https://github.com/iains/gcc-13-branch/issues

Last edited 4 months ago by kencu (Ken) (previous) (diff)

comment:3 Changed 4 months ago by tpcklaver

Small additional info: using the NAG fortran compiler for macOS on Apple Silicon, the unaltered code works correctly.

Note: See TracTickets for help on using tickets.