一个文件解决配置环境,机器,编译器和编译cesm的case

[chengxl@login04 ~]$ cat  tiaoshicesm.sh 
#!/bin/bash
echo "ceam tiao shi "

cd ~/afwcesm
pwd

echo ""
echo "#1. module jia zai "
echo "#======================================================================================================================================================================="
cat >module_manager.sh<<eof 
module purge 
module avail
module list
PATH=""
#---------------------------------------------------#
#                                                   #
#                     module                        #
#                                                   #
#---------------------------------------------------#
#---------- /public/software/modules -----------
#intel
##module load mathlib/pio/intel/2.5.1
module load mpi/intelmpi/2017.4.239
module load mathlib/netcdf/intel/4.4.1
##module load apps/esmf/intelmpi/7.0.0
##apps/esmf/intelmpi/7.0.0
##benchmark/imb/intelmpi/2017
##mathlib/antlr/intel/2.7.7
##module load mathlib/hdf4/intel/4.2.13
##module load mathlib/grib_api/intel/1.19.0
module load mathlib/hdf5/intel/1.8.20
##module load mathlib/jpeg/intel/9a
module load mathlib/pnetcdf/intel/1.12.1
#GNU
#module load mathlib/hdf5/gnu/1.8.20
#module load mathlib/netcdf/gnu/4.4.1
#module load mathlib/pnetcdf/gnu/openmpi-4.0.4-gcc4.8.5-1.12.1
#mathlib/pnetcdf/gnu/hpcx-2.7.4-gcc7.3.1-1.12.1
#module load mpi/openmpi/gnu/4.0.4
#apps/m4/universal/1.4.18
#module load compiler/cmake/3.20.1
#module load mathlib/hdf4/gnu/4.2.13
#mathlib/pio/gnu/hpcx-2.7.4-gcc7.3.1-2.5.1
#module load mathlib/pio/gnu/openmpi-4.0.4-gcc4.8.5-2.5.1
##---------- /opt/hpc/software/modules ----------
#module load compiler/devtoolset/7.3.1
#module load mpi/hpcx/2.7.4/gcc-7.3.1
#module load mpi/openmpi/4.0.4/gcc-7.3.1
#intel 
module load compiler/intel/2017.5.239
#module load mpi/hpcx/2.7.4/intel-2017.5.239
eof

chmod 775 module_manager.sh
./module_manager.sh

echo ""
echo "#2. manage PATH" 
echo"#======================================================================================================================================================================="




echo ""
echo "#3. config machine"
echo "#======================================================================================================================================================================="

#~/.cime/config_machines.xml #xml diyi hang bu neng kong hang  
cat > ~/.cime/config_machines.xml.eof << eof
<?xml version="1.0"?>
<config_machines version="2.0">
    <machine MACH="afw">
    <DESC>module afw</DESC>
    <NODENAME_REGEX>a3311n12</NODENAME_REGEX>
    <OS>LINUX</OS>
    <PROXY> https://howto.get.out </PROXY>
    <COMPILERS>intel</COMPILERS>
    <MPILIBS>intelmpi</MPILIBS>
    <PROJECT>none</PROJECT>
    <SAVE_TIMING_DIR>/data/chengxl/cesm/timing</SAVE_TIMING_DIR>
    <CIME_OUTPUT_ROOT>/data/chengxl/cesm/cimeoutput</CIME_OUTPUT_ROOT>
    <DIN_LOC_ROOT>/data/chengxl/cesm/data_input</DIN_LOC_ROOT>
    <DIN_LOC_ROOT_CLMFORC>/data/chengxl/cesm/data_input_clmforc</DIN_LOC_ROOT_CLMFORC>
    <DOUT_S_ROOT>/data/chengxl/cesm/archive/dout_s_root</DOUT_S_ROOT>
    <BASELINE_ROOT>/data/chengxl/cesm/cesm_baselines</BASELINE_ROOT>
    <CCSM_CPRNC>/data/chengxl/cesm/tools/cime/tools/cprnc</CCSM_CPRNC>
    <GMAKE>make</GMAKE>
    <GMAKE_J>8</GMAKE_J>
    <BATCH_SYSTEM>none</BATCH_SYSTEM>
    <SUPPORTED_BY>myb</SUPPORTED_BY>
    <MAX_TASKS_PER_NODE>64</MAX_TASKS_PER_NODE>
    <MAX_MPITASKS_PER_NODE>64</MAX_MPITASKS_PER_NODE>
    <PROJECT_REQUIRED>FALSE</PROJECT_REQUIRED>
    <mpirun mpilib="default">
      <executable>mpirun</executable>
      <arguments>
	<arg name="ntasks"> -np {{ total_tasks }} </arg>
      </arguments>
    </mpirun>
    <module_system type="module" allow_error="true">
      <init_path lang="perl">/usr/share/Modules/init/perl.pm</init_path>
      <init_path lang="python">/usr/share/Modules/init/python.py</init_path>
      <init_path lang="csh">/usr/share/Modules/init/csh</init_path>
      <init_path lang="sh">/usr/share/Modules/init/sh</init_path>
      <cmd_path lang="perl">/usr/bin/modulecmd perl</cmd_path>
      <cmd_path lang="python">/usr/bin/modulecmd python</cmd_path>
      <cmd_path lang="sh">module</cmd_path>
      <cmd_path lang="csh">module</cmd_path>
    </module_system>
    <environment_variables>
      <env name="OMP_STACKSIZE">256M</env>
    </environment_variables>
    <resource_limits>
      <resource name="RLIMIT_STACK">-1</resource>
    </resource_limits>
    </machine>
