Build error with NAG 7.2: Option error: Unrecognised option -pthread
Closed this issue · 3 comments
So this is...interesting. I've had issues building Open MPI 5 with NAG 7.2 where the symptom was:
make[3]: Entering directory '/ford1/share/gmao_SIteam/MPI/src/openmpi-5.0.2/build-nag-7.2.01/ompi/mpi/fortran/mpif-h'
CCLD libmpi_mpifh.la
/usr/bin/ld: unrecognized option '-pthread'
/usr/bin/ld: use the --help option for usage information
Through the efforts of @ggouaillardet, he provided me with a tarfile that does work along with open-mpi/ompi#12458 to fix in the future.
So, I thought, well, Open MPI + NAG doesn't build mpi_f08
yet, but MPICH does (or did last time I tried long ago). So I grabbed MPICH 4.2.2 and configured like:
../configure \
CC=gcc CXX=g++ FC=nagfor \
MPICHLIB_FFLAGS='-mismatch -fpp' MPICHLIB_FCFLAGS='-mismatch -fpp' --enable-f08 \
CFLAGS="-I/ford1/share/gmao_SIteam/nag/7.2.13/lib/NAG_Fortran" \
--prefix=/ford1/share/gmao_SIteam/MPI/mpich/4.2.2/nag-7.2.13 |& tee configure.nag-7.2.13.log
where the options are from places on the web (like this). I don't exactly remember, but this worked before.
And when I do so, the make
step dies with:
make[2]: Entering directory '/ford1/share/gmao_SIteam/MPI/src/mpich-4.2.2/build-nag-7.2.13'
GEN lib/libmpifort.la
libtool: warning: '/ford1/local/gcc/gcc-12.1.0/lib64/libatomic.la' seems to be moved
NAG Fortran Compiler Release 7.2(Shin-Urayasu) Build 7213
Option error: Unrecognised option -pthread
make[2]: *** [Makefile:6158: lib/libmpifort.la] Error 2
Well, that's familiar.
My guess is it must be something similar in Autotools?
For what its worth, I just tried
FC=nagfor ./configure
and it builds successfully. The NAG version:
NAG Fortran Compiler Release 7.0(Yurakucho) Build 7048
In checking, the mpi_f08
was disabled by configure
. Checking config.log
:
configure:41208: checking for Fortran 2008 support
configure:41240: gcc -c -O2 -DNETMOD_INLINE=__netmod_inline_ofi__ -I/home/zhouh/temp/mpich-main/src/mpl/include -I/home/zhouh/temp/mpich-main/modules/json-c -I/home/zhouh/temp/mpich-main/modules/hwloc/include -D_REENTRANT -I/home/zhouh/temp/mpich-main/src/mpi/romio/include -I/home/zhouh/temp/mpich-main/src/pmi/include conftest.c >&5
configure:41240: $? = 0
configure:41349: nagfor -o conftest conftest.f90 conftest1.o >&5
NAG Fortran Compiler Release 7.0(Yurakucho) Build 7048
Error: conftest.f90, line 24: Syntax error
detected at *@)
Error: conftest.f90, line 24: Unexpected '.' found
detected at (@.
Error: conftest.f90, line 24: Unexpected '.' found
detected at .@.
Warning: conftest.f90, line 24: C_INT explicitly imported into FOO but not used
Error: conftest.f90, line 25: Syntax error
detected at )@::
Error: conftest.f90, line 26: Duplicate subprogram name FOO
detected at FOO@<end-of-statement>
Error: conftest.f90, line 35: Syntax error
detected at *@)
Error: conftest.f90, line 35: Unexpected '.' found
detected at (@.
Error: conftest.f90, line 35: Unexpected '.' found
detected at .@.
Error: conftest.f90, line 35: Implicit type for BUF
Error: conftest.f90, line 36: Duplicate subprogram name TEST_ASSUMED_RANK_ASYNC_IMPL
detected at TEST_ASSUMED_RANK_ASYNC_IMPL@<end-of-statement>
Error: conftest.f90, line 37: Syntax error
detected at <end-of-statement>@END INTERFACE
Error: conftest.f90, line 37: Non-matching generic-spec on END INTERFACE
detected at END INTERFACE@TEST_ASSUMED_RANK_ASYNC
Error: conftest.f90, line 58: Unexpected '.' found
detected at (@.
Error: conftest.f90, line 58: Unexpected '.' found
detected at .@.
Error: conftest.f90, line 58: Syntax error
detected at .@.
Questionable: conftest.f90, line 80: Variable ERRCODE set but never referenced
[NAG Fortran Compiler pass 1 error termination, 15 errors, 2 warnings]
configure:41349: $? = 2
configure: failed program was:
|
|
| MODULE F08TS_MODULE
| IMPLICIT NONE
|
| ! Test public, private, protected
| REAL, PUBLIC :: x
| REAL, PRIVATE :: y
| LOGICAL, PROTECTED :: z
|
| ! Test abstract
| ABSTRACT INTERFACE
| SUBROUTINE user_func(x, y)
| INTEGER :: x(*)
| REAL :: y
| END SUBROUTINE
| END INTERFACE
|
| ! Test TS 29113 assumed type , assumed rank and bind(C)
| INTERFACE
| FUNCTION FOO(A, B, C) &
| BIND(C,name="foo_c") RESULT(err)
| USE, intrinsic :: iso_c_binding, ONLY : c_int
| TYPE(*), DIMENSION(..) :: A, B, C
| INTEGER(c_int) :: err
| END FUNCTION FOO
| END INTERFACE
|
|
| ! Test assumed-rank + asynchronous
| INTERFACE TEST_ASSUMED_RANK_ASYNC
| SUBROUTINE TEST_ASSUMED_RANK_ASYNC_IMPL(BUF) &
| BIND(C,name="test_assumed_rank_async_impl_c")
| IMPLICIT NONE
| TYPE(*), DIMENSION(..), ASYNCHRONOUS :: BUF
| END SUBROUTINE TEST_ASSUMED_RANK_ASYNC_IMPL
| END INTERFACE TEST_ASSUMED_RANK_ASYNC
|
| CONTAINS
|
| ! Test TS 29113 asynchronous attribute and optional
| SUBROUTINE test1(buf, count, ierr)
| INTEGER, ASYNCHRONOUS :: buf(*)
| INTEGER :: count
| INTEGER, OPTIONAL :: ierr
| END SUBROUTINE
|
| ! Test procedure type and non-bind(c) x in C_FUNCLOC(x)
| SUBROUTINE test2(func)
| USE, INTRINSIC :: ISO_C_BINDING, ONLY : C_FUNLOC, C_FUNPTR
| PROCEDURE(user_func) :: func
| TYPE(C_FUNPTR) :: errhandler_fn
| errhandler_fn = C_FUNLOC(func)
| END SUBROUTINE
|
| ! Test intrinsic storage_size
| SUBROUTINE test3(x, size)
| CHARACTER, DIMENSION(..) :: x
| INTEGER, INTENT(OUT) :: size
| size = storage_size(x)/8
| END SUBROUTINE test3
|
| END MODULE
|
| !==============================================
| PROGRAM MAIN
| USE :: F08TS_MODULE, ONLY : FOO, TEST_ASSUMED_RANK_ASYNC
| IMPLICIT NONE
|
| INTEGER, DIMENSION(4,4) :: A, B
| INTEGER, DIMENSION(2,2) :: C
| INTEGER :: ERRCODE
| INTEGER, DIMENSION(10), ASYNCHRONOUS :: IAR
|
| ! Test contiguous and non-contiguous array section passing
| ! and linkage with C code
| ERRCODE = FOO(A(1:4:2, :), B(:, 2:4:2), C)
| CALL TEST_ASSUMED_RANK_ASYNC(IAR(2:7))
|
| END PROGRAM
|
configure:41374: result: no
So it has issue compiling the following:
TYPE(*), DIMENSION(..) :: A, B, C
From https://www.mpi-forum.org/docs/mpi-4.1/mpi41-report/node467.htm:
A high quality MPI implementation may enhance the interface by using TYPE(*), DIMENSION(..) choice buffer dummy arguments instead of using nonstandardized extensions such as !$PRAGMA IGNORE_TKR or a set of overloaded functions as described by M. Hennecke in [33], if the compiler supports this Fortran 2018 language feature. See Section MPI for Different Fortran Standard Versions for further details.
I have no problems building MPICH 4.2.2 with NAG 7.2. With that NAG version - also MPI_f08
builds correctly. I set some environment variables:
export FC="nagfor"
export CPPFLAGS="-I$NAG_ROOT/lib/NAG_Fortran"
export CFLAGS="-I$NAG_ROOT/lib/NAG_Fortran"
$NAG_ROOT
is the location of my NAG Fortran compiler installation.
Then I configure MPICH as follows:
./configure --with-pic
and build with make
as normal.
The nagfor
version (7.0 build 7048) @hzhou use is pretty old and I'm not surprised that MPI_f08 does not build with that. Getting the newest version solve that problem.
Close assuming the issue is fixed with newer NAG versions.