forked from karpob/pycrtm
-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathmake_it_so_discover.bash
More file actions
executable file
·117 lines (100 loc) · 3.33 KB
/
make_it_so_discover.bash
File metadata and controls
executable file
·117 lines (100 loc) · 3.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#!/usr/bin/env bash
module purge
export SEL=${1}
if [[ ${SEL} == 'gcc' ]]; then
export MOD_SET='gcc-12.3.0'
fi
if [[ ${SEL} == 'intel' ]]; then
export MOD_SET='intel-2021.10.0'
fi
module load anaconda
if [[ ${SEL} == 'gcc' ]]; then
module use /discover/swdev/gmao_SIteam/modulefiles-SLES15
fi
module use /gpfsm/dswdev/jcsda/spack-stack/scu17/spack-stack-1.9.0/envs/ue-${MOD_SET}/install/modulefiles/Core
if [[ ${SEL} == 'gcc' ]]; then
module load stack-gcc/12.3.0
module load stack-openmpi
fi
if [[ ${SEL} == 'intel' ]]; then
module load stack-intel
module load stack-intel-oneapi-mpi
fi
module load git-lfs
module load netcdf-c
module load netcdf-cxx4
module load netcdf-fortran
export CONDA_VENV="pycrtm_${MOD_SET}_modern"
conda create --name ${CONDA_VENV} python=3.11 ipykernel cartopy scipy dask xarray scikit-build h5py netcdf4 cmake
conda activate ${CONDA_VENV}
export PWDOLD=${PWD}
export CHECKOUT_PATH="${PWD}/.local"
export PYCRTM_PATH="${PWD}"
#load modules here so have netcdf env variables in conda
if [[ ${SEL} == 'gcc' ]]; then
module load stack-gcc/12.3.0
fi
module load netcdf-c
module load netcdf-cxx4
module load netcdf-fortran
# Activate the environment
# adjust this to your own tastes
export FPIC="-fPIC"
# make sure -fPIC is set before CRTM is built, add to FFLAGS
if [[ -z "$FFLAGS" ]]; then
export FFLAGS="${FPIC}"
echo "Environment variable FFLAGS not found. Setting it to '${FPIC}'."
elif [[ ! "$!FFLAGS" =~ (^|[[:space:]])"${FPIC}"($|[[:space:]]) ]]; then
export FFLAGS="${FFLAGS} ${FPIC}"
echo "Flag '${FPIC}' not found in FFLAGS. Appending it."
else
echo "Flag '${FPIC}' is already set in FFLAGS."
fi
#make sure -fPIC is set before CRTM is build, add to FORTRANFLAGS
if [[ -z "$FORTRANFLAGS" ]]; then
export FORTRANFLAGS="${FPIC}"
echo "Environment variable FORTRANFLAGS not found. Setting it to '${FPIC}'."
elif [[ ! "$!FORTRANFLAGS" =~ (^|[[:space:]])"${FPIC}"($|[[:space:]]) ]]; then
export FORTRANFLAGS="${FORTRANFLAGS} ${FPIC}"
echo "Flag '${FPIC}' not found in FORTRANFLAGS. Appending it."
else
echo "Flag '${FPIC}' is already set in FORTRANFLAGS."
fi
# checkout and buildtest CRTM
mkdir $CHECKOUT_PATH
echo ${CHECKOUT_PATH}
cd ${CHECKOUT_PATH}
echo $PWD
git clone git@github.com:JCSDA/CRTMv3.git
cd CRTMv3
git checkout v3.1.1+build1
conda list
mkdir build
cd build
cmake -DBUILD_SHARED_LIBS=OFF ../
make -j8
make install
ctest -j8
cd $CHECKOUT_PATH
cd ${PYCRTM_PATH}
#git clone git@github.com:JCSDA/pycrtm.git
#git checkout feature/prepCRTMv3
rm setup.cfg
printf "[Setup]\n">>setup.cfg
printf "# Specify the location of the crtm install\n">>setup.cfg
printf "crtm_install =${CHECKOUT_PATH}/CRTMv3/build/\n" >> setup.cfg
printf "link_from_source_to_path_used = True\n" >> setup.cfg
printf "[Coefficients]\n" >> setup.cfg
printf "# source specify coefficient directory will grab little endian binary coefficients and netcdf and link them to path_used\n">>setup.cfg
printf "source_path =${CHECKOUT_PATH}/CRTMv3/build/test_data/\n" >> setup.cfg
printf "# path used by pycrtm to read coefficients\n" >> setup.cfg
printf "path_used =${CHECKOUT_PATH}/crtm_coefficients\n" >> setup.cfg
#export FORCE_CMAKE=1
#pip install --upgrade cmake
mkdir $PWD/tmp
export TMPDIR=$PWD/tmp
pip install . -v --no-cache-dir
conda env config vars set LD_LIBRARY_PATH=${LD_LIBRARY_PATH}
cd testCases
python3 test_atms.py
cd $PWDOLD