打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
ifort 编译wrf及netcdf的编译方法
glamor 发表于: 2009-11-10 09:50 来源: MNMUC空间
参考资料;
1.(aioply 编辑整理)
2.intel官方论坛对编译netcdf和wrf的说明
此次编译不涉及mpich
4.2       WRF编译
4.2.1       注意事项
1、编译wrf,需要用到netcdf的库,需要指定环境变量(定义NETCDF库的位置),也可以把netcdf变量写到用户的bashrc文件中,也可以在shell中定义注意NETCDF的大小写
bash下:export NETCDF=/home/aqs/NETCDF
2、编译WRF所用到得编译器要和编译NETCDF库的编译器一致,比如都用到intel的intel64的编译器ifort和icc。
3、此验证的是串行编译和SMP方式编译,MPI方式编译暂未验证。
4、用intel 编译器编译WRF必须更改一个文件。
Problem: If you encounter a compile problem with tc_em.F (e.g. whenusing ifort), it might be due to duplicate declaration of variablesitmp and icnt. Note also this does not affect compiling otherexecutables. Also note that tc.exe needs to be compiled serially.If you use this program, compile it separately from other WRFprograms.Solution: Edit main/tc_em.F, and remove one set ofdeclaration of these variables.
5、用其他编译器遇到的问题看参考WRF FIX
http://www.mmm.ucar.edu/wrf/users/wrfv3.1/known-prob-3.1.html
4.2.2       前期配置检查
1、 配置intel编译环境 参考2.2
2、 如果使用intelMPI,则需要 设置环境变量,使用 “source mpivars.sh”If using Intel®MPI, set up the environment with "source mpivars.sh" from the MPIbin directory (bin64 directory for Intel 64).
3、配置netcdf,exportNETCDF=/home/aqs/NETCDF
4.2.3       编译WRF
1、指定netcdf的目录 export NETCDF=/home/yang/wrf/NETCDF
       Untar the WRF download and configure and buildWRF according to the README file:
       Run ./configure for WRF and select an optionthat includes ifort.
2、运行命令./configure 选择合适的编译参数,还需要在修改configure.wrf
       Modify the configure.wrf file as necessary. Werecommend
       实际上不修改configure.wrf,同样可以编译成功
3、修改configure.wrf 文件 在此根据CPU优化编译参数
       Replace " -mp" by " -fp-model precise"
       对于FCOPTIM选项
       对于安腾处理器  ForIntel Itanium-based processors running Linux, set
FCOPTIM = -O3 –fno-alias -ip
       For Intel® 64 or IA-32 processors running Linuxor Mac OS X, set:
FCOPTIM = -O3 –xT –fno-alias -ip for Intel® Core® 2 Duoprocessors
FCOPTIM = -O3 –xP –fno-alias -ip for any Intel® processor with atleast SSE3 support
For the 11.x compiler, -xssse3 is equivalent to -xT and -xsse3 isequivalent to –xP,并支持SSE4.x编译参数
       For Intel® 64 or IA-32 processors running Linux,set:
FCOPTIM = -O3 –xW –fno-alias -ip for any processor with at leastSSE2 support. For the 11.0 compiler, -msse2 is equivalent to –xWand is the default setting for Intel® 64 or IA-32 processorsrunning Linux.
       If ARCHFLAGS contains the definition–DIFORT_KLUDGE, remove it.
       Ensure that the base options include –convertbig-endian and –align all
       Verify NETCDFPATH 更改netcdf路径
        Verify pathfor MPI if used.
       Make any additional changes indicated in the"known issues" section.
