You are on page 1of 6

installing CDT in cdtuser

default environment values before loading modules.


LD_LIBRARY_PATH =
/opt/ohpc/pub/libs/singularity/2.6.0/lib:
/opt/ohpc/pub/mpi/openmpi3-gnu7/3.1.0/lib:
/opt/ohpc/pub/compiler/gcc/7.3.0/lib64:
PATH =
/opt/xcat/bin:
/opt/xcat/sbin:
/opt/xcat/share/xcat/tools:
/opt/ohpc/pub/libs/singularity/2.6.0/bin:
/opt/ohpc/pub/mpi/openmpi3-gnu7/3.1.0/bin:
/opt/ohpc/pub/compiler/gcc/7.3.0/bin:
/opt/ohpc/pub/utils/prun/1.2:
/opt/ohpc/pub/bin:/opt/lenovo/onecli:
/opt/confluent/bin:/usr/local/bin:
/usr/bin:/usr/local/sbin:/usr/sbin:
/usr/lpp/mmfs/bin:
/gpfs/home/cdtuser/.local/bin:
/gpfs/home/cdtuser/bin:
INCLUDE =
/opt/ohpc/pub/compiler/gcc/7.3.0/include:

NOTE: all wget and build(make/cmake) commands was done inside "~/downloads" folder.
all libraries and binaries were installed in "/~installed_programs" in its
respective directories. use "export" command to add libraries and binaries to the
environment for use.

default loaded modules.


-openmpi3/3.1.0
-gnu7/7.3.0
-ohpc
-prun/1.2
-singularity/2.6.0

calling module load to load additional modules. this would make sure that everthing
in default should work properly.
command:
module load cmake/3.12.2 hdf5 intel_2019 netcdf-c netcdf-fortran udunits2

default environment values after loading modules. revert back to this when
everthing goes wrong.
LD_LIBRARY_PATH =
/gpfs/module/hdf5/lib:
/gpfs/module/udunits2/lib:
/gpfs/module/netcdf-fortran/lib:
/gpfs/module/netcdf-c/lib:
/opt/ohpc/pub/libs/singularity/2.6.0/lib:
/opt/ohpc/pub/mpi/openmpi3-gnu7/3.1.0/lib:
/opt/ohpc/pub/compiler/gcc/7.3.0/lib64
PATH =
/gpfs/compilers/intel2019/impi/2019.4.243/intel64/bin:
/gpfs/compilers/intel2019/bin:
/gpfs/module/hdf5/bin:
/gpfs/module/udunits2/bin:
/gpfs/module/netcdf-fortran/bin:
/gpfs/module/netcdf-c/bin:
/opt/ohpc/pub/utils/cmake/3.12.2/bin:
/opt/xcat/bin:/opt/xcat/sbin:
/opt/xcat/share/xcat/tools:
/opt/ohpc/pub/libs/singularity/2.6.0/bin:
/opt/ohpc/pub/mpi/openmpi3-gnu7/3.1.0/bin:
/opt/ohpc/pub/compiler/gcc/7.3.0/bin:
/opt/ohpc/pub/utils/prun/1.2:
/opt/ohpc/pub/bin:
/opt/lenovo/onecli:
/opt/confluent/bin:
/usr/local/bin:
/usr/bin:
/usr/local/sbin:
/usr/sbin:
/usr/lpp/mmfs/bin:
/gpfs/home/cdtuser/.local/bin:
/gpfs/home/cdtuser/bin:
INCLUDE=
/gpfs/compilers/intel2019/compilers_and_libraries_2019/linux/include:
/gpfs/compilers/intel2019/include:
/gpfs/module/hdf5/include:
/gpfs/module/udunits2/include:
/gpfs/module/netcdf-fortran/include:
/gpfs/module/netcdf-c/include:
/opt/ohpc/pub/compiler/gcc/7.3.0/include

installing CDT required linux packages.


