Compilar NetCDF

De Wikicima
Revisión a fecha de 11:04 22 ene 2019; Gvieytes (Discusión | contribuciones)

(dif) ← Revisión anterior | Revisión actual (dif) | Revisión siguiente → (dif)
Saltar a: navegación, buscar

Instalación de Netcdf con compiladores Intel

IMPORTANTE

A partir de las versión 4.2 de netcdf. esta separado el instalador para C, C++ y Fortran. Siempre instalar primero la versión para C. Averiguar más o usar la versión 3.6.3 (en hydra está la 4.1.3 y creo que va bien)


Para instalar netcdf, primero hay que instalar


 http://software.intel.com/en-us/articles/performance-tools-for-software-developers-building-netcdf-with-the-intel-compilers/ 

Luego descargar la última versión del netcdf para C, Fortran y C++ desde:

 http://www.unidata.ucar.edu/downloads/netcdf/index.jsp 


Instalar primero la versión del netcdf para C y repetir los siguientes pasos para Fortran y C++


Crear las variables de entorno para compilar netcdf

Intel nuevo (>=10.x)

unset CC CXX F77 FC F90 CPP CXXCPP CFLAGS CXXFLAGS FFLAGS
export CC=icc
export CXX=icpc
export CFLAGS='-O3 -xHost -ip -no-prec-div -static-intel'
export CXXFLAGS='-O3 -xHost -ip -no-prec-div -static-intel'
export F77=ifort
export FC=ifort
export F90=ifort
export FFLAGS='-O3 -xHost -ip -no-prec-div -static-intel'
export CPP='icc -E'
export CXXCPP='icpc -E'

Para incluir el HDF5 y el ZLIB (habiendo instalado previamente el ZLIB en directorio por default y el HDF5 en /usr/local/)

export CPPFLAGS="-I/usr/local/hdf5/include -I=/usr/local/include"
export LDFLAGS="-L/usr/local/hdf5/lib"
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}/usr/local/lib

Comenzamos con la instalacion:

./configure --prefix=/usr/local/netcdf-4.4.1.1
make
make check
make install

netcdf-fortran

Al momento de instalar el netcdf-fortran es necesario agregar a la variable de entorno LD_LIBRARY_PATH algunos datos ya que al momento de realizar el configure aparece este error:


conftest: error while loading shared libraries: libnetcdf.so.7: cannot open shared object file: No such file or directory

Verificar que datos se encuentran en dicha variable y si hace falta agregar de la siguiente forma:

[root@nautilus netcdf-fortran-4.2]# env | grep LD
LDFLAGS=-L/usr/local/hdf5/lib
OLDPWD=/root
MIC_LD_LIBRARY_PATH=/opt/intel/composer_xe_2013_sp1.2.144/compiler/lib/mic:/opt/intel/composer_xe_2013_sp1.2.144/mpirt/lib/mic:/opt/intel/composer_xe_2013_sp1.2.144/compiler/lib/mic:/opt/intel/composer_xe_2013_sp1.2.144/mkl/lib/mic:/opt/intel/composer_xe_2013_sp1.2.144/tbb/lib/mic
LD_LIBRARY_PATH=/opt/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64:/opt/intel/composer_xe_2013_sp1.2.144/mpirt/lib/intel64:/opt/intel/composer_xe_2013_sp1.2.144/ipp/../compiler/lib/intel64:/opt/intel/composer_xe_2013_sp1.2.144/ipp/lib/intel64:/opt/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64:/opt/intel/composer_xe_2013_sp1.2.144/mkl/lib/intel64:/opt/intel/composer_xe_2013_sp1.2.144/tbb/lib/intel64/gcc4.4

[root@nautilus netcdf-fortran-4.2]# export LD_LIBRARY_PATH=/usr/local/lib:${LD_LIBRARY_PATH}

LDFLAGS=-L/usr/local/hdf5/lib
OLDPWD=/root
MIC_LD_LIBRARY_PATH=/opt/intel/composer_xe_2013_sp1.2.144/compiler/lib/mic:/opt/intel/composer_xe_2013_sp1.2.144/mpirt/lib/mic:/opt/intel/composer_xe_2013_sp1.2.144/compiler/lib/mic:/opt/intel/composer_xe_2013_sp1.2.144/mkl/lib/mic:/opt/intel/composer_xe_2013_sp1.2.144/tbb/lib/mic
LD_LIBRARY_PATH=/usr/local/lib:/opt/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64:/opt/intel/composer_xe_2013_sp1.2.144/mpirt/lib/intel64:/opt/intel/composer_xe_2013_sp1.2.144/ipp/../compiler/lib/intel64:/opt/intel/composer_xe_2013_sp1.2.144/ipp/lib/intel64:/opt/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64:/opt/intel/composer_xe_2013_sp1.2.144/mkl/lib/intel64:/opt/intel/composer_xe_2013_sp1.2.144/tbb/lib/intel64/gcc4.4