With these, it should be possible to build all source files withfull optimization. However, if desired, certain files, such asmodule_dm, may be built with FCBASEOPTS and OMP but withoutFCOPTIM, in order to reduce compilation time and memoryrequirement.
4、建立 WRF程序
./compile em_real >& log
查看run目录下,各可执行文件的生成情况
编译不成功,查找错误,重新编译前需要./clean –a。
注:里面有个程序,clean不能完全清楚,需要手动删除。
intel 编译NetCDF(2009-06-03 00:24:05)标签:intel netcdf杂谈  分类:气象模式
Performance Tools for Software Developers - Building NetCDF* withthe Intel® Compilers
Introduction
This guide is intended to help Intel® Fortran Compiler customersbuild the NetCDF software libraries on Intel® architecture systemsrunning Linux* or Mac OS*. This guide will also cover use of theIntel® C++ Compiler, although it is not required to buildNetCDF.
NetCDF (Network Common Data Form) is a machine-independent,self-describing, binary data format standard for exchangingscientific data. Information about NetCDF can be obtained from theUniversity Corporation for Atmospheric Research (UCAR),website: http://www.unidata.ucar.edu/software/netcdf/ †
Version information
This application note was created to help users of NetCDF 3.6.2build the libraries with the latest versions of Intel FortranCompilers, specifically, version 10.0. This application note willalso cover use of the Intel C++ Compiler version 10.0.
Obtaining the source code
The source code download is under NetCDF-3.6.2 C/C++/Fortran SourceCode and Documentation from this URL: http://www.unidata.ucar.edu/down... cdf-3_6_2/index.jsp† . For example, select "netcdf.tar.gz -netCDF-3.6.2 as a gzipped tar file" to download.
Obtaining the latest version of Intel® compilers
Intel® Compilers for Linux*
http://www.intel.com/cd/software ...ompilers/284264.htm
Intel® Compilers for Mac OS*
http://www.intel.com/cd/software ...ompilers/270528.htm
Prerequisites
The Intel Fortran Compiler and the Intel C++ Compiler are requiredto build the NetCDF libraries.
Hardware: The steps in this guide have been tested on Intel® Core™2Duo processors Software: This guide applies to version 10.0 of theIntel Compilers.
Configuration and set-up information
The Intel Fortran and C++ Compilers should be in your $PATHenvironment variable. Also, your $LD_LIBRARY_PATH environmentvariable should include the directory for the libraries providedwith the Intel Compilers. Using the bash shell, this can be done bysourcing the ifortvars.sh and iccvars.sh files in the compiler bin/directory. For example:
$ source /opt/intel/cce/10.0.xxx/bin/iccvars.sh
$ source /opt/intel/fce/10.0.xxx/bin/ifortvars.sh
After downloading the NetCDF tar file, extract the NetCDF sourcecode in a work directory.
$ cd
$ tar -xvzf netcdf-3.6.2.tar.gz
Below are the steps needed to build NetCDF on Linux. If you wish tobuild for Mac OS X, skip ahead by clicking on this link to buildingNetCDF on Mac OS*.
Building NetCDF on Linux*
The NetCDF build process starts with a configuration step. Theconfiguration script uses environment variables to select thecompilers and compiler options to use when buildingNetCDF.
Set environment variables
To build for Linux with the Intel Fortran Compiler and Intel C++Compiler, export the following environmentvariables:
$ export CC=icc
$ export CXX=icpc
$ export CFLAGS='-O3 -xT -ip -no-prec-div -static'
$ export CXXFLAGS='-O3 -xT -ip -no-prec-div -static'
$ export F77=ifort
$ export FC=ifort
$ export F90=ifort
$ export FFLAGS='-O3 -xT -ip -no-prec-div -static'
$ export CPP='icc -E'
$ export CXXCPP='icpc -E'
Note that the -xT compiler option will generate code using SSE3instructions that are not available on processors older than IntelCore™ 2 Duo processors. If you will be using the lib raries onsystems with older Intel® processors, you will want to use the –xP,-xN, or –xW options. Consult the online compiler documentationinstalled with the compiler for details about theseoptions.
Run configuration utility
After the environment variables are exported, perform theconfiguration step by changing your directory to the NetCDF sourcedirectory and running the configuration script
$ cd netcdf-3.6.2
$ ./configure
The configuration script will set up the Makefiles that will beused to build the NetCDF libraries and utilities. It will also setup the installation directory for the default location of/usr/local. If you would like to install the libraries in anotherlocation, use this configure command:
$ ./configure --prefix=/your/desired/install/directory
Make the libraries
When the configuration step completes successfully, you can buildthe libraries using ‘make’.
$ make
如果make以确定成功,则不再需要make check。
Testing NetCDF on Linux*
You can test your NetCDF libraries using ‘make check’.
$ make check
Installing NetCDF on Linux*
Install NetCDF libraries using ‘make install’.
$ make install
This will install the NetCDF libraries, include files, andutilities in the default location of /usr/local or the locationspecified in the configuration step with the --prefix=option.
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
WRF中OBSGRID的安装
交叉编译
这所中国高校,世界第一!
在Linux下搭建Fortran开发环境
fortran程序makefile
Ubuntu 12.04单机安装并行高富帅版LAMMPS (DRAFT) - 止水的日志 - 网易博客
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服