New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
WorkingGroups/TAM/InstallationsMacInstosh/InstallMacIntelFortran – NEMO
wiki:WorkingGroups/TAM/InstallationsMacInstosh/InstallMacIntelFortran

Version 17 (modified by chauvin, 15 years ago) (diff)

--

Installation with Intel Fortran

Generic information for compiling with FCM

Edit 
$basepath/nemo/fcmconfig/bld/$compil_target/nemo.cfg
and 
$basepath/nemovar/fcmconfig/bld/$compil_target/nemo.cfg
according to your compiler and the path to netcdf,
then 
$ cd $chemin/nemovar/build
$ ./fcmvmake.ksh -t $basepath -c $compil_target 

Generating static libraries with ifort

The actual version of ifort (11.1) contains a bug when compiled on Mac OS: The linker (ranlib) does not find objects associated to global variables defined in some modules of NEMO:

ifort model.o libopa.a libioipsl.a  -L/usr/local/netcdf-3.6.1/intel/lib -lnetcdf -O3 -o  ../opa_exe.ORCA2_Z31.1.1
Undefined symbols:
  "_asmpar_mp_nitdin_r_", referenced from:
....

These particular modules contains only global variables, and no CONTAINS section (ie no subroutines). The temporary solution is to add the option -c to ranlib:

ranlib -c :
 Include  common symbols as definitions with respect to the table
             of contents.  This is seldom the intended behavior  for  linking
             from  a  library,  as  it forces the linking of a library member
             just because it uses an uninitialized global that  is  undefined
             at  that  point  in  the  linking.  This option is included only
             because this was the original behavior of ranlib.   This  option
             is not the default.

Adding the option -c to ranlib in fcm

No building tool ranlib is available in fcm 1.3 . A solution is to insert the following lines in your nemo.cfg:

bld::tool::ar ar_mac
bld::tool::arflags 

and create a script ar_mac

#!/bin/sh
ar rs $@ || exit 1
ranlib -c $1 || exit 1

Generating NETCDF modules and library

The following script is executed in the directory netcdf-3.6.1/src The compilers come from the intel web site, and installed on a Mac OS X 10.5.8 (Leopard). Flags avoid conflicts between C and Fortran during the library compilation.

#!/bin/sh

export FC=ifort
export F90=ifort
export F77=ifort

export CFLAGS='-O3'
export CC=icc
export CXX=icpc
export CPPFLAGS=' -DNDEBUG -DpgiFortran'

./configure --prefix=/usr/local/netcdf-3.6.1/intel

If problems persists: useful tips on the unidata server, known problems

Miscellaneous useful informations