- 执行以下命令,解压WRFDA安装包。
tar -zxvf WRFDA-3.9.1.tar.gz
- 执行以下命令,进入WRFDA源码目录。
cd WRFDA-3.9.1
- 执行以下命令,设置编译前环境。
export WRFIO_NCD_LARGE_FILE_SUPPORT=1
export NETCDF=/path/to/NETCDF
export HDF5=/path/to/HDF5
export PNETCDF=/path/to/PNETCDF
export CPPFLAGS="-I$HDF5/include -I$PNETCDF/include -I$NETCDF/include"
export LDFLAGS="-L$HDF5/lib -L$PNETCDF/lib -L$NETCDF/lib -lnetcdf -lnetcdff -lpnetcdf -lhdf5_hl -lhdf5 -lz"
export JASPERLIB=/path/to/JASPER/lib
export JASPREINC=/path/to/JASPER/inlucde
export WRF_DIR=/path/to/WRF
export RTTOV=/path/to/RTTOV
export MPI_LIB="-L$MPI_LIB -lmpi -lomp"
export CC=mpicc CXX=mpicxx FC=mpif90 F77=mpif90 F90=mpif90
- 执行以下命令,编写compile.patch。
vim compile.patch
332a333,344
> set hdf5path = ( `grep "^HDF5PATH" configure.wrf | cut -d"=" -f2-` )
> if ( $hdf5path == "" ) then
> setenv HDF5_INC ""
> unsetenv HDF5
> else
> echo " "
> echo "Compiling with HDF5 libraries in:"
> echo $hdf5path
> echo " "
> setenv HDF5_INC "-I${hdf5path}/include"
> setenv HDF5 1
> endif
355c367
< setenv RTTOV_LIB "-L${RTTOV}/lib -lrttov11_coef_io -lrttov11_emis_atlas -lrttov11_main"
---
> setenv RTTOV_LIB "-L${hdf5path}/lib -lhdf5hl_fortran -lhdf5_hl -lhdf5_fortran -lhdf5 -L${RTTOV}/lib -lrttov11_coef_io -lrttov11_emis_atlas -lrttov11_main -lrttov11_hdf"
363,374d374
< endif
< set hdf5path = ( `grep "^HDF5PATH" configure.wrf | cut -d"=" -f2-` )
< if ( $hdf5path == "" ) then
< setenv HDF5_INC ""
< unsetenv HDF5
< else
< echo " "
< echo "Compiling with HDF5 libraries in:"
< echo $hdf5path
< echo " "
< setenv HDF5_INC "-I${hdf5path}/include"
< setenv HDF5 1
- 执行以下命令,编写configure.patch。
vim configure.patch
650a651,652
> echo "================================================================================================="
>
- 执行以下命令,编写configure_new.patch。
vim configure_new.patch
1875a1876,1920
> #ARCH Linux aarch64, bisheng, hmpi #serial smpar dmpar dm+sm
> #
> DESCRIPTION = CLANG ($SFC/$SCC)
> DMPARALLEL = 1
> OMPCPP = -D_OPENMP
> OMP = -fopenmp
> OMPCC = -fopenmp
> SFC = flang
> SCC = clang
> CCOMP = clang
> DM_FC = mpif90 -mllvm -disable-sincos-opt -mllvm -enable-alt-precision-math-functions
> DM_CC = mpicc -cc=$(SCC) -DMPI2_SUPPORT
> FC = time $(DM_FC)
> CC = $(DM_CC) -DFSEEKO64_OK
> LD = $(FC) -fuse-ld=lld -L/workspace/public/software/libs/kml/1.6.0/lib -lkm_l9 # -L/workspace/home/shenchao/wubingcheng/xc/jxqxj/3.9.1/WRFDA-3.9.1/dump_hook -lprintmd5
> RWORDSIZE = $(NATIVE_RWORDSIZE)
> PROMOTION = -fdefault-real-8 -fdefault-double-8
> ARCH_LOCAL = -DNONSTANDARD_SYSTEM_SUBR -DWRF_USE_CLM
> CFLAGS_LOCAL = -w -O0 -g -ffp-model=precise -ffp-contract=off -c -march=armv8.2-a -I/usr/include/tirpc/
> LDFLAGS_LOCAL = -Wl,--build-id -ltirpc -L/workspace/public/software/libs/kml/1.6.0/lib -lkm_l9
> CPLUSPLUSLIB =
> ESMF_LDFLAG = $(CPLUSPLUSLIB)
> #FCOPTIM = -O3 -g -ffp-model=precise -faarch64-pow-alt-precision=21 -ffp-contract=off -faarch64-minmax-alt-precision -Hx,124,0xc00000 -finline-functions -ftree-vectorize -falign-functions -mllvm -min-prefetch-stride=2 -mrecip=vec-div:1 -fstack-arrays -L/workspace/home/shenchao/wubingcheng/xc/dependencies/lib/kml/1.7.0/bisheng_2.1.0/lib -lkm_l9
> FCOPTIM = -O0 -g -ffp-model=precise -faarch64-pow-alt-precision=21 -ffp-contract=off -faarch64-minmax-alt-precision -Hx,124,0xc00000 -finline-functions -ftree-vectorize -falign-functions -mllvm -min-prefetch-stride=2 -mrecip=vec-div:1 -fstack-arrays -L/workspace/public/software/libs/kml/1.6.0/lib -lkm_l9
> FCREDUCEDOPT = $(FCOPTIM)
> FCNOOPT = -O0 -g -ffp-model=precise -ffp-contract=off -frecursive -fopenmp -faarch64-pow-alt-precision=21 -faarch64-minmax-alt-precision -L/workspace/public/software/libs/kml/1.6.0/lib -lkm_l9
> FCDEBUG =
> FORMAT_FIXED = -ffixed-form
> FORMAT_FREE = -ffree-form
> FCSUFFIX =
> BYTESWAPIO = -fconvert=big-endian
> #FCBASEOPTS_NO_G = -O1 -g -ffp-model=precise -faarch64-pow-alt-precision=21 -ffp-contract=off -faarch64-minmax-alt-precision
> FCBASEOPTS_NO_G = -O0 -g -ffp-model=precise -faarch64-pow-alt-precision=21 -ffp-contract=off -faarch64-minmax-alt-precision
> FCBASEOPTS = $(FCBASEOPTS_NO_G) $(FORMAT_FREE) $(BYTESWAPIO)
> MODULE_SRCH_FLAG = -module $(WRF_SRC_ROOT_DIR)/main
> TRADFLAG = -traditional
> CPP = /lib/cpp -P -C -nostdinc #-I/workspace/home/shenchao/wubingcheng/xc/jxqxj/3.9.1/WRFDA-3.9.1/dump_hook
> AR = ar
> ARFLAGS = ru
> M4 = m4 -G
> RANLIB = ranlib
> RLFLAGS =
> CC_TOOLS = $(SCC)
>
> ###########################################################
- 执行以下命令,编写Makefile.patch。
vim Makefile.patch
126c126
< ( cd var/build; make depend; $(MAKE) $(J) all_wrfvar )
---
> ( cd var/build; make depend; $(MAKE) $(J) all_wrfvar V=1)
- 执行以下命令,编写postamble_new.patch。
vim postamble_new.patch
33c33
< FCFLAGS = $(FCOPTIM) $(FCBASEOPTS)
---
> FCFLAGS = $(FCBASEOPTS) $(FCOPTIM)
- 执行以下命令,使用patch修改源码。
patch arch/configure_new.defaults < configure_new.patch
patch arch/postamble_new < postamble_new.patch
patch compile < compile.patch
patch Makefile < Makefile.patch
patch configure < configure.patch
- 执行以下命令,生成配置文件。
echo 3 | ./configure wrfda
- 执行以下命令,进行编译安装编译过程无错误出现即安装成功。
./compile all_wrfvar 2>&1 | tee -a compile- all_wrfvar.log