The netCDF library : Différence entre versions
Ligne 4 : | Ligne 4 : | ||
As this library is not quite standard, chances are that you might need to install it yourself on your system (note that the [[WhatIs: The install lmdz.sh script|install_lmdz.sh]] default behavior is to download and install that library), hence this page with some indications on how to do so. | As this library is not quite standard, chances are that you might need to install it yourself on your system (note that the [[WhatIs: The install lmdz.sh script|install_lmdz.sh]] default behavior is to download and install that library), hence this page with some indications on how to do so. | ||
− | + | == Checking if a NetCDF library is already available == | |
It is possible that the library, including its Fortran component, is already available. An easy way to check this is to see if the related utilities like '''ncdump''' are available, i.e. that | It is possible that the library, including its Fortran component, is already available. An easy way to check this is to see if the related utilities like '''ncdump''' are available, i.e. that | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
Ligne 17 : | Ligne 17 : | ||
returns something meaningful. If not, you probably need to take some action along the lines of what is indicated in the following sections. | returns something meaningful. If not, you probably need to take some action along the lines of what is indicated in the following sections. | ||
+ | == Various ways to install the NetCDF library == | ||
=== Install via a system manager === | === Install via a system manager === | ||
If on Ubuntu (and with admin, i.e. ''sudo'' rights) you can try | If on Ubuntu (and with admin, i.e. ''sudo'' rights) you can try | ||
Ligne 24 : | Ligne 25 : | ||
=== Personal installation === | === Personal installation === | ||
− | One can always download the source code and compile the NetCDF library (see https://docs.unidata.ucar.edu/netcdf-c/current/faq.html#HowdoIgetthenetCDFsoftwarepackage ). You can use the following home-made "install_netcdf4_hdf5_seq.bash" script to do so. For this, ensure that you are in your home directory: | + | One can always download the source code and compile the NetCDF library (see https://docs.unidata.ucar.edu/netcdf-c/current/faq.html#HowdoIgetthenetCDFsoftwarepackage ). You can use the following home-made "install_netcdf4_hdf5_seq.bash" script to do so. For this, ensure that you are in your home directory and: |
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
mkdir netcdf | mkdir netcdf | ||
Ligne 40 : | Ligne 41 : | ||
The assumption here is that you have run the "install_netcdf4_hdf5_seq.bash" script in a "netcdf" subdirectory of your home directory. Adapt accordingly if not. | The assumption here is that you have run the "install_netcdf4_hdf5_seq.bash" script in a "netcdf" subdirectory of your home directory. Adapt accordingly if not. | ||
+ | Check that the installation was successfully installed :-) | ||
+ | Again, a neat way to do that is to run and check the output of | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | nf-config --all | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | === Personal installation of an advanced NetCDF4-HDF5 library with MPI enabled === | ||
+ | This specific version is useful especially if running with the XIOS library. | ||
+ | A prerequisite is to have an MPI library installed and available. | ||
+ | You can use the following home-made "install_netcdf4_hdf5_seq.bash" script to do so. For this, ensure that you are in your home directory and: | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | mkdir netcdf4hdf5 | ||
+ | cd netcdf4hdf5 | ||
+ | wget -nv --no-check-certificate http://www.lmd.jussieu.fr/~lmdz/pub/import/install_netcdf4_hdf5.bash | ||
+ | chmod u=rwx install_netcdf4_hdf5.bash | ||
+ | ./install_netcdf4_hdf5.bash -CC mpicc -FC mpif90 -CXX mpiCC -MPI /path/to/your/MPI/install > netcdf.log 2>&1 | ||
+ | </syntaxhighlight> | ||
+ | You should of course adapt the command line, especially the ''-MPI /path/to/your/MPI/install'' part to your settings. | ||
+ | |||
+ | Compiling the library and dependencies can take a while (>>15 minutes; be patient). | ||
+ | Once this is done, check file netcdf.log to verify that all went well. | ||
+ | You may want to also add its "bin" directory to your PATH environment variable by adding in your .bashrc a line of: | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | export PATH=$PATH:$HOME/netcdf4hdf5/bin | ||
+ | </syntaxhighlight> | ||
+ | The assumption here is that you have run the "install_netcdf4_hdf5.bash" script in a "netcdf4hdf5" subdirectory of your home directory. Adapt accordingly if not. | ||
+ | |||
+ | Check that the installation was successfully installed :-) | ||
+ | Again, a neat way to do that is to run and check the output of | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | nf-config --all | ||
+ | </syntaxhighlight> | ||
03/01/2022 | 03/01/2022 |
Version du 3 janvier 2023 à 14:50
Sommaire
the NetCDF library
The model reads and writes input and output files in NetCDF (Network Common Data Form) format (developed and maintained by Unidata: https://www.unidata.ucar.edu/software/netcdf/ ) and therefore a NetCDF library must be at hand when compiling and running LMDZ6.
As this library is not quite standard, chances are that you might need to install it yourself on your system (note that the install_lmdz.sh default behavior is to download and install that library), hence this page with some indications on how to do so.
Checking if a NetCDF library is already available
It is possible that the library, including its Fortran component, is already available. An easy way to check this is to see if the related utilities like ncdump are available, i.e. that
which ncdump
returns a positive answer.
Note that this does not suffice as the full library, including its Fortran component, and not just the related utilities are required. A neat way to check this is to use the nf-config
nf-config --all
returns something meaningful. If not, you probably need to take some action along the lines of what is indicated in the following sections.
Various ways to install the NetCDF library
Install via a system manager
If on Ubuntu (and with admin, i.e. sudo rights) you can try
sudo apt install libnetcdff-dev
Personal installation
One can always download the source code and compile the NetCDF library (see https://docs.unidata.ucar.edu/netcdf-c/current/faq.html#HowdoIgetthenetCDFsoftwarepackage ). You can use the following home-made "install_netcdf4_hdf5_seq.bash" script to do so. For this, ensure that you are in your home directory and:
mkdir netcdf
cd netcdf
wget -nv --no-check-certificate http://www.lmd.jussieu.fr/~lmdz/pub/import/install_netcdf4_hdf5_seq.bash
chmod u=rwx install_netcdf4_hdf5_seq.bash
./install_netcdf4_hdf5_seq.bash > netcdf.log 2>&1
Compiling the library and dependencies can take a while (>>15 minutes; be patient). Once this is done, check file netcdf.log to verify that all went well. You may want to also add its "bin" directory to your PATH environment variable by adding in your .bashrc a line of:
export PATH=$PATH:$HOME/netcdf/bin
The assumption here is that you have run the "install_netcdf4_hdf5_seq.bash" script in a "netcdf" subdirectory of your home directory. Adapt accordingly if not.
Check that the installation was successfully installed :-) Again, a neat way to do that is to run and check the output of
nf-config --all
Personal installation of an advanced NetCDF4-HDF5 library with MPI enabled
This specific version is useful especially if running with the XIOS library. A prerequisite is to have an MPI library installed and available. You can use the following home-made "install_netcdf4_hdf5_seq.bash" script to do so. For this, ensure that you are in your home directory and:
mkdir netcdf4hdf5
cd netcdf4hdf5
wget -nv --no-check-certificate http://www.lmd.jussieu.fr/~lmdz/pub/import/install_netcdf4_hdf5.bash
chmod u=rwx install_netcdf4_hdf5.bash
./install_netcdf4_hdf5.bash -CC mpicc -FC mpif90 -CXX mpiCC -MPI /path/to/your/MPI/install > netcdf.log 2>&1
You should of course adapt the command line, especially the -MPI /path/to/your/MPI/install part to your settings.
Compiling the library and dependencies can take a while (>>15 minutes; be patient). Once this is done, check file netcdf.log to verify that all went well. You may want to also add its "bin" directory to your PATH environment variable by adding in your .bashrc a line of:
export PATH=$PATH:$HOME/netcdf4hdf5/bin
The assumption here is that you have run the "install_netcdf4_hdf5.bash" script in a "netcdf4hdf5" subdirectory of your home directory. Adapt accordingly if not.
Check that the installation was successfully installed :-) Again, a neat way to do that is to run and check the output of
nf-config --all
03/01/2022