-
Notifications
You must be signed in to change notification settings - Fork 927
Open
Description
Background information
What version of Open MPI are you using? (e.g., v4.1.6, v5.0.1, git branch name and hash, etc.)
v5.0.8
Describe how Open MPI was installed (e.g., from a source/distribution tarball, from a git clone, from an operating system distribution package, etc.)
Installed via the tarfile.
Please describe the system on which you are running
- Operating system/version: macOS 15.6.1
- Computer hardware: M2 Pro
- Network type: Internal (ethernet?)
Details of the problem
I believe #13240 broke NAG support in Open MPI. The issue is that the new Fortran code used in configure
:
program falignment
CHARACTER A,B
COMMON /AA/A
COMMON /BB/B
OPEN(UNIT=10, FILE="conftestval")
if (LOC(A) > LOC(B)) then
write (10,'(I5)') LOC(A)-LOC(B)
else
write (10,'(I5)') LOC(B)-LOC(A)
endif
CLOSE(10)
end program
uses LOC()
and LOC()
is not part of the Fortran standard, but rather a (common) Fortran extension. And NAG Fortran is a stickler for the Standard and will not support Fortran extensions if the Standard has a way to do something. When NAG tries to compile this code:
❯ nagfor test.F90
NAG Fortran Compiler Release 7.2(Shin-Urayasu) Build 7236
Obsolescent: test.F90, line 3: COMMON statement
Obsolescent: test.F90, line 4: COMMON statement
[NAG Fortran Compiler normal termination, 2 warnings]
Undefined symbols for architecture arm64:
"_loc_", referenced from:
_falignment_ in test.079142.o
_falignment_ in test.079142.o
_falignment_ in test.079142.o
_falignment_ in test.079142.o
_falignment_ in test.079142.o
_falignment_ in test.079142.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
This can be "duplicated" with GNU, say, if you ask for strict Fortran:
❯ gfortran-15 -std=f2023 test.F90
test.F90:4:14:
4 | COMMON /BB/B
| 1
Warning: Fortran 2018 obsolescent feature: COMMON block at (1)
test.F90:3:14:
3 | COMMON /AA/A
| 1
Warning: Fortran 2018 obsolescent feature: COMMON block at (1)
Undefined symbols for architecture arm64:
"_loc_", referenced from:
_MAIN__ in cca9Zeyr.o
_MAIN__ in cca9Zeyr.o
_MAIN__ in cca9Zeyr.o
_MAIN__ in cca9Zeyr.o
_MAIN__ in cca9Zeyr.o
_MAIN__ in cca9Zeyr.o
ld: symbol(s) not found for architecture arm64
collect2: error: ld returned 1 exit status
One path forward is C_LOC
, et al:
program falignment
use iso_c_binding, only: C_LOC, C_INTPTR_T
implicit none
CHARACTER A,B
COMMON /AA/A
COMMON /BB/B
OPEN(UNIT=10, FILE="conftestval")
if (CLOC(A) > CLOC(B)) then
write (10,'(I5)') CLOC(A)-CLOC(B)
else
write (10,'(I5)') CLOC(B)-CLOC(A)
endif
CLOSE(10)
contains
function CLOC(X) result(res)
CHARACTER, INTENT(IN), TARGET :: X
INTEGER(C_INTPTR_T) :: res
res = transfer(C_LOC(X), res)
end function CLOC
end program
though I guess now you require iso_c_binding
support (and Open MPI might want to support older compilers?).
In my testing, this new code does seem to duplicate with GNU:
❯ rm -f conftestval && gfortran-15 test.F90 && ./a.out && cat conftestval
16
❯ rm -f conftestval && gfortran-15 test_iso.F90 && ./a.out && cat conftestval
16
and NAG now works:
❯ rm -f conftestval && nagfor test_iso.F90 && ./a.out && cat conftestval
NAG Fortran Compiler Release 7.2(Shin-Urayasu) Build 7236
Obsolescent: test_iso.F90, line 5: COMMON statement
Obsolescent: test_iso.F90, line 6: COMMON statement
[NAG Fortran Compiler normal termination, 2 warnings]
1
I guess this is saying NAG doesn't align common blocks?
Metadata
Metadata
Assignees
Labels
No labels