Scheduled Downtime
On Tuesday 24 October 2023 @ 5pm MT the forums will be in read only mode in preparation for the downtime. On Wednesday 25 October 2023 @ 5am MT, this website will be down for maintenance and expected to return online later in the morning.
Normal Operations
The forums are back online with normal operations. If you notice any issues or errors related to the forums, please reach out to help@ucar.edu

CICE compile problem cannot find -lmpifort

wangxiong

New Member
Hello guys! I recently tried to compile the CICE on a different server and encounted some problems.
This server has both intel and GNU compiler installed but has really bad software maintenance. So I have to modify the machine file according to the real situation of this server.
I chose the intel compiler to do the job and the compiling procedure looks normal during the most part until to the end. As you can see in figure 1 , I got the message ld: cannot find -lmpifort. The thing is : since I used intel compiler to compile the model. ('mpiifort' I circled in the figure 1), why the model tries to locate a GNU related library? Second, I tried to locate the 'lmpifort' on the server and I just couldn't find it. It really confuses me and hope someone may share some opinion on this. THANKS.

FYI: Figure2 is part of my machine file.
 

Attachments

  • 捕获4.PNG
    捕获4.PNG
    92.6 KB · Views: 11
  • 捕获5.PNG
    捕获5.PNG
    46.9 KB · Views: 11

tcraig

Member
It is difficult to provide help in these cases as we don't have access to your machine. It really depends how software is installed on the machine in particular. You need an MPI library that is built with the same compiler, and you need to figure out where that library is and what it's called. The code seems to compile, but fails in the load step. What is in this directory, /opt/impi/5.0.1.035/intel64/lib?
 

Philippe Blain

New Member
Hi wangxiong,

I chose the intel compiler to do the job and the compiling procedure looks normal during the most part until to the end. As you can see in figure 1 , I got the message ld: cannot find -lmpifort. The thing is : since I used intel compiler to compile the model. ('mpiifort' I circled in the figure 1), why the model tries to locate a GNU related library?

By default, the Intel compiler driver uses the GNU linker (ld) to link compiled objects into an executable, which explains why ld is used. That's normal. The model (CICE) does do anything at this point, it's not compiled yet ;) And libmpifort (the library that the linker looks for when it is given the flag -lmpifort) is not a GNU related library, it's a library related to the Intel MPI implementation.

Second, I tried to locate the 'lmpifort' on the server and I just couldn't find it.
You seem to want to use Intel MPI, as indicated by the path /opt/impi/ (this seem to be the default install location for Intel MPI according to a quick Google search). In this light you should read the manual : Intel® MPI Library Developer Guide for Linux* OS (Beta), especially Compiling an MPI Program. You will probably want to follow the instructions for PSXE. The command
Bash:
 . <installdir>/intel64/bin/mpivars.sh
will have to be replaced with
Code:
 source <installdir>/intel64/bin/mpivars.csh
since CICE uses Cshell scripts. This command should go in your env.machine_compiler file. My guess is that this will make the Intel MPI compiler wrappers correctly find the library.

Another thing: you should not have to use the full path to the Intel compilers (icc and ifort) nor the Intel MPI compiler wrappers (mpiifort and mpiicc) if you correctly initialize your shell environment as Intel suggests: https://software.intel.com/en-us/fo...tion-of-compiler-components-with-compilervars. Thus you should also put a line like
Code:
 source <installdir>/bin/compilervars.csh intel64
in your env file, and then your Macros file would simply define
Makefile:
SFC=ifort
SCC=icc
MPIFC=mpiifort
MPICC=mpiicc

I hope this helps!
 

wangxiong

New Member
Hi, philippe
THANK YOU SO MUCH ! I followed your advice and try to re-compile the model. This time, it compiled successfully.
But when trying to hit a test run (intel compiler + impi). I still got something which I don't know how to deal with. Really hope you can give me some advice.
As you can see in the figure below (figure 1). After the CICE finished writing the IC file. What I think should come next is the beginning of computation.
But the model corrupts with the hint "Segmentation fault (signal 11)". I goolged it but still can't find the proper answer.
FYI: I also tried to compile and run the model with intel compiler plus mpich3.2(figure2) and intel compiler plus openmpi 1.10.0(figure 3) .
These two also returns the same error message.
Also. althought which I think might be irrelevant ( I saw somebody mentioned about this ), This server has 64GB of swap size. So I think the insufficient swap size should not be the cause of this problem.

intel compiler + impi.PNG
figure1 (above)
intel compiler + mpich3.2.PNG
figure 2 (above)

intel compiler + openmpi1.10.0.PNG
figure 3 (above)
 
Top