34 | | > tar -xvzf netcdf-3.6.3.tar.gz |
35 | | }}} |
36 | | A directory called netcdf-3.6.3 will be created. Go inside it : |
37 | | {{{ |
38 | | > cd netcdf-3.6.3 |
39 | | }}} |
40 | | If you type ls, you will find : |
41 | | {{{ |
42 | | > ls |
43 | | acinclude.m4 config.guess configure cxx dods.m4 fortran libsrc Makefile.am man4 ncdump nc_test README |
44 | | aclocal.m4 config.h.in configure.ac cxx4 examples INSTALL libsrc4 Makefile.in missing ncgen nc_test4 RELEASE_NOTES |
45 | | compile config.sub COPYRIGHT depcomp f90 install-sh ltmain.sh man ncdap.m4 nctest nf_test win32 |
46 | | |
47 | | }}} |
48 | | Now focus on the script called configure. To know more about this script and the different options available, look at [http://www.unidata.ucar.edu/software/netcdf/docs/netcdf-install/Configure.html#Configure].[[BR]] |
49 | | I execute this script like this : |
50 | | |
51 | | {{{ |
52 | | > ./configure --disable-largefile --disable-cxx |
53 | | }}} |
54 | | In my case, I deactivate the creation of large netcdf files (larger than 2 GB) with the option --disable-largefile. |
55 | | I also deactivate the creation of netcdf libraries for C++ because I don't need it. |
56 | | But to create netcdf libraries for FORTRAN, you have to create netcdf libraries for C. |
57 | | If you have a C compiler and a FORTRAN compiler, you will have no problems. |
58 | | Notice you may need to add --enable-separate-fortran to generate the netcdff library. |
59 | | |
60 | | Now you need to be root user. If you are on Ubuntu system (or Debian), type : |
| 66 | > tar -xvzf netcdf-c-X.Y.Z.tar.gz |
| 67 | }}} |
| 68 | A directory called netcdf-c-X.Y.Z will be created. Go inside it : |
| 69 | {{{ |
| 70 | > cd netcdf-c-X.Y.Z |
| 71 | }}} |
| 72 | |
| 73 | The netcdf package should be linked to previously installed packages (szlib, openmpi, hdf5) at the configuration of package before installation. Different options for build configuration of netcdf-c package installation is given at [https://www.unidata.ucar.edu/software/netcdf/docs/getting_and_building_netcdf.html].[[BR]] |
| 74 | |
| 75 | To be able to see different configuration options, we can command |
| 76 | |
| 77 | {{{ |
| 78 | > ./configure --help |
| 79 | }}} |
| 80 | |
| 81 | This command returns rather a long list of options that we can use building our package in the system. Crucial point here is to make sure the netcdf-C package that we want to install has: |
| 82 | |
| 83 | HDF5 Support |
| 84 | |
| 85 | This can be checked by configuring the installation folder once by: |
| 86 | |
| 87 | |
| 88 | {{{ |
| 89 | > ./configure |
| 90 | }}} |
| 91 | |
| 92 | Which returns a table like this: |
| 93 | |
| 94 | |
| 95 | {{{ |
| 96 | |
| 97 | # NetCDF C Configuration Summary |
| 98 | ============================== |
| 99 | |
| 100 | # General |
| 101 | ------- |
| 102 | NetCDF Version: 4.7.0 |
| 103 | Configured On: Mon Aug 5 15:55:30 CEST 2019 |
| 104 | Host System: x86_64-pc-linux-gnu |
| 105 | Build Directory: /home/#USERNAME#/Téléchargements/libs/netcdf-c-4.7.0 |
| 106 | Install Prefix: /usr/local |
| 107 | |
| 108 | # Compiling Options |
| 109 | ----------------- |
| 110 | C Compiler: /usr/bin/gcc |
| 111 | CFLAGS: |
| 112 | CPPFLAGS: |
| 113 | LDFLAGS: |
| 114 | AM_CFLAGS: |
| 115 | AM_CPPFLAGS: |
| 116 | AM_LDFLAGS: |
| 117 | Shared Library: yes |
| 118 | Static Library: yes |
| 119 | Extra libraries: -lhdf5_hl -lhdf5 -lm -ldl -lz -lcurl |
| 120 | |
| 121 | # Features |
| 122 | -------- |
| 123 | NetCDF-2 API: yes |
| 124 | HDF4 Support: no |
| 125 | HDF5 Support: yes |
| 126 | NetCDF-4 API: yes |
| 127 | NC-4 Parallel Support: no |
| 128 | PnetCDF Support: no |
| 129 | DAP2 Support: yes |
| 130 | DAP4 Support: yes |
| 131 | Byte-Range Support: no |
| 132 | Diskless Support: yes |
| 133 | MMap Support: no |
| 134 | JNA Support: no |
| 135 | CDF5 Support: yes |
| 136 | ERANGE Fill Support: no |
| 137 | Relaxed Boundary Check: yes |
| 138 | }}} |
| 139 | |
| 140 | ''' Important: Installation of ORCHIDEE requires us to know about the destination of these libraries, especially netcdf, the compiler, and HDF5. It is important to take note of the installation destination of each library, which will be used later. The installation destination can be imposed at "./configure" step by "--prefix" option''' |
| 141 | |
| 142 | To complete installation, type : |
134 | | {{{ |
135 | | > vi AA_make.gdef # modify eventually following lines |
136 | | #-Q- gfortran NCDF_INC = /usr/local/include |
137 | | #-Q- gfortran NCDF_LIB = -L/usr/local/lib -lnetcdf |
138 | | > ./ins_make -t gfortran |
139 | | }}} |
140 | | |
141 | | Adapt AA_make, recreate makefile and compile without XIOS : (read more about compilation here [wiki:Documentation/UserGuide/CompileMethods]) |
142 | | {{{ |
143 | | > cd ../config/ORCHIDEE_OL |
144 | | > vi AA_make # Edit the AA_make file to compile in sequential mode |
145 | | > ../../util/ins_make -t gfortran |
146 | | > gmake without_xios |
147 | | }}} |
148 | | |
| 246 | |
| 247 | {{{ |
| 248 | > vi AA_make.gdef # modify eventually following lines ( The modifications can be seen by + and - at the left column of the text below ) |
| 249 | @@ -304,16 +304,16 @@ |
| 250 | #-Q- gfortran M_K = make |
| 251 | #-Q- gfortran P_C = cpp |
| 252 | #-Q- gfortran FCM_ARCH = gfortran |
| 253 | -#-Q- gfortran F_C = gfortran -c -cpp |
| 254 | +#-Q- gfortran F_C = mpifort -c |
| 255 | #-Q- gfortran #-D- MD F_D = -g -Wall -fbounds-check -pedantic -finit-real=nan |
| 256 | #-Q- gfortran #-D- MN F_D = |
| 257 | #-Q- gfortran #-P- I4R4 F_P = |
| 258 | #-Q- gfortran #-P- I4R8 F_P = -fdefault-real-8 |
| 259 | #-Q- gfortran #-P- I8R8 F_P = -fdefault-integer-8 -fdefault-real-8 |
| 260 | -#-Q- gfortran w_w = -O3 -funroll-all-loops $(F_D) $(F_P) -I$(MODDIR) |
| 261 | +#-Q- gfortran w_w = -O3 -cpp -funroll-all-loops $(F_D) $(F_P) -I$(MODDIR) |
| 262 | #-Q- gfortran F_O = $(w_w) -J$(MODDIR) |
| 263 | -#-Q- gfortran F_L = gfortran |
| 264 | +#-Q- gfortran F_L = mpifort |
| 265 | #-Q- gfortran M_M = 0 |
| 266 | #-Q- gfortran L_X = 0 |
| 267 | #-Q- gfortran L_O = |
| 268 | @@ -323,8 +323,8 @@ |
| 269 | #-Q- gfortran C_O = |
| 270 | #-Q- gfortran C_L = cc |
| 271 | #-Q- gfortran #- |
| 272 | -#-Q- gfortran NCDF_INC = /usr/local/include |
| 273 | -#-Q- gfortran NCDF_LIB = -L/usr/local/lib -lnetcdf |
| 274 | +#-Q- gfortran NCDF_INC = /cm/shared/apps/netcdf/4.6.1/include |
| 275 | +#-Q- gfortran NCDF_LIB = -L/cm/shared/apps/netcdf/4.6.1/lib -lnetcdf |
| 276 | #-Q- gfortran #- |
| 277 | #-Q- lxiv8 #- Global definitions for Intel compiler (ifort) with MPI at obelix/LSCE |
| 278 | #-Q- lxiv8 FCM_ARCH=ifort_LSCE |
| 279 | |
| 280 | > ./ins_make -t gfortran # This step is where you define thee target architecture that you want to use for installation ( in our case gfortran) |
| 281 | }}} |
| 282 | |
| 283 | The second modification needed is to change the configuration in model folders. To do this following changes should be made: |
| 284 | |
| 285 | |
| 286 | {{{ |
| 287 | > cd modipsl/modeles |
| 288 | > cp XIOS/arch/arch-GCC_LINUX.env XIOS/arch/arch-gfortran.env |
| 289 | > cp XIOS/arch/arch-GCC_LINUX.fcm XIOS/arch/arch-gfortran.fcm |
| 290 | > cp XIOS/arch/arch-GCC_LINUX.path XIOS/arch/arch-gfortran.path |
| 291 | > cp ORCHIDEE/arch/arch-GCC_LINUX.fcm ORCHIDEE/arch/arch-gfortran.fcm |
| 292 | > cp ORCHIDEE/arch/arch-GCC_LINUX.path ORCHIDEE/arch/arch-gfortran.path |
| 293 | }}} |
| 294 | |
| 295 | |
| 296 | Once these files are copied, now we can build our configuration files for the system we have under the architecture name "gfortran". |
| 297 | |
| 298 | Remark before we make changes: |
| 299 | - Each of these files we copied has a goal to define the library destination for libraries we will use (.env file), give the compiler required flags (settings) for installation of packages ( .fcm file), and define the libraries we will use for installation (.path file). |
| 300 | - Therefore, we should modify these files for the library and include directories of MPI, NETCDF, HDF5 that we are using. |
| 301 | - In my case, installation gave an error where it did not read c++ type comments in fortran files, therefore, I needed to include a library in fortran part hence the compiler could read c++ type comments in fortran compilation. |
| 302 | - ORCHIDEE model does not comprise a ".env" folder, the library and include directories will be defined in ".path" file. |
| 303 | |
| 304 | In the XIOS folder: |
| 305 | |
| 306 | arch-gfortran.env file should comprise ( lines after "#" are my comments, should be deleted if you want to use this script): |
| 307 | |
| 308 | {{{ |
| 309 | export HDF5_INC_DIR=/cm/shared/apps/hdf5/1.10.2/include # This should be modified for your include directory of HDF5 package |
| 310 | export HDF5_LIB_DIR=/cm/shared/apps/hdf5/1.10.2/lib # This should be modified for your library directory of HDF5 package |
| 311 | |
| 312 | export NETCDF_INC_DIR=/cm/shared/apps/netcdf/4.6.1/include # This should be modified for your include directory of NETCDF package |
| 313 | export NETCDF_LIB_DIR=/cm/shared/apps/netcdf/4.6.1/libs # This should be modified for your library directory of NETCDF package |
| 314 | |
| 315 | export BOOST_INC_DIR=$HOME/boost |
| 316 | export BOOST_LIB_DIR=$HOME/boost |
| 317 | |
| 318 | }}} |
| 319 | |
| 320 | |
| 321 | |
| 322 | arch-gfortran.fcm file should comprise ( lines after "#" are my comments, should be deleted if you want to use this script): |
| 323 | |
| 324 | {{{ |
| 325 | %CCOMPILER mpicc # the mpi wrappers of gcc compilers are inserted here, |
| 326 | #you may use gcc as well |
| 327 | %FCOMPILER mpif90 # the mpi wrappers of gcc compilers are inserted here, |
| 328 | #you may use gfortran as well |
| 329 | %LINKER mpif90 # the mpi wrappers of gcc compilers are inserted here, |
| 330 | #you may use gfortran as well |
| 331 | |
| 332 | # This part gives compiler the necessary flags, thus the compiler understands under |
| 333 | #which configurations it is compiling ORCHIDEE |
| 334 | |
| 335 | %BASE_CFLAGS -ansi -w -L/cm/apps/shared/openmpi/gcc/1.10.3/lib64 |
| 336 | %PROD_CFLAGS -O3 -DBOOST_DISABLE_ASSERTS |
| 337 | %DEV_CFLAGS -g -O2 |
| 338 | %DEBUG_CFLAGS -g |
| 339 | |
| 340 | %BASE_FFLAGS -D__NONE__ -ffree-line-length-none -L/cm/apps/shared/openmpi/gcc/64/1.10.3/lib64 |
| 341 | %PROD_FFLAGS -O3 |
| 342 | %DEV_FFLAGS -g -O2 |
| 343 | %DEBUG_FFLAGS -g |
| 344 | |
| 345 | %BASE_INC -D__NONE__ |
| 346 | %BASE_LD -lstdc++ |
| 347 | |
| 348 | %CPP cpp |
| 349 | %FPP cpp -P |
| 350 | %MAKE make |
| 351 | }}} |
| 352 | |
| 353 | arch-gfortran.path file should comprise ( lines after "#" are my comments, should be deleted if you want to use this script): |
| 354 | |
| 355 | {{{ |
| 356 | NETCDF_INCDIR="-I$NETCDF_INC_DIR" ## these variables are imported from .env file |
| 357 | NETCDF_LIBDIR="-L$NETCDF_LIB_DIR" |
| 358 | NETCDF_LIB="-lnetcdff -lnetcdf" ## declaration of libraries to be used |
| 359 | |
| 360 | MPI_INCDIR="-I/cm/shared/apps/openmpi/gcc/64/1.10.3/include" |
| 361 | MPI_LIBDIR="-L/cm/shared/apps/openmpi/gcc/64/1.10.3/lib64" |
| 362 | MPI_LIB="-lcurl" |
| 363 | |
| 364 | HDF5_INCDIR="-I$HDF5_INC_DIR" |
| 365 | HDF5_LIBDIR="-L$HDF5_LIB_DIR" |
| 366 | HDF5_LIB="-lhdf5_hl -lhdf5 -lz" |
| 367 | |
| 368 | BOOST_INCDIR="-I $BOOST_INC_DIR" |
| 369 | BOOST_LIBDIR="-L $BOOST_LIB_DIR" |
| 370 | BOOST_LIB="" |
| 371 | |
| 372 | OASIS_INCDIR="-I$PWD/../../oasis3-mct/BLD/build/lib/psmile.MPI1" |
| 373 | OASIS_LIBDIR="-L$PWD/../../oasis3-mct/BLD/lib" |
| 374 | OASIS_LIB="-lpsmile.MPI1 -lscrip -lmct -lmpeu" |
| 375 | }}} |
| 376 | |
| 377 | |
| 378 | |
| 379 | Within ORCHIDEE folder: |
| 380 | |
| 381 | |
| 382 | arch-gfortran.path file should comprise ( lines after "#" are my comments, should be deleted if you want to use this script): |
| 383 | |
| 384 | {{{ |
| 385 | NETCDF_LIBDIR="-L/cm/shared/apps/netcdf/4.6.1/lib -lnetcdf -lnetcdff" #destinations for lib should be modified for your system (where you have installed the library) |
| 386 | NETCDF_INCDIR="-I/cm/shared/apps/netcdf/4.6.1/include" # destinations for inc should be modified for your system (where you have installed the library) |
| 387 | IOIPSL_INCDIR="-I${ORCHDIR}/../../lib" |
| 388 | IOIPSL_LIBDIR="-L${ORCHDIR}/../../lib -lioipsl" |
| 389 | XIOS_INCDIR="-I${ORCHDIR}/../XIOS/inc" |
| 390 | XIOS_LIBDIR="-L${ORCHDIR}/../XIOS/lib -lxios" |
| 391 | MPI_INCDIR="-I/cm/shared/apps/openmpi/gcc/64/1.10.3/include" # destinations for inc should be modified for your system (where you have installed the library) |
| 392 | MPI_LIBDIR="-L/cm/shared/apps/openmpi/gcc/64/1.10.3/lib64" # destinations for lib should be modified for your system (where you have installed the library) |
| 393 | }}} |
| 394 | |
| 395 | |
| 396 | |
| 397 | arch-gfortran.fcm file should comprise ( lines after "#" are my comments, should be deleted if you want to use this script): |
| 398 | |
| 399 | {{{ |
| 400 | |
| 401 | %COMPILER mpifort # the mpi wrappers of gcc compilers are inserted here, |
| 402 | #you may use gcc as well |
| 403 | %LINK mpifort # the mpi wrappers of gcc compilers are inserted here, |
| 404 | #you may use gcc as well |
| 405 | |
| 406 | #declaration of flags for compiler |
| 407 | %AR ar |
| 408 | %MAKE make |
| 409 | %FPP_FLAGS -P -C -traditional |
| 410 | %FPP_DEF |
| 411 | %BASE_FFLAGS -fdefault-real-8 -cpp -L/cm/shared/apps/openmpi/gcc/64/1.10.3/lib64 |
| 412 | %PROD_FFLAGS -O3 -funroll-all-loops |
| 413 | %DEV_FFLAGS -O |
| 414 | %DEBUG_FFLAGS -ffpe-trap=invalid,zero,overflow -Wall -fbounds-check -g3 -O0 -fstack-protector-all |
| 415 | %MPI_FFLAGS |
| 416 | %OMP_FFLAGS |
| 417 | %BASE_LD |
| 418 | %MPI_LD -lstdc++ -lmpi_cxx |
| 419 | %OMP_LD |
| 420 | |
| 421 | }}} |
| 422 | |
| 423 | Step 3: Compilation |
| 424 | |
| 425 | Up to this point, we have installed necessary packages required by ORCHIDEE, modipsl directory, ORCHIDEE libraries, and finally, we modified ORCHIDEE installation files for our system environment. From this point there is only the actual compilation left. Installation can be completed by: |
| 426 | |
| 427 | {{{ |
| 428 | |
| 429 | > cd modipsl/config/ORCHIDEE_OL |
| 430 | > ./make with_xios |
| 431 | }}} |