Se puede apreciar que /usr/local/lib se encuentra agregado. Para que este cambio se mantenga en forma permanente es necesario agregar lo sgte. al /etc/profile

## Agregado para que los compiladores utilicen dicho path tambien 20140515
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}/usr/local/lib
export LD_LIBRARY_PATH
###

Para visualizar las necesidades sobre los path de las librerías al momento de instalar netcdf-fortran se puede acceder a:

http://www.unidata.ucar.edu/software/netcdf/docs/netcdf-fortran-install.html

Librerias dinamicas (recomendadas):

export CFLAGS='-O3 -xSSSE3 -ip -no-prec-div' 
export CXXFLAGS='-O3 -xSSSE3 -ip -no-prec-div' 
export FFLAGS='-O3 -xSSSE3 -ip -no-prec-div' 

Librerias estaticas (no recomendadas):

export CFLAGS='-O3 -xSSSE3 -ip -no-prec-div -static' 
export CXXFLAGS='-O3 -xSSSE3 -ip -no-prec-div -static' 
export FFLAGS='-O3 -xSSSE3 -ip -no-prec-div -static' 

Intel viejo (<10.x)

export CC=icc 
export CXX=icpc 
export CFLAGS='-O3 -xT -ip -no-prec-div -static' 
export CXXFLAGS='-O3 -xT -ip -no-prec-div -static' 
export F77=ifort 
export FC=ifort
export F90=ifort
export FFLAGS='-O3 -xT -ip -no-prec-div -static' 
export CPP='icc -E' 
export CXXCPP='icpc -E'

Portland Completo

export CC=pgcc
export CFLAGS="-O2 -Msignextend -V"
export FC=pgfortran
export F90=pgfortran
export F77=pgfortran
export FFLAGS="-O2 -w -V"
export CXX=pgcpp
export CPPFLAGS="-DNDEBUG -DpgiFortran"

Portland simple sin C++

export CC=gcc
export FC=pgf90
export FFLAGS="-O2"
export CPPFLAGS="-DNDEBUG -DpgiFortran -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE"

En algunos casos para que el make check funcione es necesario exportar la variable de entorno del proxy

export http_proxy=http://proxy1.cima.fcen.uba.ar:3128/

Compilar e instalar

./configure
make
make check
make install



+-------------------------------------------------------------+
| Congratulations! You have successfully installed the netCDF |
| Fortran libraries.                                          |
|                                                             |
| You can use script "nf-config" to find out the relevant     |
| compiler options to build your application. Enter           |
|                                                             |
|     nf-config --help                                        |
|                                                             |
| for additional information.                                 |
|                                                             |
| CAUTION:                                                    |
|                                                             |
| If you have not already run "make check", then we strongly  |
| recommend you do so. It does not take very long.            |
|                                                             |
| Before using netCDF to store important data, test your      |
| build with "make check".                                    |
|                                                             |
| NetCDF is tested nightly on many platforms at Unidata       |
| but your platform is probably different in some ways.       |
|                                                             |
| If any tests fail, please see the netCDF web site:          |
| http://www.unidata.ucar.edu/software/netcdf/                |
|                                                             |
| NetCDF is developed and maintained at the Unidata Program   |
| Center. Unidata provides a broad array of data and software |
| tools for use in geoscience education and research.         |
| http://www.unidata.ucar.edu                                 |
+-------------------------------------------------------------+



+-------------------------------------------------------------+
| Congratulations! You have successfully installed the netCDF |
| C++ Libaray                                                 |
|                                                             |
| CAUTION:                                                    |
|                                                             |
| If you have not already run "make check", then we strongly  |
| recommend you do so. It does not take very long.            |
|                                                             |
| Before using netCDF to store important data, test your      |
| build with "make check".                                    |
|                                                             |
| NetCDF is tested nightly on many platforms at Unidata       |
| but your platform is probably different in some ways.       |
|                                                             |
| If any tests fail, please see the netCDF web site:          |
| http://www.unidata.ucar.edu/software/netcdf/                |
|                                                             |
| NetCDF is developed and maintained at the Unidata Program   |
| Center. Unidata provides a broad array of data and software |
| tools for use in geoscience education and research.         |
| http://www.unidata.ucar.edu                                 |
+-------------------------------------------------------------+

Herramientas personales