按网站说明文档上用Subversion工具下载源代码安装
超算服务器提供已编译好的intel编译器、netcdf、impi和openmpi等库
module load 加载库时会自动加载它的依赖库和编译器,这样可以配套加载
比如加载netcdf会自动加载相应的编译器
upwelling application
编译
在 build_roms.bash中
export ROMS_APPLICATION=UPWELLING
export USE_NETCDF4=on # compile with NetCDF-4 library
加载的模块库如下:
(1) intel/15.0.6 2) hdf5/intel15/1.8.13 3) netcdf/intel15/4.3.3.1
串行编译成功
并行编译选择MPI软件测试结果
IMPI和MPICH都会报错,openmpi通过
Currently Loaded Modulefiles:
(1) hdf5/intel15/1.8.13 2) netcdf/intel15/4.3.3.1 3) intel/18.0.2 4) mpi/openmpi/3.1.2-icc18
export USE_MPI=on # distributed-memory parallelism export USE_MPIF90=on # compile with mpif90 script export which_MPI=openmpi # compile with OpenMPI library export FORT=ifort export USE_LARGE=on # activate 64-bit compilation export USE_NETCDF4=on # compile with NetCDF-4 library
以上设置并行编译成功,关键在于选择适合和相互匹配的软件和编译库
运行
设置环境变量同编译
运行脚本如下
module load netcdf/intel15/4.3.3.1 module load mpi/openmpi/3.1.2-icc18 module unload intel/15.0.6 cd /public4/home/pgv3234/roms/work/upwelling mpirun -np 4 ./romsM roms_upwelling.in >& log.my_upwelling
要注意的地方
- module load mpi/openmpi/3.01-pmix-icc18 #used for srun command
对应于srun的openmpi库,与编译不一致,所以此处用mpirun命令 - -np的cpu核数要等于NtileI * NtileJ具体参见roms_upwelling.in文件
- 注意在roms_upwelling.in中指定varinfo.dat的路径
四维变分系统IS4DVAR 编译和运行
与upwelling设置类似
主要不同在于ARPACK、MCT、PARPACK库的安装和设置
位于roms目录LIB/ARPACK下,按说明安装后,选择Armakes目录下的Armake.mpif90.linux.inc,更改设置后,覆盖/ARPACK下的armake.inc 分别执行命令make lib和make plib即可,生成的libarpack_mpif90_linux.a和libparpack_mpif90_linux.a注意去掉平台后缀,否则roms系统根据文件名无法识别。
arpack环境变量在roms/Compilers/my_build_paths.bash中指定,build.bash中use_my_lib改成yes
由于build.bash中的环境变量默认环境变量与本机系统不一致,注释掉不一致部分,在最后加上
export MCT_INCDIR=/public4/home/pgv3234/roms/Lib/MCT/include export MCT_LIBDIR=/public4/home/pgv3234/roms/Lib/MCT/lib export PARPACK_LIBDIR=/public4/home/pgv3234/roms/Lib/ARPACK export ARPACK_LIBDIR=/public4/home/pgv3234/roms/Lib/ARPACK
在build.bash前面加上module load 语句加载需要的软件库,执行编译即可
./buid.bash -j 4 >& log &
编译和运行自定义实例
ROMS实际个例需要的设置
- 制作网格点 roms 官网上推荐的是MATLAB的seagrid包,安装和使用过程中发现他们已经很久没有更新了,支持的版本都是matlab08、09,linux版需要图形界面,安装库比较老,屡屡失败。推荐使用一款GridBuilder的软件,是Austides公司开发的软件,相当于在seagrid的基础上的更新版,Windows下使用,一键自动安装,比较方便。下载地址如下:https://austides.com/downloads/,其中有较为详细的说明文档。
- 制作初始条件、气候态文件、边界条件和强迫条件
基本步骤
(1)myroms rutser
由WOA09温盐数据(即Levitus Climatology 根据人名命名)进行客观分析(Objective analysis),根据时空相关映射到roms格点上。
采用的是roms官网上发布的package中的oa工具,下载编译
安装注意:a. 将目录中的Makefile.Gnu重命名为Makefile
b. 更改g77编译器为gfortran
c. 设置netcdf的include路径,文件中是每个地方手动输入,注意搜索所有地方替换,还有没解决的将netcdf的include路径下的netcdf.inc复制到当前文件夹下
d. 设置netcdf的lib路径,gfortran编译会报错undefined函数之类的,解决方法加入 -L/netcdf_path/lib -lnetcdf -lnetcdff即可。(fortran调用netcdf的方法:gfortran -o test.exe -I/netcdf_path/include -L/netcdf_path/lib -lnetcdf -lnetcdff)
e.设置生成可执行文件路径,更改文件夹$home/bin 到自定义文件夹
解决上述问题后,编译成功。
(2)oa的重要作用是水平网格插值,其中需要数据格式转换,转成HDAT格式
其中hydro库编译的时候碰到的问题:
类似的几个文件编译都会报错的问题,主要在于程序比较老,gfortran编译不支持
put_ptem.F:175.14: & <nhvar>(1x,1pe8.2)) 1 Error: Unexpected element '<' in format string at (1) put_ptem.F:149.24: write(outhyd,900) nhvar, nhpts, castid, hlng, hlat, hdpth, 1 Error: FORMAT label 900 at (1) not defined
解决方法:更改格式语句
注释下面两行 c write(outhyd,900) nhvar, nhpts, castid, hlng, hlat, hdpth, c & htime, (hscle(n),n=1,nhvar) 改为 write(format_string,1000),nhvar 1000 format('(1x,i1,1x,i5,1x,i5,1x,f9.4,1x,f8.4,1x,f7.1,1x,f10.4,', & i2,'(1x,1pe8.2)') write(outhyd,format_string) nhvar, nhpts, castid, hlng, hlat, hdpth, & htime, (hscle(n),n=1,nhvar) 当然同时注释掉900格式,添加characer*80 format_string的声明
来源:51CTO
作者:DreamingSnail
链接:https://blog.csdn.net/Jasper_he/article/details/98729906