Ignore:
Timestamp:
02/24/12 18:16:41 (12 years ago)
Author:
mafoipsl
Message:

Add default number of processors in libIGCM_sys library. Adapted and tested on vargas and SX9.

Location:
branches/libIGCM_MPI_OpenMP
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/libIGCM_MPI_OpenMP/libIGCM_config/libIGCM_config.ksh

    r556 r558  
    607607                        *[mM][pP][iI]*) 
    608608                            # Read MPI parameter for composante 
    609                             eval ${comp}_PROC_MPI=$( echo ${tempvar} | sed -e "s/MPI//" ) 
     609                            eval ${comp}_PROC_MPI=$( echo ${tempvar} | tr '[a-z]' '[A-Z]' | sed -e "s/MPI//" ) 
    610610                            OK_PARA_MPI=true;; 
    611611                        *[oO][mM][pP]*) 
    612612                            # Read OMP parameter for composante 
    613                             eval ${comp}_PROC_OMP=$( echo ${tempvar} | sed -e "s/OMP//" ) 
     613                            eval ${comp}_PROC_OMP=$( echo ${tempvar} | tr '[a-z]' '[A-Z]' | sed -e "s/OMP//" ) 
    614614                            OK_PARA_OMP=true;; 
    615615                        *[nN][oO][dD]*) 
    616616                            # Read NOD (NumBer of Nodes) parameter for composante 
    617                             eval ${comp}_PROC_NOD=$( echo ${tempvar} | sed -e "s/NOD//" ) 
     617                            eval ${comp}_PROC_NOD=$( echo ${tempvar} | tr '[a-z]' '[A-Z]' | sed -e "s/NOD//" ) 
    618618                            OK_PARA_NOD=true 
    619619                            OK_PARA_MPI=true;; 
     
    642642    if [ X${BATCH_NUM_PROC_TOT} != X ] ; then 
    643643        # BATCH_NUM_PROC_TOT is set 
    644         if ( ! ${OK_PARA_MPI} ) ; then 
     644        if ( ${OK_PARA_MPI} ) ; then 
     645            IGCM_debug_Print 1 "MPI/OMP/NOD fund into config.card and BATCH_NUM_PROC_TOT = ${BATCH_NUM_PROC_TOT} " 
     646        else 
    645647            # with previous method. 
    646648            if [ ${BATCH_NUM_PROC_TOT} -gt 1 ] ; then 
     
    648650                if ( ${OK_PARA_MPMD} ) ; then 
    649651                     # with MPMD ie CPL/oasis method 
    650                      echo "We will use default number of MPI tasks : 5 for OCE, 1 for CPL and 26 for ATM for coupled configuration" 
     652                     echo "We will use default number of MPI tasks for this machine : " 
     653                     echo "${DEFAULT_NUM_PROC_OCE} for OCE; " 
     654                     echo "${DEFAULT_NUM_PROC_CPL} for CPL; " 
     655                     echo "${DEFAULT_NUM_PROC_ATM} for ATM; " 
     656                     echo "${DEFAULT_NUM_PROC_TOTAL} for the total number of processors; " 
    651657                     OK_PARA_MPI=true 
    652                      CPL_PROC_MPI=1 
    653                      OCE_PROC_MPI=5 
    654                      ATM_PROC_MPI=26 
    655                      PROCESSUS_NUMBER=32 
     658                     CPL_PROC_MPI=${DEFAULT_NUM_PROC_CPL} 
     659                     OCE_PROC_MPI=${DEFAULT_NUM_PROC_OCE} 
     660                     ATM_PROC_MPI=${DEFAULT_NUM_PROC_ATM} 
     661                     PROCESSUS_NUMBER=${DEFAULT_NUM_PROC_TOTAL} 
    656662                else 
    657663                     # with have only one executable 
  • branches/libIGCM_MPI_OpenMP/libIGCM_sys/libIGCM_sys_mercurex9.ksh

    r452 r558  
    161161#- Max number of arguments passed to nco operator or demigration command 
    162162UNIX_MAX_LIMIT=360 
     163 
     164#==================================================== 
     165#- Default number of MPI task for IPSL coupled model 
     166#- required for backward compatibility 
     167#- 
     168DEFAULT_NUM_PROC_OCE=1 
     169DEFAULT_NUM_PROC_CPL=1 
     170DEFAULT_NUM_PROC_ATM=3 
     171DEFAULT_NUM_PROC_TOTAL=4 
    163172 
    164173#D-#================================================== 
     
    12121221 
    12131222############################################################ 
    1214 # Build run file 
     1223# Build MPI/OMP scripts 
     1224function IGCM_sys_build_execution_scripts  
     1225{ 
     1226    IGCM_debug_PushStack "IGCM_sys_build_execution_scripts" $@ 
     1227    if ( $DEBUG_sys ) ; then 
     1228        echo "IGCM_sys_build_execution_scripts " $@ 
     1229    fi 
     1230 
     1231    typeset NbNodes_Job NbProc_Job comp_proc_mpi_loc comp_proc_omp_loc mpi_count 
     1232     
     1233    if [ ! -f ${SUBMIT_DIR}/Job_${config_UserChoices_JobName} ]  ; then 
     1234        IGCM_debug_Exit "IGCM_sys_mercurex9 build_execution_scripts : Job_${config_UserChoices_JobName} don't exist in SUBMIT_DIR : ${SUBMIT_DIR} " 
     1235    fi 
     1236 
     1237    if ( ${OK_PARA_MPMD} ) ; then 
     1238 
     1239        if [ -f run_file ] ; then 
     1240            IGCM_sys_Rm -f run_file 
     1241        fi 
     1242        touch run_file 
     1243 
     1244        if ( ${OK_PARA_OMP} ) ; then 
     1245                IGCM_debug_Print 2 "Error in config.card on SX9 : OpenMP not available" 
     1246                exit 1 
     1247        else 
     1248# OLD : 
     1249#PBS -v BATCH_NUM_PROC_TOT=4 
     1250#PBS -l cpunum_job=${BATCH_NUM_PROC_TOT} 
     1251            echo "Job_${config_UserChoices_JobName} includes BATCH_NUM_PROC_TOT = \c" 
     1252            cat ${SUBMIT_DIR}/Job_${config_UserChoices_JobName} | grep "BATCH_NUM_PROC_TOT" | sed -e "s/.*BATCH_NUM_PROC_TOT = //"  
     1253            NbProc_Job=$( cat ${SUBMIT_DIR}/Job_${config_UserChoices_JobName} | grep "BATCH_NUM_PROC_TOT" | sed -e "s/.*BATCH_NUM_PROC_TOT = //" ) 
     1254            NbProc_Job=${NbProc_Job:=0} 
     1255            if [ ${NbProc_Job} -eq 0 ] ; then 
     1256                IGCM_debug_Print 2 "Error in Job_${config_UserChoices_JobName} ressources : no BATCH_NUM_PROC_TOT defined with MPI only run." 
     1257                exit 1 
     1258            fi 
     1259        fi 
     1260 
     1261# run_file construction 
     1262 
     1263# Then first loop on the components for the coupler ie oasis 
     1264 
     1265### the coupler ie oasis must be the first one 
     1266    for comp in ${config_ListOfComponents[*]} ; do 
     1267         
     1268        eval ExeNameIn=\${config_Executable_${comp}[0]} 
     1269        eval ExeNameOut=\${config_Executable_${comp}[1]} 
     1270             
     1271        # for CPL component only 
     1272        if [ "X${comp}" = "XCPL" ] ; then 
     1273 
     1274            eval comp_proc_mpi_loc=\${${comp}_PROC_MPI} 
     1275            eval comp_proc_omp_loc=\${${comp}_PROC_OMP} 
     1276             
     1277            if ( ${OK_PARA_MPI} ) ; then  
     1278 
     1279                (( mpi_count = 1 )) 
     1280                until [ ${mpi_count} -gt ${comp_proc_mpi_loc} ] ; do 
     1281                    echo "./${ExeNameOut}" >> run_file  
     1282                    (( mpi_count = mpi_count + 1 )) 
     1283                done 
     1284            fi 
     1285        fi 
     1286    done 
     1287 
     1288# Then second loop on the components 
     1289 
     1290    for comp in ${config_ListOfComponents[*]} ; do 
     1291         
     1292        eval ExeNameIn=\${config_Executable_${comp}[0]} 
     1293        eval ExeNameOut=\${config_Executable_${comp}[1]} 
     1294             
     1295        # Only if we really have an executable for the component and not the coupler ie oasis: 
     1296        if ( [ "X${ExeNameOut}" != X\"\" ] && [ "X${comp}" != "XCPL" ] ) ; then 
     1297 
     1298            eval comp_proc_mpi_loc=\${${comp}_PROC_MPI} 
     1299            eval comp_proc_omp_loc=\${${comp}_PROC_OMP} 
     1300             
     1301            if ( ${OK_PARA_MPI} ) ; then  
     1302 
     1303                (( mpi_count = 1 )) 
     1304                until [ ${mpi_count} -gt ${comp_proc_mpi_loc} ] ; do 
     1305                    echo "./${ExeNameOut}" >> run_file  
     1306                    (( mpi_count = mpi_count + 1 )) 
     1307                done 
     1308            fi 
     1309        fi 
     1310    done 
     1311 
     1312    EXECUTION="${HOST_MPIRUN_COMMAND} -f ./run_file" 
     1313 
     1314    IGCM_sys_Chmod u+x run_file 
     1315    if ( $DEBUG_sys ) ; then 
     1316      echo "run_file contains : " 
     1317      cat run_file 
     1318    fi 
     1319 
     1320else # Only one executable. launch it. 
     1321 
     1322    for comp in ${config_ListOfComponents[*]} ; do 
     1323 
     1324        eval ExeNameIn=\${config_Executable_${comp}[0]} 
     1325        eval ExeNameOut=\${config_Executable_${comp}[1]} 
     1326 
     1327        [ "X${ExeNameOut}" != X\"\" ] &&  EXECUTION="time mpirun -np ${BATCH_NUM_PROC_TOT} ./${ExeNameOut}" 
     1328 
     1329    done 
     1330 
     1331fi 
     1332 
     1333    IGCM_debug_Print 1 "sys mercurex9 : execution command is " 
     1334    IGCM_debug_Print 1 "$EXECUTION" 
     1335 
     1336    IGCM_debug_PopStack "IGCM_sys_build_execution_scripts" 
     1337} 
    12151338 
    12161339function IGCM_sys_build_run_file { 
    1217     IGCM_debug_PushStack "IGCM_sys_build_run_file" $@ 
    1218     if ( $DEBUG_sys ) ; then 
    1219         echo "IGCM_sys_build_run_file " $@ 
    1220     fi 
    1221     (( NUM_PROC_ATM = BATCH_NUM_PROC_TOT - 1 )) 
    1222     (( NUM_PROC_OASIS = BATCH_NUM_PROC_TOT - NUM_PROC_ATM )) 
    1223     (( NUM_PROC_OCE = BATCH_NUM_PROC_TOT - NUM_PROC_ATM )) 
    1224      
    1225     if [ $1 = MPI2 ]; then 
    1226         cat <<EOF > run_file 
    1227 -p 1 -np 1 -e ./oasis 
    1228 EOF 
    1229         (( NUM_PROCESS = BATCH_NUM_PROC_TOT + 1 )) 
    1230         config_UserChoices_JobRunOptions='"-max_np ${NUM_PROCESS} -f"' 
    1231  
    1232     elif [ $1 = MPI1 ]; then 
    1233         cat <<EOF > run_file 
    1234 -p $NUM_PROC_OASIS -e ./oasis 
    1235 -p $NUM_PROC_ATM -e ./lmdz.x 
    1236 -p $NUM_PROC_OCE -e ./opa.xx 
    1237 EOF 
    1238   
    1239     fi 
    1240  
    1241     IGCM_debug_PopStack "IGCM_sys_build_run_file" 
    1242    
    1243 } 
     1340 
     1341IGCM_debug_Print 3 " dummy function : IGCM_sys_build_run_file " 
     1342 
     1343} 
     1344 
  • branches/libIGCM_MPI_OpenMP/libIGCM_sys/libIGCM_sys_vargas.ksh

    r557 r558  
    138138#- Max number of arguments passed to nco operator or demigration command 
    139139UNIX_MAX_LIMIT=120 
     140 
     141#==================================================== 
     142#- Default number of MPI task for IPSL coupled model 
     143#- required for backward compatibility 
     144#- 
     145DEFAULT_NUM_PROC_OCE=5 
     146DEFAULT_NUM_PROC_CPL=1 
     147DEFAULT_NUM_PROC_ATM=26 
     148DEFAULT_NUM_PROC_TOTAL=32 
    140149 
    141150#D-#================================================== 
Note: See TracChangeset for help on using the changeset viewer.