# WRF Install [toc] ### Install Preferred software. ```= yum -y install gcc gcc-c++ csh wget time cmake unzip git libstdc++-devel libXScrnSaver m4 ``` ### Install Onempi ```= RUN wget https://download.open-mpi.org/release/open-mpi/v3.1/openmpi-3.1.4.tar.gz && \ tar xvf openmpi-3.1.4.tar.gz && \ cd openmpi-3.1.4 && \ ./configure --prefix=/openmpi && \ make && \ make install ENV PATH=$PATH:/openmpi/bin ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/openmpi/lib ``` ### Install Intel api ```= sudo -E yum autoremove intel-hpckit intel-basekit tee > /tmp/oneAPI.repo << EOF [oneAPI] name=Intel(R) oneAPI repository baseurl=https://yum.repos.intel.com/oneapi enabled=1 gpgcheck=1 repo_gpgcheck=1 gpgkey=https://yum.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB EOF sudo mv /tmp/oneAPI.repo /etc/yum.repos.d sudo yum -y install intel-basekit sudo yum -y update sudo yum -y install cmake pkgconfig sudo yum groupinstall "Development Tools" which cmake pkg-config make gcc g++ . /opt/intel/oneapi/setvars.sh // error : 沒有intel ``` ### Install Intel compiller. ```= wget http://registrationcenter-download.intel.com/akdlm/irc_nas/tec/16225/parallel_studio_xe_2020_cluster_edition.tgz tar -xvzf parallel_studio_xe_2020_cluster_edition.tgz cd parallel_studio_xe_2020_cluster_edition ./install.sh "Enter" "accept" "1" "1" "1" "serial number" "Enter" "1" "2" "2" "3" "1" --serial number : S477-X2SJRJVF ``` ```= -在.bash_profile中創建PATH變數 vim ~/.bash_profile ------------------- ### intel compiller source /opt/intel/bin/compilervars.sh intel64 ------------------- -測試Intel編譯器 source ~/.bash_profile ifort -v ``` ifort version 19.1.0.166 ### Install netcdf library. ```= -創建source code目錄 mkdir -p /Build_WRF/src cd /Build_WRF/src -下載source code wget ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-c-4.7.3.tar.gz wget ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-fortran-4.5.2.tar.gz -解壓縮source code並編譯 tar -xvzf netcdf-c-4.7.3.tar.gz cd netcdf-c-4.7.3 CC=icc CXX=icc FC=ifort CPP='icpc -E' CPPFLAGS='-fPIC' ./configure --prefix=/Build_WRF/LIBRARIES/netcdf --disable-netcdf4 --disable-shared --disable-dap make -j2 make install cd .. export LD_LIBRARY_PATH=/Build_WRF/LIBRARIES/netcdf/lib:$LD_LIBRARY_PATH tar -xzvf netcdf-fortran-4.5.2.tar.gz cd netcdf-fortran-4.5.2 CC=icc CXX=icc FC=ifort CPP='icpc -E' CPPFLAGS='-fPIC' CPPFLAGS='-I/Build_WRF/LIBRARIES/netcdf/include' LDFLAGS='-L/Build_WRF/LIBRARIES/netcdf/lib' ./configure --prefix=/Build_WRF/LIBRARIES/netcdf //CC=gcc CXX=gcc FC=gfortran CPP='gcc -E' make make install -在.bash_profile中創建PATH變數 vim ~/.bash_profile ------------------- ### netcdf export PATH=/Build_WRF/LIBRARIES/netcdf/bin:$PATH export NETCDF=/Build_WRF/LIBRARIES/netcdf -------------------- -更新PATH變數 source ~/.bash_profile ``` ### Install zlib and libpng library. ```= cd /Build_WRF/src -下載source code wget http://www.zlib.net/fossils/zlib-1.2.11.tar.gz -解壓縮source code並編譯 tar -xzvf zlib-1.2.11.tar.gz cd zlib-1.2.11 CC=icc CXX=icc FC=ifort CPP='icpc -E' ./configure --prefix=/Build_WRF/LIBRARIES/zlib make -j2 make install -下載source code cd .. wget ftp://ftp.simplesystems.org/pub/libpng/png/src/libpng16/libpng-1.6.37.tar.gz -解壓縮source code並編譯 tar -xzvf libpng-1.6.37.tar.gz cd libpng-1.6.37 CC=icc CXX=icc FC=ifort CPP='icpc -E' CPPFLAGS='-I/Build_WRF/LIBRARIES/zlib/include' LDFLAGS='-L/Build_WRF/LIBRARIES/zlib/lib' ./configure --prefix=/Build_WRF/LIBRARIES/libpng make -j2 make install -在.bash_profile中創建PATH變數 vim ~/.bash_profile ------------------- #### libpng export LD_LIBRARY_PATH=/Build_WRF/LIBRARIES/libpng/lib:$LD_LIBRARY_PATH ------------------- -更新PATH變數 source ~/.bash_profile ``` ### Install Jasper library. ```= cd /Build_WRF/src -下載source code wget http://www.ece.uvic.ca/~mdadams/jasper/software/jasper-1.900.1.zip -解壓縮source code並編譯 unzip jasper-1.900.1.zip cd jasper-1.900.1 ./configure --prefix=/Build_WRF/LIBRARIES/grib2 make -j2 make install -在.bash_profile中創建PATH變數 vim /.bash_profile ------------------- #### jasper export PATH=/Build_WRF/LIBRARIES/jasper/bin:$PATH export LD_LIBRARY_PATH=/Build_WRF/LIBRARIES/jasper/lib64:$LD_LIBRARY_PATH ------------------- -更新PATH變數 source ~/.bash_profile ``` ### Install WRF. ```= cd /Build_WRF/ git clone https://github.com/wrf-model/WRF WRF_ISC21 cd WRF_ISC21 git checkout tags/ISC21 -b ISC21-branch -環境設置 export NETCDF=$NETCDF_DIR export WRFIO_NCD_LARGE_FILE_SUPPORT=1 export NETCDF_classic=1 source ~/.bash_profile -設定 ./configure Enter selection [1-75] : 34 // gfortran/gcc ; 14 // Intel compiler Compile for nesting? (1=basic, 2=preset moves, 3=vortex following) [default 1]: 1 -修改configure.wrf sed -i '/^CFLAGS_LOCAL/s/.*/CFLAGS_LOCAL = -w -O3 -ip -DRSL0_ONLY/' configure.wrf -編譯 ./compile -j 2 em_real > build_wrf.log 2>&1 tail -15 build_wrf.log *出現: ========================================================================== build started: Mon Nov 23 09:21:56 MST 2020 build completed: Mon Nov 23 09:34:49 MST 2020 ---> Executables successfully built <--- -rwxr-xr-x 1 gill p66770001 47860624 Nov 23 09:34 main/ndown.exe -rwxr-xr-x 1 gill p66770001 47737640 Nov 23 09:34 main/real.exe -rwxr-xr-x 1 gill p66770001 47221968 Nov 23 09:34 main/tc.exe -rwxr-xr-x 1 gill p66770001 51798896 Nov 23 09:34 main/wrf.exe ========================================================================== 即成功 ``` ###### tags: `WRF`