1. Tcl/Tk
1.1 TCL
cd ~/downloads
wget https://prdownloads.sourceforge.net/tcl/tcl8.6.12-src.tar.gz --no-
check-certificate
tar -zxvf tcl8.6.12-src.tar.gz
cd tcl8.6.12/unix/
./configure --prefix=/gpfs/home/cdtuser/installed_programs/tcl8.6.12
make -j 8
make check
make install
export PATH=~/installed_programs/tcl8.6.12/bin:$PATH
export LD_LIBRARY_PATH=~/installed_programs/tcl8.6.12/lib:
$LD_LIBRARY_PATH
export INCLUDE=~/installed_programs/tcl8.6.12/include:$INCLUDE
1.2 TK
cd ~/downloads
wget https://prdownloads.sourceforge.net/tcl/tk8.6.12-src.tar.gz --no-
check-certificate
tar -zxvf
cd tk8.6.12/unix/
./configure --prefix=/gpfs/home/cdtuser/installed_programs/tk8.6.12
make -j 8
make check
make install
export PATH=~/installed_programs/tk8.6.12/bin:$PATH
export LD_LIBRARY_PATH=~/installed_programs/tk8.6.12/lib:
$LD_LIBRARY_PATH
export INCLUDE=~/installed_programs/tk8.6.12/include:$INCLUDE
2. HPC proj version is 4.8.0, required by CDT is 4.9.3, build PROJ 4.9.3 from
source.
cd ~/downloads/
wget https://download.osgeo.org/proj/proj-4.9.3.tar.gz --no-check-certificate
tar -zxvf proj-4.9.3.tar.gz
cd proj-4.9.3/
./configure --prefix=/gpfs/home/cdtuser/installed_programs/proj-4.9.3
make -j 8
make check
make install
export PATH=~/installed_programs/proj-4.9.3/bin:$PATH
export INCLUDE=~/installed_programs/proj-4.9.3/include:$INCLUDE
export LD_LIBRARY_PATH=~/installed_programs/proj-4.9.3/lib:$LD_LIBRARY_PATH
export PROJ_LIB=~/installed_programs/proj-4.9.3/lib
export PKG_CONFIG_PATH=~/installed_programs/proj-4.9.3/lib/pkgconfig:
$PKG_CONFIG_PATH

3. GDAL/OGR (build from source, if no existing ogrinfo found)


