wrf & wps: compile - beijing normal universityglobalchange.bnu.edu.cn/atmos/ch06s3 - compile wrf...
Post on 29-Jun-2018
223 Views
Preview:
TRANSCRIPT
WRF&WPS:Compile
KellyWernerNCAR/MMMJanuary2017
1
InstallingSteps
• Checksystemrequirements• Installinglibraries• Downloadsourcedata• CompileWRFV3• CompileWPS• DownloadiniIal/BCdatasets
2
SystemRequirements
• OnwhatkindsofsystemswillWRFrun?– Generallyany32-or64-bithardware,runningaUNIX-likeoperaIngsystem
– Youmayalsousedual-booIngintoaUNIX-likeOS(e.g.,WindowswithLinuxbuiltparallel)
• Examplesofacceptablesystems:– Laptops,desktops,andclustersrunningLinux– LaptopsanddesktopsrunningMacOSX– ClustersrunningUnix-like:Linux,AIX
3
CheckSystemRequirements• Webpage:
h_p://www2.mmm.ucar.edu/wrf/OnLineTutorial/compilaIon_tutorial.php
4
CheckSystemRequirements• ItismandatorytohaveaFortran(e.g.,
gfortran)compiler,aCcompiler,andcpponyoursystem.Totestwhethertheseexistonyoursystem,type:– whichgfortran– whichcpp– whichgcc– Ifinstalled,youwillbegivenapathfor
each
• Fortrancompilershouldbeversion4.4.0,orlater
Checkthisbytyping(forcsh):gcc -–version • Testsavailableforcheckingthatyour
fortrancompilerisbuiltproperly,andthatitiscompaIblewiththeCcompiler.
5
AddiIonalNecessaryRequirements
• ScripInglanguages(tesIngavailableintestpackage): csh perl sh
• UNIXcommands:ar head sed awkhostname sleep cat lnsort cd ls tarcp make touch cutmkdir tr expr mvuname file nm wcgrep prine which gziprm
6
InstallingSteps
• Checksystemrequirements• Installinglibraries• Downloadsourcedata• CompileWRFV3• CompileWPS• DownloadiniIal/BCdatasets
7
InstallingLibraries
• NetCDF(neededbyWRFandWPS)– netCDFVersion3or4areacceptable
• OpIonallibrariesforGRIB2meteorologicaldatasupport– JasPer(JPEG2000“lossy”compressionlibrary)– PNG(“lossless”compressionlibrary)– Zlib(compressionlibraryusedbyPNG)
• OpIonalMPIlibrary(forbuildinginparallel):
– MPICH2
8
InstallingLibraries
• InstallaIonoftheselibraries(MPICH2,NetCDF,JasPer,zlib,andlibpng)isNOTpartoftheWPSandWRFinstallaIonscripts
• VERYIMPORTANT!– Makesuretheselibrariesareinstalledusingthesame
compilersaswillbeusedtoinstallWRFandWPS
• Downloadsforthelibraries,withinstallaIoninstrucIons,andlibrarycompaIbilitytestsarealsoincludedonthecompilaIonwebsite
9
InstallingLibraries:NetCDF
setenv DIR directory-where-your-tar-files-are setenv CC gcc setenv CXX g++
setenv FC gfortran setenv FCFLAGS –m64 # FCFLAGS may be needed on some systems setenv F77 gfortran
setenv FFLAGS –m64 # FFLAGS may be needed on some systems
tar xzvf netcdf-4.1.3.tar.gz # no ‘.gz’ if downloaded to most Macs cd netcdf-4.1.3
./configure –-prefix=$DIR/netcdf –-disable-dap --disable-netcdf-4 -– disable-shared make
make install setenv PATH $DIR/netcdf/bin:$PATH setenv NETCDF $DIR/netcdf cd ..
10
InstallingLibraries:MPICH2• Inprinciple,anyimplementaIonoftheMPI-2standardshould
workwithWRF;however,wehavethemostexperiencewithMPICH
• AssumingenvironmentvariablesfornetCDFinstallarealreadyset:
tar xzvf mpich-3.0.4.tar.gz # no ‘.gz’ if downloaded to most Macs cd mpich-3.0.4 ./configure –-prefix=$DIR/mpich
make make install setenv PATH $DIR/mpich/bin:$PATH cd ..
11
InstallingLibraries:zlib• AssumingenvironmentvariablesfromnetCDFinstallare
alreadyset:
tar xzvf zlib-1.2.7.tar.gz # no ‘.gz’ if downloaded to most Macs cd zlib-1.2.7 ./configure –-prefix=$DIR/zlib make
make install cd ..
12
InstallingLibraries:libpng• AssumingenvironmentvariablesfromnetCDFinstallare
alreadyset
tar xzvf libpng-1.2.50.tar.gz # no ‘.gz’ if downloaded to most Macs cd libpng-1.2.50 ./configure –-prefix=$DIR/libpng make
make install cd ..
13
InstallingLibraries:JasPer• AssumingenvironmentvariablesfromnetCDFinstallare
alreadyset
tar xzvf jasper-1.900.1.tar.gz # no ‘.gz’ if downloaded to most Macs cd jasper-1.900.1 ./configure –-prefix=$DIR/jasper make
make install cd ..
14
InstallingLibraries:CompaIbility
• MakesurelibrariesarecompaIblewithcompilers
• Test1– Fortran+C+netCDF
• Test2– Fortran+C+netCDF+MPI
15
InstallingSteps
• Checksystemrequirements• Installinglibraries• Downloadsourcedata• CompileWRFV3• CompileWPS• DownloadiniIal/BCdatasets
16
DownloadWRF&WPSCode• DownloadWRF&WPSsourcecodefrom:
h_p://www2.mmm.ucar.edu/wrf/users/download/get_source.html– Click‘NewUser,’registeranddownload,or– Click‘ReturningUser,’enteryouremail,anddownload
17
Step1:Clickhereforthelatest
releasedcode(recommended)
Step2:Clickontarfilesto
download
DownloadStaIcGeographicalData• FromtheWRFDownloadpage:
h_p://www2.mmm.ucar.edu/wrf/users/download/get_sources.html
18
Step1:Click‘WPS’box
Step2:Click‘here’togetgeographydata
DownloadStaIcGeographicalData• GeographicalInputandDataDownloadPage: h_p://www2.mmm.ucar.edu/wrf/users/download/get_sources_wps_geog.html
19
geog.tar.gz~15GBwhenuncompressed
Thisistheoneyouwant
InstallingSteps
• Checksystemrequirements• Installinglibraries• Downloadsourcedata• CompileWRFV3• CompileWPS• DownloadiniIal/BCdatasets
20
ChoosingaCompiler
21
Compiler CompileTime RunTime
GNU4.8.2**FREE**
12.63Mins 4.18Mins
Intel12.1.5 27.75Mins 3.88Mins
PGI13.3-0 24.86Mins 4.25Mins
*Compile:dmpar/nesIng,nolarge-filesupport
*Run:singledomain,smalldomain(74x61),6hours,16processors
Step1:ConfigureforWRFV3• InsidetheWRFV3/directory,type:./configure
checking for perl5... no checking for perl... found /usr/bin/perl (perl) Will use NETCDF in dir: /usr/local/netcdf PHDF5 not set in environment. Will configure WRF for use without. configure: WRF operating system set to "Linux" via environment variable $WRF_OS configure: WRF machine set to "i686" via environment variable $WRF_MACH $JASPERLIB or $JASPERINC not found in environment, configuring to build without grib2 I/
O... ------------------------------------------------------------------------ Please select from among the following supported platforms. 1. Linux i486 i586 i686, gfortran compiler with gcc (serial) 2. Linux i486 i586 i686, gfortran compiler with gcc (smpar) 3. Linux i486 i586 i686, gfortran compiler with gcc (dmpar) 4. Linux i486 i586 i686, gfortran compiler with gcc (dm+sm) 5. Linux i486 i586 i686, g95 compiler with gcc (serial) 6. Linux i486 i586 i686, g95 compiler with gcc (dmpar) 7. Linux i486 i586 i686, PGI compiler with gcc (serial) 8. Linux i486 i586 i686, PGI compiler with gcc (smpar) 9. Linux i486 i586 i686, PGI compiler with gcc (dmpar) 10. Linux i486 i586 i686, PGI compiler with gcc (dm+sm) 11. Linux x86_64 i486 i586 i686, ifort compiler with icc (serial) 12. Linux x86_64 i486 i586 i686, ifort compiler with icc (smpar) 13. Linux x86_64 i486 i586 i686, ifort compiler with icc (dmpar) 14. Linux x86_64 i486 i586 i686, ifort compiler with icc (dm+sm) Enter selection [1-16] :
Compile for nesting? (1=basic, 2=present moves, 3=vortex following) [default 1]:
• OutputfromconfiguraIon:afilecalled‘configure.wrf’
22
ConfigureOpIonsforWRFV3
DebuggingOp7ons
• ./configure –d – NoopImizaIon– Extradebugging
• ./configure –D – NoopImizaIon– ChecksuniniIalizedvariables,
floaIngpointtraps,etc.– Usefulforadding/updaIngnew
code
• ./configure –r8 – DoubleprecisionforIntel,GNU,and
PGI
LargeFileSupport• setenv WRFIO_NCD_LARGE_FILE_SUPPORT 1
->2GB- Beforeconfiguring- Built-insinceV3.9
23
ParallelCompileOpIonforWRFV3
• TobuildWRFinparallel– setenvJ“-j2”
24
#ofProcessors TimetoCompiler
1 22.8Mins
2 14.92Mins
3 9.33Mins
4 8.02Mins
5 7.23Mins
6 6.68Mins
*Around4processors,itreachesstateofequilibrium
*ThistestdonewithGNUcompiler
configure.wrfFile:UsefulTips
• NETCDFPATH:internallysetbybuildsystembasedon$NETCDF
• PNETCDF=Foruserswhohaveaccesstoparallelnetcdf,usetheenvironmentvariablePNETCDFidenIcallytohowNETCDFisset(pointtothePNETCDFtop-leveldirectory)
25
Step2:CompileWRFV3
• IntheWRFV3/directory,type:./compile em_case >& log.compile Whereem_caseisoneofthefollowing(type./compile toseeallopIons)em_real (3drealcase) em_hill2d_x em_quarter_ss em_squall2d_x em_b_wave em_squall2d_y em_les em_grav2d_x em_heldsuarez em_seabreeze2d_x em_tropical_cyclone em_convrad em_scm_xy (1dideal)
**CompilaIonshouldtake~30mins**
26
3dIdeal
2dIdeal
Importantincasetherearecompileproblems
SuccessfulCompilaIon• IfthecompilaIonissuccessful,youshouldfindtheseexecutables
inWRFV3/main (non-zerosize):
Realdatacase: wrf.exe - modelexecutable real.exe – realdatainiIalizaIon ndown.exe –one-waynesIng tc.exe –fortcbogusing(serialonly)
Idealcase:
wrf.exe–modelexecutable ideal.exe–idealcaseiniIalizaIon
*Note:Eachidealcasecompilecreatesadifferentexecutable,butwiththesamename
• Theseexecutablesarelinkedto2differentdirectories(WRFV3/runandWRFV3/test/em_real).YoucangotoeitherplacetorunWRF.
27
UnsuccessfulCompilaIon
• Useyour‘log.compile’filetosearchforerrors!– Searchfor‘Error’withacapital‘E’
• UseourFrequentlyAskedQuesIonswebpageforhelp– www2.mmm.ucar.edu/wrf/users/FAQ_files/FAQ_wrf_intallaIon.html
• Beforerecompiling:– issuea‘clean–a’– Reconfigure:Ifyouneedtomakechangestotheconfigure.wrffile,do
thisa{erissuing./configure,andthensavetheeditedfile.– Recompile
• Contactwr|elp@ucar.edu
28
InstallingSteps
• Checksystemrequirements• Installinglibraries• Downloadsourcedata• CompileWRFV3• CompileWPS• DownloadiniIal/BCdatasets
29
Step1:ConfigureforWPS
30
• InsidetheWPS/directory,type:./configure
• ChoosetocompileWPSserially,evenifyoucompileWRFV3inparallel(unlessyouhaveaverylargedomain)**NOTE:ifyoudocompileWPSinparallel,ungrib.exemustrunserially
• OutputfromconfiguraIon:afilecalled‘configure.wps’
Step2:CompileWPS
• IntheWPS/directory,type:./compile >& log.compile
• CompilaIonshouldonlytakeafewminutes
• Ifsuccessful,theseexecutablesshouldbeinyourWPS/directory(andtheyarelinked,respecIvely,fromtheirsourcecodedirectories):
geogrid.exe -> geogrid/src/geogrid.exe ungrib.exe -> ungrib/src/ungrib.exe metgrid.exe -> metgrid/src/metgrid.exe
31
UnsuccessfulWPSCompilaIon
32
Nogeogrid.exeormetgrid.exe
– WPSmakesuseoftheexternalI/OlibrariesintheWRFV3/external/directory-ThelibrariesarebuiltwhenWRFisinstalled
– Checkthatyouusedtheexactsamecompiler(andversion)asyouusedtocompileWRFV3
– CheckthatyouareusingthesamenetCDFthatyouusedtobuildWRFV3
– HaveyouchangedthenameorpathoftheWRFV3/directory?• Ifso,youneedtochangethefollowinglineintheconfigure.wpsfile:
WRF_DIR=../WRFV3• Savethefileandrecompile
UnsuccessfulWPSCompilaIon
33
Noungrib.exe
– Makesureyouhaveinstalledyourjasper,zlib,andlibpnglibrariescorrectly.
– Makesurethatyouareusingthecorrectpathandformatforthefollowinglinesintheconfigure.wpsfile
COMPRESSION_LIBS=-L/${DIR}/UNGRIB_LIBRARIES/lib–ljasper–lpng–lzCOMPRESSION_INC=-I/${DIR}/UNGRIB_LIBRARIES/include
Saveconfigure.wpsandrecompile
./clean-a
• The‘./clean–a’commandissomethingthatshouldbeusedwhenyouhavemadecorrecIonstoyourconfigure.wrffile,configure.wpsfile,oranychangestotheregistry.Ifyouhavemadeanyofthesechanges,orifyouplantorecompileyourcodefromscratch,youmustissuea‘clean–a’beforerecompiling.
• IfyoumadeanychangestoanysubrouIneswithinthecode,youwillneedtorecompileyourcode,butyoudoNOTneedtoissuethe‘clean–a’command,nordoyouneedtoreconfigure.Youwillsimplyjustrecompile.ThiscompilaIonshouldtakealotlessImethanacleancompile.
34
InstallingSteps
• Checksystemrequirements• Installinglibraries• Downloadsourcedata• CompileWRFV3• CompileWPS• DownloadiniNal/BCdatasets
35
DownloadDatasets• FromtheWRFUsers’page:h_p://www2.mmm.ucar.edu/wrf/users/
36
Step1:ClickDownload,thenscrolldownandclick‘InputDatafromNCAR’
Step2:Clickthedatasetyouwishtouse(forthisexample,wewilluse‘FNLfromGFS’)
*Note:TheNOMADSsitehasseveraltypesofusefuldata:h_p://nomads.ncdc.noaa.gov
DownloadDatasets(conInued)
37
Step3:Register,orsignin,ifyoualreadyhaveanaccount
Step5:Click‘WebFileLisIng’forthespanofyearsyouneed
Step4:Click‘DataAccess’
DownloadDatasets(conInued)
38
Step6:Click‘CompleteFileList’
Step7:Clicktheyearyouneed.A{erthis,Youwillclickthemonthyouneed(notshown)
DownloadDatasets(conInued)
39
Step8:ClickaboxforeachImespanthatyouneed
Step9:OnceyouhavechosenAllyourImes,clickonthe‘ViewSelectedFiles/GetAsaTarFile’bu_onTodownloadonetarfilewithallyourDates/Imes
QuesIons?
40
top related