Parallel-NetCDF / PnetCDF

Source code repository of PnetCDF library and utilities
https://parallel-netcdf.github.io
Other
81 stars 23 forks source link

Compilation error when using Intel compiler #77

Open 7BF794B0 opened 2 years ago

7BF794B0 commented 2 years ago

Hello! I am trying to compile pnetcdf-1.12.2 using Intel oneAPI Base Toolkit/HPC Toolkit 2022.1 with the following command:

MPICC=$INTEL/oneapi/mpi/latest/bin/mpiicc CFLAGS="-I$INTEL/oneapi/mpi/latest/include -L$INTEL/oneapi/mpi/latest/lib/release -L$INTEL/oneapi/mpi/latest/lib -fPIC -O3 -xsse4.2 -align" MPICXX=$INTEL/oneapi/mpi/latest/bin/mpiicpc CXXFLAGS="-I$INTEL/oneapi/mpi/latest/include -L$INTEL/oneapi/mpi/latest/lib/release -L$INTEL/oneapi/mpi/latest/lib -fPIC -O3 -xsse4.2" MPIF77=$INTEL/oneapi/mpi/latest/bin/mpif77 MPIF90=$INTEL/oneapi/mpi/latest/bin/mpiifort FCFLAGS="-I$INTEL/oneapi/mpi/latest/include -L$INTEL/oneapi/mpi/latest/lib/release -L$INTEL/oneapi/mpi/latest/lib -fPIC -O3 -xsse4.2" ./configure --prefix=$DIR/netcdf --enable-shared

It fails with the following log:

configure: WARNING:
   -----------------------------------------------------------------------
     "/../../intel/oneapi/mpi/latest/bin/mpif77" is not a working MPI Fortran 77 compiler.
     Thus, the Fortran feature is disabled.
   -----------------------------------------------------------------------
configure: creating ./config.lt

How to fix this error?

wkliao commented 2 years ago

Please provide file 'config.log' which shows more information about that failure.

7BF794B0 commented 2 years ago

config.log

wkliao commented 2 years ago

I found this line from config.log.

MPICC=/home/**/intel/oneapi/mpi/latest/bin/mpiicc

The env variable INTEL contains an ill formed folder name '**'. Please fix that and the same for DIR. Then try the simplified configure command below.

CFLAGS="-O3 -xsse4.2 -align" FCFLAGS="-O3 -xsse4.2" ./configure --prefix=$DIR/netcdf --enable-shared --with-mpi=$INTEL/oneapi/mpi/latest
7BF794B0 commented 2 years ago

** just hide the username I made a test. If you separately build MPIH without adding it to $PATH and explicitly specify MPIF77=$DIR/mpich/bin/mpif77 MPIF90=$DIR/mpich/bin/mpif90 then everything will be built successfully. So the error is most likely related to mpiifort

wkliao commented 2 years ago

It is likely. From config.log, I am seeing the 2 lines above the failure message.

/usr/bin/ld: cannot find -lmpifort
/usr/bin/ld: cannot find -lmpi

It indicates a problem of MPI F77 compiler, $INTEL/oneapi/mpi/latest/bin/mpif77 whose path to MPI libraries (LD_FLAGS) may not be set correctly. One way to verify it is for you to use that compiler to compile a small test program and see if the same error messages appear.

wkliao commented 7 months ago

Hi, @7BF794B0

I am working on the next release which will come out soon. It will be great if you can give the master branch a try and let me know.

I would suggest to use the following configure command without setting other environment variables.

git clone https://github.com/Parallel-NetCDF/PnetCDF.git
cd PnetCDF
autoreconf -i
./configure --enable-shared --with-mpi=$INTEL/oneapi/mpi/latest/bin