3.1 GDAL
export PATH=$PATH:/gpfs/usr/local/bin <- this gdal version is 1.11.2,
we need >= 1.11.4
wget https://download.osgeo.org/gdal/2.4.2/gdal-2.4.2.tar.gz --no-
check-certificate <- (oldest release available in https://gdal.org/download.html)
tar -zxvf gdal-2.4.2.tar.gz
cd gdal-2.4.2
./configure --prefix=/gpfs/home/cdtuser/installed_programs/gdal-2.4.2
--with-proj=/gpfs/home/cdtuser/installed_programs/proj-4.9.3
make -j 8
make check (will not produce any usable information and will no do some
checking.)
make install
export PATH=~/installed_programs/gdal-2.4.2/bin:$PATH
export LD_LIBRARY_PATH=~/installed_programs/gdal-2.4.2/lib:
$LD_LIBRARY_PATH
export INCLUDE=~/installed_programs/gdal-2.4.2/include:$INCLUDE
3.2 GEOS
wget https://download.osgeo.org/geos/geos-3.9.3.tar.bz2 --no-check-
certificate
tar -xvf geos-3.9.3.tar.bz2
cd geos-3.9.3
./configure --prefix=/gpfs/home/cdtuser/installed_programs/geos-3.9.3
make
make check
make install
~/installed_programs/geos-3.9.3/bin/geos-config
export PATH=~/installed_programs/geos-3.9.3/bin:$PATH
export LD_LIBRARY_PATH=~/installed_programs/geos-3.9.3/lib:
$LD_LIBRARY_PATH
4. NetCDF (build from source, if no existing ncdump found)
module load netcdf-c netcdf-fortran

Installing and building R from source.


1. create installed_programs directory (this is where future additional builds,
programs should be installed)
mkdir installed_programs
2. create downloads directory (this is where to put downloaded packages, sources,
and other software/apps)
mkdir downloads
3. download R source package.
wget https://cran.r-project.org/src/base/R-4/R-4.2.1.tar.gz
4. untar R source.
tar -zxvf R-4.2.1.tar.gz
5. go to R source directory.
cd R-4.2.1
6. Export libraries and header(include) directories.
export TCLTK_LIBS=~/installed_programs/tcl8.6.12/lib:~/installed_programs/
tk8.6.12/lib
export
TCLTK_CPPFLAGS=~/installed_programs/tcl8.6.12/include:~/installed_programs/
tk8.6.12/include
6. configure R.
./configure --with-pcre1 --prefix=/gpfs/home/cdtuser/installed_programs/R-
4.2.1 --enable-R-shlib --with-blas --with-lapack --with-tcltk
--with-tcl-config=/gpfs/home/cdtuser/installed_programs/tcl8.6.12/lib/tclConfig.sh
--with-tk-config=/gpfs/home/cdtuser/installed_programs/tk8.6.12/lib/tkConfig.sh
(check config logs, make sure tcltk is configured properly. Xming should be
also installed.)
7. make and make install
make -j 8
make check
make install
8. test the build.
~/installed_programs/R-4.2.1/bin/R
9. export it to environment.
export PATH=/gpfs/home/cdtuser/installed_programs/R-4.2.1/bin:$PATH
export LD_LIBRARY_PATH=~/installed_programs/R-4.2.1/lib:$LD_LIBRARY_PATH

Installing CDT requires in R.


- open R.
R
- install ncdf4.
nc_config <- '/gpfs/module/netcdf-c/bin/nc-config'
install.packages('ncdf4', type = "source", configure.args = paste0('--
with-nc-config=', nc_config))
- install rgdal.
gdal_config <-
'/gpfs/home/cdtuser/installed_programs/gdal-2.4.2/bin/gdal-config'
proj_include <-
'/gpfs/home/cdtuser/installed_programs/proj-4.9.3/include'
proj_lib <- '/gpfs/home/cdtuser/installed_programs/proj-4.9.3/lib'
install.packages("rgdal", type = "source", configure.args =
c(paste0('--with-proj-include=', proj_include), paste0('--with-proj-lib=',
proj_lib), paste0('--with-gdal-config=', gdal_config),
'--with-proj-share=/gpfs/home/cdtuser/installed_programs/proj-4.9.3/share/proj')) -
(need gdal >= 1.11.4, in the system 1.11.2)
- install geos.
geos_config <-
'/gpfs/home/cdtuser/installed_programs/geos-3.9.3/bin/geos-config'
install.packages("rgeos", type = "source", configure.args = paste0('--
with-geos-config=', geos_config))

install CDT in R. following lines were commands except for lines starting with "-".
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:
install.packages("devtools")
- if error in ragg need to install textshaping. if still error occurs
make sure you have libharfbuzz and libfribidi package, check in PKG_CONFIG_PATH's,
textshaping is looking for two specific files, harfbuzz.pc and fribidi.pc. if not
existing, use export, quit R first.
- if you cant find both files build both packages.
- make sure you are in the download directory.
cd ~/downloads
- building fribidi
wget https://github.com/fribidi/fribidi/releases/download/v1.0.12/fribidi-
1.0.12.tar.xz
unxz fribidi-1.0.12.tar.xz
tar -xvf fribidi-1.0.12.tar
cd fribidi-1.0.12/
./configure --prefix=/gpfs/home/cdtuser/installed_programs/fribidi-1.0.12
make
make check
make install
export LD_LIBRARY_PATH=~/installed_programs/fribidi-1.0.12/lib:
$LD_LIBRARY_PATH
export PKG_CONFIG_PATH=/gpfs/home/cdtuser/installed_programs/fribidi-1.0.12/
lib/pkgconfig:$PKG_CONFIG_PATH
- build freetype as required by harfbuzz
cd ~/downloads
wget https://download.savannah.gnu.org/releases/freetype/freetype-
2.11.1.tar.gz --no-check-certificate
tar -zxvf freetype-2.11.1.tar.gz
cd freetype-2.11.1/
./configure --prefix=/gpfs/home/cdtuser/installed_programs/freetype-2.11.1
make -j 8
make check
make install
export PKG_CONFIG_PATH=/gpfs/home/cdtuser/installed_programs/freetype-
2.11.1/lib/pkgconfig:$PKG_CONFIG_PATH
export LD_LIBRARY_PATH=/gpfs/home/cdtuser/installed_programs/freetype-
2.11.1/lib:$LD_LIBRARY_PATH
- building harfbuzz
cd ~/downloads
wget https://github.com/harfbuzz/harfbuzz/releases/download/5.1.0/harfbuzz-
5.1.0.tar.xz
unxz harfbuzz-5.1.0.tar.xz
tar -xvf harfbuzz-5.1.0.tar
cd harfbuzz-5.1.0/
export FREETYPE_CFLAGS="-I/gpfs/home/cdtuser/installed_programs/freetype-
2.11.1/include/freetype2"
export FREETYPE_LIBS="-L/gpfs/home/cdtuser/installed_programs/freetype-
2.11.1/lib -lfreetype"
./configure --prefix=/gpfs/home/cdtuser/installed_programs/harfbuzz-5.1.0 --
with-freetype=yes
make -j 8
make check (will not work, need python3, only python2 was installed in the
hpc, can be skipped but if error or failure exist, it cant be traced.)
make install
export PKG_CONFIG_PATH=/gpfs/home/cdtuser/installed_programs/harfbuzz-5.1.0/
lib/pkgconfig:$PKG_CONFIG_PATH
- rebuild devtools.
R
install.packages("devtools")
- manual install terra.
install.packages('terra', repos='https://rspatial.r-universe.dev',
configure.args="--with-proj-share=/gpfs/home/cdtuser/installed_programs/proj-
4.9.3/share/proj")
- if error occured in units do manual install.
install.packages('units',
configure.args=c('--with-udunits2-lib=/gpfs/module/udunits2/lib','--with-udunits2-
include=/gpfs/module/udunits2/include'))
devtools::install_github("rijaf-iri/CDT")
Running CDT with DEM.
CDT will still throw errors regarding libraries. It seems that slurm can't see
libraries inside /usr/lib64, /usr/bin and /usr/include.
cp /usr/lib64/libjpeg.so.62 ~/installed_programs/lib_req_CDT/.
cp /usr/lib64/libjasper.so.1 ~/installed_programs/lib_req_CDT/.
cp /usr/lib64/libgeotiff.so.1.2 ~/installed_programs/lib_req_CDT/.
cp /usr/lib64/libtiff.so.5 ~/installed_programs/lib_req_CDT/.
cp /usr/lib64/libproj.so.0 ~/installed_programs/lib_req_CDT/.
cp /usr/lib64/libjbig.so.2.0 ~/installed_programs/lib_req_CDT/.

Setting up environment variables after logging in.


module load cmake/3.12.2 hdf5 intel_2019 netcdf-c netcdf-fortran udunits2
export
PATH=~/installed_programs/tcl8.6.12/bin:~/installed_programs/tk8.6.12/bin:~/
installed_programs/proj-4.9.3/bin:~/installed_programs/gdal-2.4.2/bin:~/
installed_programs/geos-3.9.3/bin:~/installed_programs/fribidi-1.0.12/bin:~/
installed_programs/harfbuzz-5.1.0/bin:~/installed_programs/R-4.2.1/bin:$PATH
export INCLUDE=~/installed_programs/tcl8.6.12/include:~/installed_programs/
tk8.6.12/include:~/installed_programs/proj-4.9.3/include:~/installed_programs/gdal-
2.4.2/include:~/installed_programs/geos-3.9.3/include:~/installed_programs/fribidi-
1.0.12/include:~/installed_programs/freetype-2.11.1/include:~/installed_programs/
harfbuzz-5.1.0/include:~/installed_programs/R-4.2.1/lib64/R/include:$INCLUDE
export
LD_LIBRARY_PATH=~/installed_programs/tcl8.6.12/lib:~/installed_programs/tk8.6.12/
lib:~/installed_programs/proj-4.9.3/lib:~/installed_programs/gdal-2.4.2/lib:~/
installed_programs/geos-3.9.3/lib:~/installed_programs/fribidi-1.0.12/lib:~/
installed_programs/freetype-2.11.1/lib:~/installed_programs/harfbuzz-5.1.0/lib:~/
installed_programs/R-4.2.1/lib64/R/lib:~/installed_programs/lib_req_CDT:~/
installed_programs/lib_req_CDT:$LD_LIBRARY_PATH
export PROJ_LIB=~/installed_programs/proj-4.9.3/lib
export
PKG_CONFIG_PATH=~/installed_programs/proj-4.9.3/lib/pkgconfig:~/installed_programs/
fribidi-1.0.12/lib/pkgconfig:~/installed_programs/harfbuzz-5.1.0/lib/pkgconfig:~/
installed_programs/R-4.2.1/lib64/pkgconfig:$PKG_CONFIG_PATH
export TCLTK_LIBS=~/installed_programs/tcl8.6.12/lib:~/installed_programs/
tk8.6.12/lib
export
TCLTK_CPPFLAGS=~/installed_programs/tcl8.6.12/include:~/installed_programs/
tk8.6.12/include
export FREETYPE_CFLAGS="-I/gpfs/home/cdtuser/installed_programs/freetype-
2.11.1/include/freetype2"
export FREETYPE_LIBS="-L/gpfs/home/cdtuser/installed_programs/freetype-
2.11.1/lib -lfreetype"

You might also like