</config_machines>
eof
#beifen yuanlai wenjian dao jilu li
cat ~/.cime/config_machines.xml >>~/.cime/config_machines.xml.jilu
#ti huan xin de wenjian 
mv ~/.cime/config_machines.xml.eof ~/.cime/config_machines.xml 

echo ""
echo "#4.confgiure compilers"
echo "#======================================================================================================================================================================"

cat > ~/.cime/config_compilers.xml.eof<<eof
<?xml version="1.0"?>
<config_compilers version="2.0">
<!-- customize these fields as appropriate for yoursystem. Examples are prodived for Mac OS X systems withhomebrew and macports. -->
<compiler MACH="afw" COMPILER="intel">
<CFLAGS>
<base> -qno-opt-dynamic-align -fp-model precise -std=gnu99 </base>
<append compile_threaded="true"> -qopenmp </append>
<append DEBUG="FALSE"> -O2 -debug minimal </append>
<append DEBUG="TRUE"> -O0 -g </append>
</CFLAGS>
<CPPDEFS>
<!-- http://software.intel.com/en-us/articles/intel-composer-xe/ -->
<append> -DFORTRANUNDERSCORE -DCPRINTEL</append>
</CPPDEFS>
<CXX_LDFLAGS>
<base> -cxxlib </base>
</CXX_LDFLAGS>
<CXX_LINKER>FORTRAN</CXX_LINKER>
<FC_AUTO_R8>
<base> -r8 </base>
</FC_AUTO_R8>
<FFLAGS>
<base> -qno-opt-dynamic-align -convert big_endian -assume byterecl -ftz -traceback -assume realloc_lhs -fp-model source </base>
<append compile_threaded="true"> -qopenmp </append>
<append DEBUG="TRUE"> -O0 -g -check uninit -check bounds -check pointers -fpe0 -check noarg_temp_created </append>
<append DEBUG="FALSE"> -O2 -debug minimal </append>
</FFLAGS>
<FFLAGS_NOOPT>
<base> -O0 </base>
<append compile_threaded="true"> -qopenmp </append>
</FFLAGS_NOOPT>
<FIXEDFLAGS>
<base> -fixed </base>
</FIXEDFLAGS>
<FREEFLAGS>
<base> -free </base>
</FREEFLAGS>
<LDFLAGS>
<append compile_threaded="true"> -qopenmp </append>
</LDFLAGS>
<MPICC> mpiicc </MPICC>
<MPICXX> mpiicpc </MPICXX>
<MPIFC> mpiifort </MPIFC>
<SCC> icc </SCC>
<SCXX> icpc </SCXX>
<SFC> ifort </SFC>
<MPI_PATH>/public/software/mpi/intelmpi/2017.4.239/intel64</MPI_PATH>
<SLIBS>
<base>-L/opt/hpc/software/mathlib/netcdf/4.4.1/intel/lib -lnetcdf -lnetcdff -L/public/home/chengxl/lib -llapack -L/public/home/chengxl/lib -lblas -mkl</base>
<append MPILIB="mpich"> -mkl=cluster </append>
<append MPILIB="mpich2"> -mkl=cluster </append>
<append MPILIB="mvapich"> -mkl=cluster </append>
<append MPILIB="mvapich2"> -mkl=cluster </append>
<append MPILIB="mpt"> -mkl=cluster </append>
<append MPILIB="openmpi"> -mkl=cluster </append>
<append MPILIB="impi"> -mkl=cluster </append>
<append MPILIB="mpi-serial"> -mkl </append>
</SLIBS>
<SUPPORTS_CXX>TRUE</SUPPORTS_CXX>
<LAPACK_LIBDIR>/usr/lib64</LAPACK_LIBDIR>
</compiler>
</config_compilers>
eof

