-
Notifications
You must be signed in to change notification settings - Fork 0
machine instructions ubuntu gfortran
sudo apt-get install gfortran libhdf5-dev m4 cmake libopenmpi-dev
Download and untar the latest netcdf
, netcdf-fortran
, netcdf-cxx
(not netcdf-cxx4
) and parallel-netcdf
source. These are the latest at the time of this writing:
Modify /path/to/dependencies
to be a path where you would like to install the dependencies. I recommend that this not be a system path (e.g. not /usr
or /usr/local
) to make it easier to make changes later on.
export NETCDF=/path/to/dependencies
export PNETCDF=$NETCDF
export PIO=$NETCDF
export HDF5_INCLUDE=/usr/include/hdf5/serial/
export HDF5_LIB=/usr/lib/x86_64-linux-gnu/hdf5/serial/
export LD_LIBRARY_PATH=${NETCDF}/lib:${LD_LIBRARY_PATH}
export CPPFLAGS="-I$HDF5_INCLUDE -I${NETCDF}/include"
export LDFLAGS="-L$HDF5_LIB -L${NETCDF}/lib"
cd netcdf-4.4.1.1
./configure --disable-dap --enable-netcdf-4 --disable-cxx --enable-shared --disable-static --enable-fortran \
--enable-hdf5 --prefix=$NETCDF
make
make check
make install
cd ..
cd netcdf-fortran-4.4.4
./configure --disable-static --prefix=$NETCDF
make
make check
make install
cd ..
cd netcdf-cxx-4.2
./configure --disable-static --prefix=$NETCDF
make
make check
make install
cd ..
cd parallel-netcdf-1.8.1
./configure --prefix=$NETCDF
make
make check
make install
cd ..
git clone [email protected]:NCAR/ParallelIO.git
cd ParallelIO
export PIOSRC=`pwd`
cd ..
rm -rf pio
mkdir pio
cd pio
export CC=mpicc
export FC=mpif90
cmake -DNetCDF_C_PATH=$NETCDF -DNetCDF_Fortran_PATH=$NETCDF \
-DPnetCDF_PATH=$PNETCDF -DCMAKE_INSTALL_PREFIX=$NETCDF $PIOSRC
make
make check
make install
cd ..
As an alternative to using LD_LIBRARY_PATH
, you can add your custom directory ($NETCDF/lib
) to the cache of shared libraries following these instructions. If you do that, you also shouldn't need to include the LD_LIBRARY_PATH
line below.
To load dependencies before compiling MPAS, it is useful to create a bash file (e.g. setup_mpas_dependencies.bash
) that can be sourced before compiling MPAS. Here is an example:
export CORE=ocean
export USE_PIO2=true
export NETCDF=/path/to/dependencies
export PNETCDF=$NETCDF
export PIO=$NETCDF
# if you didn't add the libraries to the shared library cache already
export LD_LIBRARY_PATH=${NETCDF}/lib:${LD_LIBRARY_PATH}
Note, this will only work as expected once #1362 is merged.
make gfortran