Changeset 1305


Ignore:
Timestamp:
03/22/16 17:24:25 (8 years ago)
Author:
aclsce
Message:

First implementation of Intel MPI environment for ADA-IDRIS machine (not fully validated, desactivated by default).

  • insÃ_job : choice of MPI Enironment to use by answering a question or -m option (./ins_job -m Intel). Default is IBM Environment.
  • libIGCM_sys_ada.ksh : added specific part for Intel Environment
    • mpirun command (instead of poe for IBM MPI)
    • build of new configuration "run_file"
    • specific header of the Job script -...
Location:
trunk/libIGCM
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/libIGCM/ins_job

    r1303 r1305  
    2727  or on curie/TGCC : 
    2828  ${b_n} [-h] [-v] [-e] [-p project] [-c number of cores] 
    29  
     29  or on ada /IDRIS 
     30  ${b_n} [-h] [-v] [-e] [-m MPI environment] 
    3031Options : 
    3132  -h                  : help 
     
    3536  -p project          : add default project on curie 
    3637  -c number of cores  : add default number of cores for postprocessing on curie 1-16 or 1-128 
     38on ada only : 
     39  - m MPI environment : add default MPI environment (Intel MPI or IBM MPI) 
    3740" 
    3841} 
     
    7477x_e=false; 
    7578x_p=false; 
    76 x_q=false; 
    7779x_c=false; 
    78 while getopts :hvec:p:q: V ; do 
     80x_m=false; 
     81while getopts :hvec:p:m: V ; do 
    7982  case $V in 
    8083  (h)  ins_job_Usage; exit 0;; 
     
    8588  (c)  x_c=true 
    8689       ProjectCore=${OPTARG} ;; 
     90  (m)  x_m=true 
     91       MPIEnvironment=${OPTARG} ;; 
    8792  (:)  echo ${b_n}" : -"${OPTARG}" option : missing value" 1>&2; 
    8893       exit 2;; 
     
    190195  echo ProjectCore is ${ProjectCore} 
    191196  #- ProjectCore is set (option or answer) 
     197# let check minimum/maximum value 1/${ProjectCoreMax} 
     198 
     199elif [ X"${SYSTEM}" == "Xada" ] ; then 
     200    if ( ! ${x_m} ) ; then 
     201        MPIEnvironment=IBM  
     202# 
     203# Commented : waiting for full validation of Intel MPI Environment 
     204#       answerOK=false           
     205#       while ( ! ${answerOK} ) ; do 
     206#           answer="" 
     207#           print - "Hit Enter or give MPI Environement (default is ${MPIEnvironment}), possible MPI environments are IBM (MPI IBM) and Intel (MPI Intel) :" 
     208#           read answer 
     209#           [ "X${answer}" == "X" ] || [ "X${answer}" == "XIBM" ] || [ "X${answer}" == "XIntel" ] && answerOK=true 
     210#       done 
     211 
     212#       if [ "X${answer}" != "X" ] ; then 
     213#           MPIEnvironment=${answer} 
     214#       fi 
     215    fi # if ( ! ${x_pm} ) 
     216#  echo MPIEnvironment is ${MPIEnvironment} 
    192217 
    193218else 
    194   echo No option for Header regarding ProjectID, ProjectNode and ProjectCore because we are not on curie 
     219  echo No option for Header regarding ProjectID, ProjectNode, ProjectCore or MPIEnvironment because we are not on curie or ada 
    195220fi # if [ X"${SYSTEM}" == "Xcurie" ] 
    196221 
  • trunk/libIGCM/libIGCM_sys/libIGCM_sys_ada.ksh

    r1297 r1305  
    9393#==================================================== 
    9494source /smplocal/pub/Modules/default/init/ksh 
    95 . /smphome/rech/psl/rpsl035/.atlas_env_ada_intel_2013_0_bash > /dev/null 2>&1 
     95if ( [ "X${LOADL_STEP_TYPE}" = "XPARALLEL" ] || [ "X${LOADL_STEP_TYPE}" = "XSERIAL" ] ) ; then 
     96  . /smphome/rech/psl/rpsl035/.atlas_env_ada_intel_2013_0_bash > /dev/null 2>&1 
     97else 
     98  module load intel/2016.2 > /dev/null 2>&1 
     99  . /smphome/rech/psl/rpsl035/.atlas_env_ada_bash > /dev/null 2>&1 
     100fi 
    96101[ ! X${TaskType} = Xchecking ] && IGCM_debug_Print 1 "List of loaded modules:" 
    97102[ ! X${TaskType} = Xchecking ] && module list 
     
    136141#==================================================== 
    137142#- HOST_MPIRUN_COMMAND 
    138 typeset -r HOST_MPIRUN_COMMAND=${HOST_MPIRUN_COMMAND:="/usr/bin/time poe"} 
    139  
     143if ( [ "X${LOADL_STEP_TYPE}" = "XPARALLEL" ] || [ "X${LOADL_STEP_TYPE}" = "XSERIAL" ] ) ; then 
     144  typeset -r HOST_MPIRUN_COMMAND=${HOST_MPIRUN_COMMAND:="/usr/bin/time poe"} 
     145else 
     146  typeset -r HOST_MPIRUN_COMMAND=${HOST_MPIRUN_COMMAND:="/usr/bin/time mpirun"} 
     147fi 
    140148#==================================================== 
    141149#- Max number of arguments passed to nco operator or demigration command 
     
    145153#- set PackDefault to true on ada 
    146154PackDefault=true 
     155 
     156#==================================================== 
     157#- Number of cores per node 
     158core_per_node=32 
    147159 
    148160#==================================================== 
     
    401413  [ ${#@} = 2 ] &&  REP_FOR_JOB=${2} 
    402414  sed -e "s:\# \@ output *= .*:\# \@ output = ${Script_Output}:" \ 
    403       -e "s:\# \@ error *= .*:\# \@ error = ${Script_Output}:"   \ 
    404       $1 > ${REP_FOR_JOB}/JOB_FOR_IGCM 
     415    -e "s:\# \@ error *= .*:\# \@ error = ${Script_Output}:"   \ 
     416    $1 > ${REP_FOR_JOB}/JOB_FOR_IGCM 
    405417  cd $REP_FOR_JOB ; /usr/bin/llsubmit JOB_FOR_IGCM > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 ; status=$? ; cd - ; 
    406418 
     
    433445 
    434446  sed -e "s:\# \@ output *= .*:\# \@ output = ${Script_Post_Output}.out:" \ 
    435       -e "s:\# \@ error *= .*:\# \@ error = ${Script_Post_Output}.out:"   \ 
    436       ${libIGCM_POST}/$1.job > ${REP_FOR_JOB}/JOB_FOR_IGCM_$$ 
     447    -e "s:\# \@ error *= .*:\# \@ error = ${Script_Post_Output}.out:"   \ 
     448    ${libIGCM_POST}/$1.job > ${REP_FOR_JOB}/JOB_FOR_IGCM_$$ 
    437449 
    438450  cd $REP_FOR_JOB ; /usr/bin/llsubmit JOB_FOR_IGCM_$$ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 ; status=$? ; cd - ; 
     
    858870function IGCM_sys_activ_variables { 
    859871  IGCM_debug_PushStack "IGCM_sys_activ_variables" 
     872  if ( [ ! "X${LOADL_STEP_TYPE}" = "XPARALLEL" ] && [ ! "X${LOADL_STEP_TYPE}" = "XSERIAL" ] ) ; then 
     873    # Temporary modifications for Intel MPI Environment 
     874    # To use DAPL Provider instead of OFA for inter-node communications 
     875    # and shm for intra-node communications 
     876    export I_MPI_FABRICS=shm:dapl 
     877    # To use UD protocol instead of RC (default with DAPL) 
     878    export I_MPI_DAPL_UD=1 
     879    # Some optimizations 
     880    export DAPL_UCM_REP_TIME=2000 # REQUEST timer, waiting for REPLY in millisecs 
     881    export DAPL_UCM_RTU_TIME=2000 # REPLY timer, waiting for RTU in millisecs 
     882    export DAPL_UCM_CQ_SIZE=2000 # CM completion queue 
     883    export DAPL_UCM_QP_SIZE=2000 # CM message queue 
     884    export DAPL_UCM_RETRY=7 # REQUEST and REPLY retries 
     885    export DAPL_ACK_RETRY=7 # IB RC Ack retry count 
     886    export DAPL_ACK_TIMER=20 # IB RC Ack retry timer 
     887    # To enable RDMA 
     888    export I_MPI_DAPL_UD_RDMA_MIXED=enable 
     889    # To use DAPL 2.1.7 
     890    export DAT_OVERRIDE=/smplocal/pub/DAPL/2.1.7/etc/dat.conf 
     891    export LD_LIBRARY_PATH=/smplocal/pub/DAPL/2.1.7/lib:${LD_LIBRARY_PATH} 
     892  fi 
    860893  if ( $DEBUG_sys ) ; then 
    861894    echo "IGCM_sys_activ_variables" 
     
    928961  if [ ${executionType} -eq 1 ] ; then 
    929962    # MPMD + MPI 
    930     sed -e "/::openMPthreads::/d"                  \ 
     963    if [ X${MPIEnvironment} = XIBM ] ; then 
     964      sed -e "/::openMPthreads::/d"                  \ 
    931965        -e "s/::JobNumProcTot::/${coreNumber}/"    \ 
    932       ${file} > ${file}.tmp 
     966        ${file} > ${file}.tmp 
     967    else 
     968      sed -e "/::openMPthreads::/d"                  \ 
     969        -e "s/@ job_type = parallel/@ job_type = mpich/" \ 
     970        -e "s/::JobNumProcTot::/${coreNumber}/"    \ 
     971        ${file} > ${file}.tmp 
     972    fi 
    933973 
    934974  elif [ ${executionType} -eq 2 ] ; then 
    935975    # MPMD + MPI + OMP 
    936     sed -e "s/::openMPthreads::/${openMPthreads}/" \ 
     976    if [ X${MPIEnvironment} = XIBM ] ; then 
     977      sed -e "s/::openMPthreads::/${openMPthreads}/" \ 
    937978        -e "s/::JobNumProcTot::/${mpiTasks}/"    \ 
    938       ${file} > ${file}.tmp 
     979        ${file} > ${file}.tmp 
     980    else 
     981      (( nodeNumber = coreNumber / core_per_node )) 
     982      [ $(( ${coreNumber} % ${core_per_node} )) -ne 0 ] && (( nodeNumber = nodeNumber + 1 )) 
     983      sed -e "/::openMPthreads::/d"                  \ 
     984        -e "s/@ job_type = parallel/@ job_type = mpich/" \ 
     985        -e "s/@ total_tasks = ::JobNumProcTot::/@ node = ${nodeNumber} /"    \ 
     986        -e "/@ as_limit = 3.5gb/d"      \ 
     987        -e "s/::JobNumProcTot::/${mpiTasks}/"      \ 
     988        ${file} > ${file}.tmp 
     989    fi 
    939990 
    940991  elif [ ${executionType} -eq 3 ] ; then 
    941992    # SPMD + MPI/OMP 
    942     sed -e "s/::openMPthreads::/${openMPthreads}/" \ 
     993    if [ X${MPIEnvironment} = XIBM ] ; then 
     994      sed -e "s/::openMPthreads::/${openMPthreads}/" \ 
    943995        -e "s/::JobNumProcTot::/${mpiTasks}/"      \ 
    944       ${file} > ${file}.tmp 
     996        ${file} > ${file}.tmp 
     997    else 
     998      sed -e "s/::openMPthreads::/${openMPthreads}/" \ 
     999        -e "s/@ job_type = parallel/@ job_type = mpich/" \ 
     1000        -e "s/::JobNumProcTot::/${mpiTasks}/"      \ 
     1001        ${file} > ${file}.tmp 
     1002    fi 
    9451003 
    9461004  elif [ ${executionType} -eq 4 ] ; then 
    9471005    # SPMD + MPI only 
    948     sed -e "s/::JobNumProcTot::/${mpiTasks}/"      \ 
     1006    if [ X${MPIEnvironment} = XIBM ] ; then 
     1007      sed -e "s/::JobNumProcTot::/${mpiTasks}/"      \ 
    9491008        -e "/::openMPthreads::/d"                  \ 
    950       ${file} > ${file}.tmp 
     1009        ${file} > ${file}.tmp 
     1010    else 
     1011      sed -e "s/::JobNumProcTot::/${mpiTasks}/"      \ 
     1012        -e "s/@ job_type = parallel/@ job_type = mpich/" \ 
     1013        -e "/::openMPthreads::/d"                  \ 
     1014        ${file} > ${file}.tmp 
     1015    fi 
    9511016 
    9521017  elif [ ${executionType} -eq 5 ] ; then 
     
    10051070  if ( ${OK_PARA_MPMD} ) ; then 
    10061071 
    1007     if [ -f run_file ] ; then 
    1008       IGCM_sys_Rm -f run_file 
    1009     fi 
    1010     touch run_file 
    1011  
    1012     # Build run_file 
    1013  
    1014     # First loop on the components for the coupler ie oasis (only if oasis3) 
    1015     # the coupler ie oasis3 must be the first one 
    1016     for comp in ${config_ListOfComponents[*]} ; do 
    1017  
    1018       eval ExeNameIn=\${config_Executable_${comp}[0]} 
    1019       eval ExeNameOut=\${config_Executable_${comp}[1]} 
    1020  
    1021       # for CPL component only 
    1022       if [ "X${comp}" = "XCPL" ] ; then 
    1023  
    1024         eval comp_proc_mpi_loc=\${${comp}_PROC_MPI} 
    1025         eval comp_proc_omp_loc=\${${comp}_PROC_OMP} 
    1026  
    1027         if ( ${OK_PARA_MPI} ) ; then 
    1028           (( mpi_count = 1 )) 
    1029           until [ ${mpi_count} -gt ${comp_proc_mpi_loc} ] ; do 
    1030             echo "./${ExeNameOut}" >> run_file 
    1031             (( mpi_count = mpi_count + 1 )) 
    1032           done 
    1033         else 
    1034           echo "./${ExeNameOut} " >> run_file 
     1072    # MPI IBM Environment 
     1073    if ( [ "X${LOADL_STEP_TYPE}" = "XPARALLEL" ] || [ "X${LOADL_STEP_TYPE}" = "XSERIAL" ] ) ; then 
     1074      IGCM_debug_Print 1 "You use IBM MPI environment" 
     1075      if [ -f run_file ] ; then 
     1076        IGCM_sys_Rm -f run_file 
     1077      fi 
     1078      touch run_file 
     1079 
     1080      # Build run_file 
     1081 
     1082      # First loop on the components for the coupler ie oasis (only if oasis3) 
     1083      # the coupler ie oasis3 must be the first one 
     1084      for comp in ${config_ListOfComponents[*]} ; do 
     1085 
     1086        eval ExeNameIn=\${config_Executable_${comp}[0]} 
     1087        eval ExeNameOut=\${config_Executable_${comp}[1]} 
     1088 
     1089        # for CPL component only 
     1090        if [ "X${comp}" = "XCPL" ] ; then 
     1091 
     1092          eval comp_proc_mpi_loc=\${${comp}_PROC_MPI} 
     1093          eval comp_proc_omp_loc=\${${comp}_PROC_OMP} 
     1094 
     1095          if ( ${OK_PARA_MPI} ) ; then 
     1096            (( mpi_count = 1 )) 
     1097            until [ ${mpi_count} -gt ${comp_proc_mpi_loc} ] ; do 
     1098              echo "./${ExeNameOut}" >> run_file 
     1099              (( mpi_count = mpi_count + 1 )) 
     1100            done 
     1101          else 
     1102            echo "./${ExeNameOut} " >> run_file 
     1103          fi 
     1104        fi 
     1105 
     1106      done 
     1107 
     1108      # Then second loop on the components 
     1109      for comp in ${config_ListOfComponents[*]} ; do 
     1110 
     1111        eval ExeNameIn=\${config_Executable_${comp}[0]} 
     1112        eval ExeNameOut=\${config_Executable_${comp}[1]} 
     1113 
     1114        # Only if we really have an executable for the component and not the coupler ie oasis: 
     1115        if ( [ "X${ExeNameOut}" != X\"\" ] && [ "X${comp}" != "XCPL" ] ) ; then 
     1116 
     1117          eval comp_proc_mpi_loc=\${${comp}_PROC_MPI} 
     1118          eval comp_proc_omp_loc=\${${comp}_PROC_OMP} 
     1119 
     1120          if ( ${OK_PARA_OMP} ) ; then 
     1121            # Check if the number of threads is correct 
     1122            case ${comp_proc_omp_loc} in 
     1123            1|2|4) 
     1124              IGCM_debug_Print 1 "You run ${ExeNameOut} on ${comp_proc_omp_loc} OMP threads on IBM MPI Environment" 
     1125              IGCM_debug_Print 1 "Beware : it may you use more CPU than needed." 
     1126              IGCM_debug_Print 1 "Think to the Intel MPI Environment to do what you want to do !" 
     1127              ;; 
     1128            8|16) 
     1129              IGCM_debug_Exit "ERROR with OMP parameters !" 
     1130              IGCM_debug_Print 2 "Beware : ${comp_proc_omp_loc} is too much for MPMD mode" 
     1131              IGCM_debug_Print 2 "You will use more CPU than needed : try to use Intel-MPI environment to do such a thing !" 
     1132              IGCM_debug_Verif_Exit 
     1133              ;; 
     1134            *) 
     1135              IGCM_debug_Exit "ERROR with OMP parameters !" 
     1136              IGCM_debug_Print 2 "${comp_proc_omp_loc} is not possible as number of OMP threads" 
     1137              IGCM_debug_Print 2 "Only 1,2,4,8,16 as number of OMP threads are possible " 
     1138              IGCM_debug_Verif_Exit 
     1139              ;; 
     1140            esac 
     1141 
     1142          fi 
     1143 
     1144          if ( ${OK_PARA_MPI} ) ; then 
     1145            (( mpi_count = 1 )) 
     1146            until [ ${mpi_count} -gt ${comp_proc_mpi_loc} ] ; do 
     1147              if ( ${OK_PARA_OMP} ) ; then 
     1148                echo "env OMP_NUM_THREADS=$comp_proc_omp_loc ./${ExeNameOut}" >> run_file 
     1149              else 
     1150                echo "./${ExeNameOut}" >> run_file 
     1151              fi 
     1152              (( mpi_count = mpi_count + 1 )) 
     1153            done 
     1154          else 
     1155            echo "./${ExeNameOut} " >> run_file 
     1156          fi 
     1157        fi 
     1158      done 
     1159      if ( ${OK_PARA_OMP} ) ; then 
     1160        export KMP_STACKSIZE=200m 
     1161      fi 
     1162 
     1163      EXECUTION="${HOST_MPIRUN_COMMAND} -pgmmodel mpmd -cmdfile ./run_file" 
     1164 
     1165      IGCM_sys_Chmod u+x run_file 
     1166      if ( $DEBUG_sys ) ; then 
     1167        echo "run_file contains : " 
     1168        cat run_file 
     1169      fi 
     1170 
     1171 
     1172    # MPI Intel Environment 
     1173    else 
     1174      IGCM_debug_Print 1 "You use Intel MPI environment" 
     1175 
     1176      # Only MPI (MPMD) 
     1177      if  ( ! ${OK_PARA_OMP} ) ; then 
     1178        init_exec=n 
     1179   
     1180        # First loop on the components for the coupler ie oasis (only if oasis3) 
     1181        # the coupler ie oasis3 must be the first one 
     1182        for comp in ${config_ListOfComponents[*]} ; do 
     1183 
     1184          eval ExeNameIn=\${config_Executable_${comp}[0]} 
     1185          eval ExeNameOut=\${config_Executable_${comp}[1]} 
     1186 
     1187          # for CPL component only 
     1188          if [ "X${comp}" = "XCPL"  ]  && [ "X${ExeNameOut}" != X\"\" ] ; then 
     1189 
     1190            eval comp_proc_mpi_loc=\${${comp}_PROC_MPI} 
     1191            eval comp_proc_omp_loc=\${${comp}_PROC_OMP} 
     1192 
     1193            echo "#!/bin/ksh" > script_${ExeNameOut}.ksh 
     1194            echo ""  >> script_${ExeNameOut}.ksh 
     1195            echo "./${ExeNameOut}" >> script_${ExeNameOut}.ksh 
     1196            IGCM_sys_Chmod u+x script_${ExeNameOut}.ksh 
     1197            EXECUTION="${EXECUTION} -np ${comp_proc_mpi_loc} ./script_${ExeNameOut}.ksh" 
     1198            init_exec=y 
     1199          fi 
     1200        done 
     1201        # Then second loop on the components 
     1202        for comp in ${config_ListOfComponents[*]} ; do 
     1203 
     1204          eval ExeNameIn=\${config_Executable_${comp}[0]} 
     1205          eval ExeNameOut=\${config_Executable_${comp}[1]} 
     1206 
     1207          # Only if we really have an executable for the component and not the coupler ie oasis: 
     1208          if ( [ "X${ExeNameOut}" != X\"\" ] && [ "X${comp}" != "XCPL" ] ) ; then 
     1209 
     1210            eval comp_proc_mpi_loc=\${${comp}_PROC_MPI} 
     1211            eval comp_proc_omp_loc=\${${comp}_PROC_OMP} 
     1212 
     1213            echo "#!/bin/ksh" > script_${ExeNameOut}.ksh 
     1214            echo ""  >> script_${ExeNameOut}.ksh 
     1215            echo "./${ExeNameOut}" >> script_${ExeNameOut}.ksh 
     1216            IGCM_sys_Chmod u+x script_${ExeNameOut}.ksh 
     1217 
     1218            if [ ${init_exec} = y ] ; then 
     1219              EXECUTION="${EXECUTION} : -np ${comp_proc_mpi_loc} ./script_${ExeNameOut}.ksh" 
     1220            else 
     1221              EXECUTION="${EXECUTION} -np ${comp_proc_mpi_loc} ./script_${ExeNameOut}.ksh" 
     1222              init_exec=y 
     1223            fi 
     1224          fi 
     1225        done 
     1226      # MPI-OpenMP (MPMD) 
     1227      else 
     1228 
     1229        # Execution specifications 
     1230        EXECUTION="${EXECUTION} -configfile run_file" 
     1231        export KMP_STACKSIZE=200m 
     1232        if [ -f run_file ] ; then 
     1233          IGCM_sys_Rm -f run_file 
     1234        fi 
     1235        touch run_file 
     1236 
     1237        # Initialisation of variables 
     1238        string_final="" 
     1239        string_final_hexa="" 
     1240        current_core=0 
     1241        executable_nb=1 
     1242 
     1243        #  Hosts treatment 
     1244        for nodes in `echo $LOADL_PROCESSOR_LIST` 
     1245        do 
     1246          host[$i]=$nodes 
     1247          i=$((i+1)) 
     1248        done 
     1249 
     1250        # Loop on the components 
     1251        for comp in ${config_ListOfComponents[*]} ; do 
     1252 
     1253          eval ExeNameIn=\${config_Executable_${comp}[0]} 
     1254          eval ExeNameOut=\${config_Executable_${comp}[1]} 
     1255 
     1256          # Not possible if oasis has an executable (i.e old version of oasis3) 
     1257          if ( [ "X${ExeNameOut}" != X\"\" ] &&  [ "X${comp}" = "XCPL" ] ) ; then 
     1258            IGCM_debug_Exit "ERROR MPMD with hybrid MPI-OpenMP is not available with oasis3 version" 
     1259            IGCM_debug_Print 2 "Only available with oasis3-MCT version coupler" 
     1260            IGCM_debug_Verif_Exit 
     1261          fi 
     1262 
     1263          # Only if we really have an executable for the component : 
     1264          if [ "X${ExeNameOut}" != X\"\" ] ; then 
     1265 
     1266            eval comp_proc_mpi_loc=\${${comp}_PROC_MPI} 
     1267            eval comp_proc_omp_loc=\${${comp}_PROC_OMP} 
     1268 
     1269            # Check if the number of threads is correct 
     1270            case ${comp_proc_omp_loc} in 
     1271            1|2|4|8|16) 
     1272              IGCM_debug_Print 1 "You run ${ExeNameOut} on ${comp_proc_omp_loc} OMP threads" 
     1273              ;; 
     1274            *) 
     1275              IGCM_debug_Exit "ERROR with OMP parameters !" 
     1276              IGCM_debug_Print 2 "${comp_proc_omp_loc} is not possible as number of OMP threads" 
     1277              IGCM_debug_Print 2 "Only 1,2,4,8,16 as number of OMP threads are possible " 
     1278              IGCM_debug_Verif_Exit 
     1279              ;; 
     1280            esac 
     1281 
     1282 
     1283            # Build run_file for Ada Intel-MPI environment : method used to assign cores and nodes for the MPI process by using hexadecimal mask 
     1284            # Example of run_file : 
     1285            #-host host0 -n 4 -env I_MPI_PIN_DOMAIN=[ff,ff00,ff0000,ff000000] ./a.out 
     1286            #-host host1 -n 4 -env I_MPI_PIN_DOMAIN=[ff,ff00,ff0000,ff000000] ./a.out 
     1287            #-host host2 -n 10 -env I_MPI_PIN_DOMAIN=[3,c,30,c0,300,c00,3000,c000,30000,c0000,100000,200000,400000,800000,1000000,2000000,4000000,8000000,10000000,20000000] ./b.out 
     1288            #-host host2 -n 10 ./c.out 
     1289            # Example of final command : 
     1290            # mpirun -configfile run_file 
     1291 
     1292            rank=0 
     1293            # For one specific executable, loop on mpi process 
     1294            for nb_proc_mpi in `seq 0 $(($comp_proc_mpi_loc-1))`; do 
     1295              (( index_host = current_core / core_per_node )) 
     1296              host_value=${host[${index_host}]} 
     1297              (( slot =  current_core % core_per_node )) 
     1298              # loop on omp threads for each mpi process (set the appropriate bit to 1 and append it to previous one) 
     1299              for index in `seq $slot $(($slot+$comp_proc_omp_loc-1))`; do 
     1300                string_final="1"$string_final 
     1301              done 
     1302              # convert binary mask to hexadecimal mask 
     1303              if [ $rank -ne 0 ] ; then 
     1304                string_final_hexa=$string_final_hexa","$( printf '%x\n' "$((2#$string_final))" ) 
     1305              else 
     1306                string_final_hexa=$( printf '%x\n' "$((2#$string_final))" ) 
     1307              fi 
     1308              # replace bit 1 by bit 0 in order to append next one (next one wil be 1) 
     1309              string_final=$( echo $string_final | sed "s/1/0/g" ) 
     1310              # mpi rank = mpi_rank + 1 
     1311              (( rank = rank + 1 )) 
     1312              # current core takes into account the number of omp threads which was previously append 
     1313              (( current_core = current_core + comp_proc_omp_loc )) 
     1314              # We write to the configuration file either we switch to the next node or we switch to the next executable 
     1315              if ( [ $(( current_core / core_per_node )) -ne $index_host ] || [ $nb_proc_mpi -eq $(($comp_proc_mpi_loc-1)) ] ) ; then 
     1316                # I_MPI_PIN_DOMAIN variable must be given once per node 
     1317                if [ $executable_nb -eq 1 ] ; then 
     1318                  echo "-host $host_value -n $rank -env I_MPI_PIN_DOMAIN=[$string_final_hexa] ./$ExeNameOut" >> run_file 
     1319                else 
     1320                  sed -i "/$host_value/s/\]/\,$string_final_hexa\]/g" run_file 
     1321                  echo "-host $host_value -n $rank ./$ExeNameOut" >> run_file 
     1322                fi 
     1323                # +1 for the number of executbale on the same node 
     1324                if [ $nb_proc_mpi -eq $(($comp_proc_mpi_loc-1)) ] ; then 
     1325                  (( executable_nb = executable_nb + 1 )) 
     1326                fi 
     1327                # Some initializations if we switch to the next node 
     1328                if [ $(( current_core / core_per_node )) -ne $index_host ] ; then 
     1329                  string_final="" 
     1330                  string_final_hexa="" 
     1331                  rank=0 
     1332                  executable_nb=1 
     1333                fi 
     1334              fi 
     1335            done 
     1336 
     1337          fi 
     1338        done 
     1339        IGCM_sys_Chmod u+x run_file 
     1340        if ( $DEBUG_sys ) ; then 
     1341          echo "run_file contains : " 
     1342          cat run_file 
    10351343        fi 
    10361344      fi 
    1037     done 
    1038  
    1039     # Then second loop on the components 
    1040     for comp in ${config_ListOfComponents[*]} ; do 
    1041  
    1042       eval ExeNameIn=\${config_Executable_${comp}[0]} 
    1043       eval ExeNameOut=\${config_Executable_${comp}[1]} 
    1044  
    1045       # Only if we really have an executable for the component and not the coupler ie oasis: 
    1046       if ( [ "X${ExeNameOut}" != X\"\" ] && [ "X${comp}" != "XCPL" ] ) ; then 
    1047  
    1048         eval comp_proc_mpi_loc=\${${comp}_PROC_MPI} 
    1049         eval comp_proc_omp_loc=\${${comp}_PROC_OMP} 
    1050  
    1051         if ( ${OK_PARA_MPI} ) ; then 
    1052           (( mpi_count = 1 )) 
    1053           until [ ${mpi_count} -gt ${comp_proc_mpi_loc} ] ; do 
    1054             if ( ${OK_PARA_OMP} ) ; then 
    1055               # Check if the number of threads is correct 
    1056               case ${comp_proc_omp_loc} in 
    1057               1|2|4) 
    1058                 IGCM_debug_Print 1 "You run ${ExeNameOut} on ${comp_proc_omp_loc} OMP threads" 
    1059                 ;; 
    1060               8|16) 
    1061                 IGCM_debug_Exit "ERROR with OMP parameters !" 
    1062                 IGCM_debug_Print 2 "Beware : ${comp_proc_omp_loc} is too much for MPMD mode" 
    1063                 IGCM_debug_Print 2 "You will use more CPU than needed" 
    1064                 IGCM_debug_Verif_Exit 
    1065                 ;; 
    1066               *) 
    1067                 IGCM_debug_Exit "ERROR with OMP parameters !" 
    1068                 IGCM_debug_Print 2 "${comp_proc_omp_loc} is not possible as number of OMP threads" 
    1069                 IGCM_debug_Print 2 "Only 2,4,8,16 as number of OMP threads are possible " 
    1070                 IGCM_debug_Verif_Exit 
    1071                 ;; 
    1072               esac 
    1073               echo "env OMP_NUM_THREADS=$comp_proc_omp_loc ./${ExeNameOut}" >> run_file 
    1074             else 
    1075               echo "./${ExeNameOut}" >> run_file 
    1076             fi 
    1077             (( mpi_count = mpi_count + 1 )) 
    1078           done 
    1079         else 
    1080           echo "./${ExeNameOut} " >> run_file 
    1081         fi 
    1082         if ( ${OK_PARA_OMP} ) ; then 
    1083           export KMP_STACKSIZE=200m 
    1084         fi 
    1085       fi 
    1086     done 
    1087  
    1088     EXECUTION="${HOST_MPIRUN_COMMAND} -pgmmodel mpmd -cmdfile ./run_file" 
    1089  
    1090     IGCM_sys_Chmod u+x run_file 
    1091     if ( $DEBUG_sys ) ; then 
    1092       echo "run_file contains : " 
    1093       cat run_file 
    10941345    fi 
    10951346 
     
    11111362          #echo "export MKL_SERIAL=YES"  >> script_${ExeNameOut}.ksh 
    11121363        fi 
    1113         EXECUTION="${HOST_MPIRUN_COMMAND} ./${ExeNameOut}" 
     1364        if  ( ${OK_PARA_MPI} ) ; then 
     1365          if ( [ "X${LOADL_STEP_TYPE}" = "XPARALLEL" ] || [ "X${LOADL_STEP_TYPE}" = "XSERIAL" ] ) ; then 
     1366            EXECUTION="${HOST_MPIRUN_COMMAND} ./${ExeNameOut}" 
     1367          else 
     1368            eval comp_proc_mpi_loc=\${${comp}_PROC_MPI} 
     1369            EXECUTION="${HOST_MPIRUN_COMMAND} -np ${comp_proc_mpi_loc} ./${ExeNameOut}" 
     1370          fi 
     1371        else 
     1372          EXECUTION="/usr/bin/time ./${ExeNameOut}" 
     1373        fi 
    11141374      fi 
    11151375 
     
    12201480  # Print only the full (-W) JobID (%id) and JobName (%jn) 
    12211481  ID=$( llq -u $2 -W -f %id %jn | \ 
    1222         gawk -v JobName=$1 '( $NF ~ JobName ) { print $1 }' ) 
     1482    gawk -v JobName=$1 '( $NF ~ JobName ) { print $1 }' ) 
    12231483 
    12241484  eval ${3}=${ID} 
     
    12581518  # With -W option, column width is as large as necessary 
    12591519  set -A JobList $( llq -u $1 -W -f %jn | head -n -2 | tail -n +3 | \ 
    1260                     gawk '( $1 != /TS/      && \ 
     1520    gawk '( $1 != /TS/      && \ 
    12611521                            $1 !~ /PACK/    && \ 
    12621522                            $1 !~ /REBUILD/ && \ 
     
    12861546  if [ ${status} -gt 0 ] ; then 
    12871547    echo "IGCM_sys_atlas : error code ${status}" 
    1288  
    1289     cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$  
    1290     \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$  
    1291                     IGCM_debug_PopStack "IGCM_sys_atlas"  
    1292             return 1  
    1293   else  
    1294     IGCM_debug_PopStack "IGCM_sys_atlas"  
    1295                     return 0  
    1296   fi  
    1297  
    1298   IGCM_debug_PopStack "IGCM_sys_atlas"  
    1299 }  
     1548    cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 
     1549    \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 
     1550    IGCM_debug_PopStack "IGCM_sys_atlas" 
     1551    return 1 
     1552  else 
     1553    IGCM_debug_PopStack "IGCM_sys_atlas" 
     1554    return 0 
     1555  fi 
     1556 
     1557  IGCM_debug_PopStack "IGCM_sys_atlas" 
     1558} 
     1559 
Note: See TracChangeset for help on using the changeset viewer.