cat ~/.cime/config_compilers.xml >>~/.cime/config_compilers.xml.jilu
mv ~/.cime/config_compilers.xml.eof  ~/.cime/config_compilers.xml


echo ""
echo "#5. ./create_newcase "
echo "#======================================================================================================================================================================"
cd ~/cesm/cime/scripts
CASENAME="FHIST_SH"
rm -r ~/cesm/cases/${CASENAME}
rm -r /data/chengxl/cesm/cimeoutput/${CASENAME}/bld
rm -r /data/chengxl/cesm/cimeoutput/${CASENAME}/run
./create_newcase --case ~/cesm/cases/FHIST_SH --res f19_f19 --compset FHIST --run-unsupported --compiler intel  --mach afw 
cd ~/cesm/cases/${CASENAME}
pwd
echo ""
echo "#6. ./case.setup"
echo "#======================================================================================================================================================================"
./case.setup 


echo ""
echo "#7. ./case.build"
echo "#======================================================================================================================================================================"
./case.build


[chengxl@login04 ~]$ ./tiaoshicesm.sh 
ceam tiao shi 
/public/home/chengxl/afwcesm

#1. module jia zai 
#=======================================================================================================================================================================

----------------------------------- /public/software/modules ------------------------------------
apps/anaconda3/5.3.0
apps/esmf/intelmpi/7.0.0
apps/m4/universal/1.4.18
apps/ncl_ncarg/6.3.0
apps/ncl_ncarg/6.6.2
apps/nco/gnu/4.8.1
apps/nco/intel/4.8.1
apps/ncview/gnu/2.1.7
apps/ncview/intel/2.1.7
apps/PyTorch/1.7.mmcv/pytorch-1.7-mmcv1.3.8-rocm-4.0.1
apps/singularity/3.8.0
apps/TensorFlow/tf1.15.3-rocm4.0.1/hpcx-2.7.4-gcc-7.3.1
apps/TensorFlow/tf2.5.0-rocm4.0.1/hpcx-2.7.4-gcc-7.3.1
benchmark/imb/intelmpi/2017
compiler/cmake/3.20.1
compiler/rocm/4.0
mathlib/antlr/gnu/2.7.7
mathlib/antlr/intel/2.7.7
mathlib/cdo/intel/1.10.19
mathlib/grib_api/intel/1.19.0
mathlib/hdf4/gnu/4.2.13
mathlib/hdf4/intel/4.2.13
mathlib/hdf5/gnu/1.8.20
mathlib/hdf5/intel/1.8.20
mathlib/jasper/gnu/1.900.1
mathlib/jasper/intel/1.900.1
mathlib/jpeg/gnu/9a
mathlib/jpeg/intel/9a
mathlib/libpng/gnu/1.2.12
mathlib/libpng/intel/1.2.12
mathlib/netcdf/gnu/4.4.1
mathlib/netcdf/intel/4.4.1
mathlib/pio/gnu/hpcx-2.7.4-gcc7.3.1-2.5.1
mathlib/pio/gnu/openmpi-4.0.4-gcc4.8.5-2.5.1
mathlib/pio/intel/2.5.1
mathlib/pnetcdf/gnu/hpcx-2.7.4-gcc7.3.1-1.12.1
mathlib/pnetcdf/gnu/openmpi-4.0.4-gcc4.8.5-1.12.1
mathlib/pnetcdf/intel/1.12.1
mathlib/szip/gnu/2.1.1
mathlib/szip/intel/2.1.1
mathlib/udunits/gnu/2.2.28
mathlib/udunits/intel/2.2.28
mathlib/wgrib2/2.0.8
mathlib/zlib/gnu/1.2.11
mathlib/zlib/intel/1.2.11
mpi/intelmpi/2017.4.239
mpi/openmpi/gnu/4.0.4

----------------------------------- /opt/hpc/software/modules -----------------------------------
compiler/devtoolset/7.3.1       compiler/rocm/3.3               mpi/hpcx/2.7.4/intel-2017.5.239
compiler/intel/2017.5.239       mpi/hpcx/2.7.4/gcc-7.3.1        mpi/openmpi/4.0.4/gcc-7.3.1
No Modulefiles Currently Loaded.

#2. manage PATH
./tiaoshicesm.sh: line 59: echo#=======================================================================================================================================================================: command not found

#3. config machine
#=======================================================================================================================================================================

#4.confgiure compilers
#======================================================================================================================================================================

#5. ./create_newcase 
#======================================================================================================================================================================
Compset longname is HIST_CAM60_CLM50%SP_CICE%PRES_DOCN%DOM_MOSART_CISM2%NOEVOLVE_SWAV
Compset specification file is /public/home/chengxl/cesm/cime/../components/cam//cime_config/config_compsets.xml
Compset forcing is Historic transient 
ATM component is CAM cam6 physics:
LND component is clm5.0:Satellite phenology:
ICE component is Sea ICE (cice) model version 5 :prescribed cice
OCN component is DOCN   prescribed ocean mode
ROF component is MOSART: MOdel for Scale Adaptive River Transport
GLC component is cism2 (default, higher-order, can run in parallel):cism ice evolution turned off (this is the standard configuration unless you're explicitly interested in ice evolution):
WAV component is Stub wave component
ESP component is 
Pes     specification file is /public/home/chengxl/cesm/cime/../components/cam//cime_config/config_pes.xml
Compset specific settings: name is RUN_STARTDATE and value is 1950-01-01
Compset specific settings: name is SSTICE_DATA_FILENAME and value is $DIN_LOC_ROOT/atm/cam/sst/sst_HadOIBl_bc_1.9x2.5_1850_2017_c180507.nc
Compset specific settings: name is SSTICE_GRID_FILENAME and value is $DIN_LOC_ROOT/atm/cam/ocnfrac/domain.camocn.1.9x2.5_gx1v6_090403.nc 
Compset specific settings: name is SSTICE_YEAR_END and value is 2016
Could not find machine match for 'login04' or 'login04'
Machine is afw
Pes setting: grid match    is a%1.9x2.5 
Pes setting: grid          is a%1.9x2.5_l%1.9x2.5_oi%1.9x2.5_r%r05_g%gland4_w%null_m%gx1v6 
Pes setting: compset       is HIST_CAM60_CLM50%SP_CICE%PRES_DOCN%DOM_MOSART_CISM2%NOEVOLVE_SWAV 
Pes setting: tasks       is {'NTASKS_ATM': -2, 'NTASKS_ICE': -2, 'NTASKS_CPL': -2, 'NTASKS_LND': -2, 'NTASKS_WAV': -2, 'NTASKS_ROF': -2, 'NTASKS_OCN': -2, 'NTASKS_GLC': -2} 
Pes setting: threads     is {'NTHRDS_ICE': 1, 'NTHRDS_ATM': 1, 'NTHRDS_ROF': 1, 'NTHRDS_LND': 1, 'NTHRDS_WAV': 1, 'NTHRDS_OCN': 1, 'NTHRDS_CPL': 1, 'NTHRDS_GLC': 1} 
Pes setting: rootpe      is {'ROOTPE_OCN': 0, 'ROOTPE_LND': 0, 'ROOTPE_ATM': 0, 'ROOTPE_ICE': 0, 'ROOTPE_WAV': 0, 'ROOTPE_CPL': 0, 'ROOTPE_ROF': 0, 'ROOTPE_GLC': 0} 
Pes setting: pstrid      is {} 
Pes other settings: {}
Pes comments: none
 Compset is: HIST_CAM60_CLM50%SP_CICE%PRES_DOCN%DOM_MOSART_CISM2%NOEVOLVE_SWAV 
 Grid is: a%1.9x2.5_l%1.9x2.5_oi%1.9x2.5_r%r05_g%gland4_w%null_m%gx1v6 
 Components in compset are: ['cam', 'clm', 'cice', 'docn', 'mosart', 'cism', 'swav', 'sesp', 'drv', 'dart'] 
Using project from config_machines.xml: none
No charge_account info available, using value from PROJECT
Using project from config_machines.xml: none
cesm model version found: cesm2.1.3-rc.01
Batch_system_type is none
 Creating Case directory /public/home/chengxl/cesm/cases/FHIST_SH
/public/home/chengxl/cesm/cases/FHIST_SH

#6. ./case.setup
#======================================================================================================================================================================
Setting resource.RLIMIT_STACK to -1 from (-1, -1)
/public/home/chengxl/cesm/cases/FHIST_SH/env_mach_specific.xml already exists, delete to replace
Creating batch scripts
Writing case.run script from input template /public/home/chengxl/cesm/cime/config/cesm/machines/template.case.run
Creating file .case.run
Writing case.st_archive script from input template /public/home/chengxl/cesm/cime/config/cesm/machines/template.st_archive
Creating file case.st_archive
Creating user_nl_xxx files for components and cpl
If an old case build already exists, might want to run 'case.build --clean' before building
You can now run './preview_run' to get more info on how your case will be run

#7. ./case.build
#======================================================================================================================================================================
Building case in directory /public/home/chengxl/cesm/cases/FHIST_SH
sharedlib_only is False
model_only is False
Setting resource.RLIMIT_STACK to -1 from (-1, -1)
Generating component namelists as part of build
Creating component namelists
   Calling /public/home/chengxl/cesm/components/cam//cime_config/buildnml
     ...calling cam buildcpp to set build time options
CAM namelist copy: file1 /public/home/chengxl/cesm/cases/FHIST_SH/Buildconf/camconf/atm_in file2 /data/chengxl/cesm/cimeoutput/FHIST_SH/run/atm_in 
   Calling /public/home/chengxl/cesm/components/clm//cime_config/buildnml
   Calling /public/home/chengxl/cesm/components/cice//cime_config/buildnml
     ...buildnml calling cice buildcpp to set build time options
   Calling /public/home/chengxl/cesm/cime/src/components/data_comps/docn/cime_config/buildnml
   Calling /public/home/chengxl/cesm/components/mosart//cime_config/buildnml
   Running /public/home/chengxl/cesm/components/cism//cime_config/buildnml 
   Calling /public/home/chengxl/cesm/cime/src/components/stub_comps/swav/cime_config/buildnml
   Calling /public/home/chengxl/cesm/cime/src/components/stub_comps/sesp/cime_config/buildnml
   Calling /public/home/chengxl/cesm/cime/src/drivers/mct/cime_config/buildnml
   NOTE: ignoring setting of rof2ocn_liq_rmapname=idmap in seq_maps.rc
   NOTE: ignoring setting of rof2ocn_ice_rmapname=idmap in seq_maps.rc
Finished creating component namelists
Building gptl with output to file /data/chengxl/cesm/cimeoutput/FHIST_SH/bld/gptl.bldlog.220106-181847
   Calling /public/home/chengxl/cesm/cime/src/build_scripts/buildlib.gptl
Building mct with output to file /data/chengxl/cesm/cimeoutput/FHIST_SH/bld/mct.bldlog.220106-181847
   Calling /public/home/chengxl/cesm/cime/src/build_scripts/buildlib.mct
Building pio with output to file /data/chengxl/cesm/cimeoutput/FHIST_SH/bld/pio.bldlog.220106-181847
   Calling /public/home/chengxl/cesm/cime/src/build_scripts/buildlib.pio
Component pio build complete with 5 warnings
Building csm_share with output to file /data/chengxl/cesm/cimeoutput/FHIST_SH/bld/csm_share.bldlog.220106-181847
   Calling /public/home/chengxl/cesm/cime/src/build_scripts/buildlib.csm_share
Component csm_share build complete with 20 warnings
         - Building clm4_5/clm5_0 Library 
Building lnd with output to /data/chengxl/cesm/cimeoutput/FHIST_SH/bld/lnd.bldlog.220106-181847
Component lnd build complete with 6 warnings
clm built in 178.169849 seconds
Building atm with output to /data/chengxl/cesm/cimeoutput/FHIST_SH/bld/atm.bldlog.220106-181847
Building ice with output to /data/chengxl/cesm/cimeoutput/FHIST_SH/bld/ice.bldlog.220106-181847
Building ocn with output to /data/chengxl/cesm/cimeoutput/FHIST_SH/bld/ocn.bldlog.220106-181847
Building rof with output to /data/chengxl/cesm/cimeoutput/FHIST_SH/bld/rof.bldlog.220106-181847
Building glc with output to /data/chengxl/cesm/cimeoutput/FHIST_SH/bld/glc.bldlog.220106-181847
Building wav with output to /data/chengxl/cesm/cimeoutput/FHIST_SH/bld/wav.bldlog.220106-181847
Building esp with output to /data/chengxl/cesm/cimeoutput/FHIST_SH/bld/esp.bldlog.220106-181847
sesp built in 6.254085 seconds
swav built in 6.335024 seconds
docn built in 8.329176 seconds
mosart built in 25.407556 seconds
Component atm build complete with 14 warnings
cam built in 151.311374 seconds
Component ice build complete with 1 warnings
cice built in 206.612419 seconds
Component glc build complete with 3 warnings
cism built in 214.575208 seconds
Building cesm with output to /data/chengxl/cesm/cimeoutput/FHIST_SH/bld/cesm.bldlog.220106-181847 
Time spent not building: 8.183669 sec
Time spent building: 583.526662 sec
MODEL BUILD HAS FINISHED SUCCESSFULLY

 

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值