Ignore:
Timestamp:
02/21/12 19:25:29 (12 years ago)
Author:
mafoipsl
Message:

First test on mono-executable (sequential, MPI or hybrid MPI/OpenMP) on vargas and first try to use default value adapted to IPSLCM5A in multi-executable mode (OASIS/1 , ATM/26 and OCE/5)

Location:
branches/libIGCM_MPI_OpenMP
Files:
2 edited

Legend:

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

    r493 r556  
    538538    fi 
    539539 
    540     typeset ExeNameIn 
     540    typeset ExeNameIn ExeNameFirst CompNameFirst 
    541541    typeset comp i 
    542     typeset tempvar tempvarMPI tempvarNOD NbElts j 
     542    typeset tempvar tempvarMPI tempvarNOD NbElts j NbExec 
    543543 
    544544    (( PROCESSUS_NUMBER = 0 )) 
    545545    (( i=0 )) 
     546    (( NbExec=0 )) 
    546547 
    547548    OK_PARA_MPI=false 
    548549    OK_PARA_OMP=false 
    549550    OK_PARA_NOD=false 
     551    OK_PARA_MPMD=false 
     552 
    550553    for comp in ${config_ListOfComponents[*]} ; do 
    551554 
     
    568571        # Only if we really have an executable for the component : 
    569572        if [ X${ExeNameIn} != X\"\" ] ; then 
     573 
     574            # Keep the first executable found and the first CompName 
     575            ExeNameFirst=${ExeNameIn} 
     576            CompNameFirst=${comp} 
     577 
     578            # Are we a second executable? 
     579            (( NbExec = NbExec + 1 )) 
     580 
     581            # set 1 MPI task, 1 OpenMP thread and 1 node as default 
     582            eval ${comp}_PROC_MPI=1 
     583            eval ${comp}_PROC_OMP=1 
     584            eval ${comp}_PROC_NOD=1 
     585 
    570586            eval NbElts=\${#config_Executable_${comp}[@]} 
     587 
    571588            if [ ${NbElts} -ge 2 ] ; then 
    572589                (( j = 2 )) 
    573                 eval ${comp}_PROC_MPI=1 
    574                 eval ${comp}_PROC_OMP=1 
    575                 eval ${comp}_PROC_NOD=1 
    576590 
    577591                while [ $j -lt ${NbElts} ] ; do  
     
    591605 
    592606                    case ${tempvar} in 
    593                         *MPI) 
     607                        *[mM][pP][iI]*) 
    594608                            # Read MPI parameter for composante 
    595609                            eval ${comp}_PROC_MPI=$( echo ${tempvar} | sed -e "s/MPI//" ) 
    596610                            OK_PARA_MPI=true;; 
    597                         *OMP) 
     611                        *[oO][mM][pP]*) 
    598612                            # Read OMP parameter for composante 
    599613                            eval ${comp}_PROC_OMP=$( echo ${tempvar} | sed -e "s/OMP//" ) 
    600614                            OK_PARA_OMP=true;; 
    601                         *NOD) 
     615                        *[nN][oO][dD]*) 
    602616                            # Read NOD (NumBer of Nodes) parameter for composante 
    603617                            eval ${comp}_PROC_NOD=$( echo ${tempvar} | sed -e "s/NOD//" ) 
     
    609623                done 
    610624 
    611                 eval tempvarMPI=\${${comp}_PROC_MPI} 
    612                 eval tempvarNOD=\${${comp}_PROC_NOD} 
    613                 eval tempvarOMP=\${${comp}_PROC_OMP} 
    614                 (( PROCESSUS_NUMBER = PROCESSUS_NUMBER + tempvarMPI * tempvarNOD * tempvarOMP )) 
    615625            fi 
     626 
     627            eval tempvarMPI=\${${comp}_PROC_MPI} 
     628            eval tempvarNOD=\${${comp}_PROC_NOD} 
     629            eval tempvarOMP=\${${comp}_PROC_OMP} 
     630 
     631            (( PROCESSUS_NUMBER = PROCESSUS_NUMBER + tempvarMPI * tempvarNOD * tempvarOMP )) 
     632 
    616633        fi 
    617634 
     
    619636    done 
    620637 
    621     # sequential case ! 
    622     if [ ${PROCESSUS_NUMBER} -eq 0 ] ; then 
    623         (( PROCESSUS_NUMBER = 1 )) 
    624         echo "PROCESSUS_NUMBER is all 0 (sequential use of old definition in config->Executable->list)." 
    625         echo "We set it to 1." 
    626     fi 
    627  
    628     IGCM_debug_Print 1 "MPI/OMP treatment PROCESSUS_NUMBER = ${PROCESSUS_NUMBER}" 
    629  
    630     # Verification with PBS parameter 
     638    # set MPMD mode if more than 2 executable names. 
     639    [ ${NbExec} -ge 2 ] && OK_PARA_MPMD=true 
     640 
     641    # Verification of BATCH_NUM_PROC_TOT total number of processors set in job header. 
    631642    if [ X${BATCH_NUM_PROC_TOT} != X ] ; then 
    632         if [ ${BATCH_NUM_PROC_TOT} -ne ${PROCESSUS_NUMBER} ] ; then 
    633             echo "Warning with parallelization parameters !" 
    634             echo "PBS variable BATCH_NUM_PROC_TOT = ${BATCH_NUM_PROC_TOT} " 
    635             echo " is the total number of _processors_ reserved." 
    636             echo "It is not equal to the sum of _processus_ in config.card = ${PROCESSUS_NUMBER}." 
    637         fi 
     643        # BATCH_NUM_PROC_TOT is set 
    638644        if ( ! ${OK_PARA_MPI} ) ; then 
     645            # with previous method. 
    639646            if [ ${BATCH_NUM_PROC_TOT} -gt 1 ] ; then 
    640                 echo "You have given a reservation of ${BATCH_NUM_PROC_TOT} processors," 
    641                 echo "but you havn't filled the parallel parameter in config->Executable->list." 
    642                 echo "This is the old method and it is no more supported." 
    643                 echo "Please read documentation or config specific comments." 
    644                 echo "We stop now." 
    645                 exit 1 
     647                # with more than 1 proc 
     648                if ( ${OK_PARA_MPMD} ) ; then 
     649                     # 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" 
     651                     OK_PARA_MPI=true 
     652                     CPL_PROC_MPI=1 
     653                     OCE_PROC_MPI=5 
     654                     ATM_PROC_MPI=26 
     655                     PROCESSUS_NUMBER=32 
     656                else 
     657                     # with have only one executable 
     658                     echo "We will use ${BATCH_NUM_PROC_TOT} MPI tasks for ${CompNameFirst} : ${config_Executable_Name} " 
     659                     OK_PARA_MPI=true 
     660                     eval ${CompNameFirst}_PROC_MPI=${BATCH_NUM_PROC_TOT} 
     661                     PROCESSUS_NUMBER=${BATCH_NUM_PROC_TOT} 
     662                fi 
    646663            else  
    647664                PROCESSUS_NUMBER=1 
    648665            fi 
    649666        fi 
    650     else 
     667        # Verification with PBS parameter 
     668        if [ ${BATCH_NUM_PROC_TOT} -ne ${PROCESSUS_NUMBER} ] ; then 
     669            echo "Warning with parallelization parameters !" 
     670            echo "Job header variable BATCH_NUM_PROC_TOT = ${BATCH_NUM_PROC_TOT} " 
     671            echo "is the total number of _processors_ reserved." 
     672            echo "It is not equal to the sum of _processus_  = ${PROCESSUS_NUMBER}." 
     673            echo "We stop now." 
     674            exit 1 
     675        fi 
     676 
     677    else # BATCH_NUM_PROC_TOT="" 
    651678        if ( ${OK_PARA_MPI} ) ; then 
    652679            echo "You have not given a value of ${BATCH_NUM_PROC_TOT} processors," 
    653680            echo "but you have filled the parallel parameter in config->Executable->list." 
    654             echo "This is the old method and it is no more supported." 
    655             echo "Please read documentation or config specific comments." 
     681            echo "Please add BATCH_NUM_PROC_TOT variable in job header." 
    656682            echo "We stop now." 
    657683            exit 1 
    658         fi 
    659     fi 
     684        else 
     685        # sequential case ! 
     686            if [ ${PROCESSUS_NUMBER} -eq 0 ] ; then 
     687               (( PROCESSUS_NUMBER = 1 )) 
     688               echo "PROCESSUS_NUMBER is all 0 (sequential use of old definition in config->Executable->list)." 
     689               echo "We set it to 1." 
     690            fi 
     691        fi 
     692    fi 
     693 
     694    IGCM_debug_Print 1 "MPI/OMP treatment PROCESSUS_NUMBER = ${PROCESSUS_NUMBER}" 
    660695 
    661696#     if ( ${OK_PARA_MPI} || ${OK_PARA_OMP} || ${OK_PARA_NOD} ) ; then 
  • branches/libIGCM_MPI_OpenMP/libIGCM_sys/libIGCM_sys_vargas.ksh

    r499 r556  
    11381138    typeset NbNodes_Job NbProc_Job comp_proc_mpi_loc comp_proc_omp_loc mpi_count 
    11391139     
    1140     # Verification with PBS parameter 
    1141     if [ X${BATCH_NUM_PROC_TOT} != X ] ; then 
    1142  
    1143         if ( ${OK_PARA_MPI} ) ; then 
    1144             EXECUTION=${HOST_MPIRUN_COMMAND} 
    1145         else 
    1146             if [ ${BATCH_NUM_PROC_TOT} -eq 1 ] ; then 
    1147                 EXECUTION=${MPIRUN_COMMAND:="time "} 
    1148             fi 
    1149         fi 
    1150     else 
    1151         if ( ! ${OK_PARA_MPI} ) ; then 
    1152             EXECUTION=${MPIRUN_COMMAND:="time "} 
    1153         fi 
    1154     fi 
    1155  
    1156     if [ ${PROCESSUS_NUMBER} -gt 1 ] ; then 
    1157     
     1140    if [ ! -f ${SUBMIT_DIR}/Job_${config_UserChoices_JobName} ]  ; then 
     1141        IGCM_debug_Exit "IGCM_sys_vargas build_execution_scripts : Job_${config_UserChoices_JobName} don't exist in SUBMIT_DIR : ${SUBMIT_DIR} " 
     1142    fi 
     1143 
     1144    if [ -f run_file ] ; then 
     1145        IGCM_sys_Rm -f run_file 
     1146    fi 
     1147    touch run_file 
     1148 
     1149    if ( ${OK_PARA_MPMD} ) ; then 
     1150 
    11581151        if ( ${OK_PARA_OMP} ) ; then 
    11591152# NEW : 2 Noeuds 
     
    11911184            fi             
    11921185        fi 
    1193         if [ -f runfile ] ; then 
    1194             IGCM_sys_Rm -f runfile 
    1195             touch runfile 
    1196         fi 
    1197     fi 
    1198  
    1199 # runfile construction 
     1186 
     1187# run_file construction 
    12001188 
    12011189# Then first loop on the components for the coupler ie oasis 
     
    12181206                until [ ${mpi_count} -gt ${comp_proc_mpi_loc} ] ; do 
    12191207                    if ( ${OK_PARA_OMP} ) ; then  
    1220                         echo "env OMP_NUM_THREADS=${comp_proc_omp_loc} ./${ExeNameOut} " >> runfile 
     1208                        echo "env OMP_NUM_THREADS=${comp_proc_omp_loc} ./${ExeNameOut} " >> run_file 
    12211209                    else 
    1222                         echo "./${ExeNameOut}" >> runfile  
     1210                        echo "./${ExeNameOut}" >> run_file  
    12231211                    fi 
    12241212                    (( mpi_count = mpi_count + 1 )) 
     
    12261214            else 
    12271215                if ( ${OK_PARA_OMP} ) ; then  
    1228                     echo "env OMP_NUM_THREADS=${comp_proc_omp_loc} ./${ExeNameOut} " >> runfile 
     1216                    echo "env OMP_NUM_THREADS=${comp_proc_omp_loc} ./${ExeNameOut} " >> run_file 
    12291217                else 
    1230                     echo "./${ExeNameOut} " >> runfile  
     1218                    echo "./${ExeNameOut} " >> run_file  
    12311219                fi 
    12321220            fi 
     
    12521240                until [ ${mpi_count} -gt ${comp_proc_mpi_loc} ] ; do 
    12531241                    if ( ${OK_PARA_OMP} ) ; then  
    1254                         echo "env OMP_NUM_THREADS=${comp_proc_omp_loc} ./${ExeNameOut} " >> runfile 
     1242                        echo "env OMP_NUM_THREADS=${comp_proc_omp_loc} ./${ExeNameOut} " >> run_file 
    12551243                    else 
    1256                         echo "./${ExeNameOut}" >> runfile  
     1244                        echo "./${ExeNameOut}" >> run_file  
    12571245                    fi 
    12581246                    (( mpi_count = mpi_count + 1 )) 
     
    12601248            else 
    12611249                if ( ${OK_PARA_OMP} ) ; then  
    1262                     echo "env OMP_NUM_THREADS=${comp_proc_omp_loc} ./${ExeNameOut} " >> runfile 
     1250                    echo "env OMP_NUM_THREADS=${comp_proc_omp_loc} ./${ExeNameOut} " >> run_file 
    12631251                else 
    1264                     echo "./${ExeNameOut} " >> runfile  
     1252                    # to be tested : no MPI only OpenMP into MPMD mode 
     1253                    echo "./${ExeNameOut} " >> run_file  
    12651254                fi 
    12661255            fi 
     
    12681257    done 
    12691258 
    1270 # update execution command for sequential and parallel cases 
    1271  
    1272     if [ ${PROCESSUS_NUMBER} -gt 1 ] ; then 
    1273        EXECUTION="${EXECUTION} -pgmmodel mpmd -cmdfile ./runfile" 
    1274     else 
    1275        EXECUTION="${EXECUTION} " $( cat ./runfile )  
     1259    EXECUTION="${HOST_MPIRUN_COMMAND} -pgmmodel mpmd -cmdfile ./run_file" 
     1260 
     1261else # Only one executable. launch it. 
     1262 
     1263    for comp in ${config_ListOfComponents[*]} ; do 
     1264 
     1265        eval ExeNameIn=\${config_Executable_${comp}[0]} 
     1266        eval ExeNameOut=\${config_Executable_${comp}[1]} 
     1267        # to suppress "" coming from config.card 
     1268        eval ExeNameToLaunch=${ExeNameOut} 
     1269 
     1270        [ "X${ExeNameToLaunch}" != X ] &&  EXECUTION="time ./${ExeNameToLaunch}" 
     1271 
     1272    done 
     1273 
     1274fi 
     1275 
     1276    IGCM_sys_Chmod u+x run_file 
     1277    if ( $DEBUG_sys ) ; then 
     1278      echo "run_file contains : " 
     1279      cat run_file 
    12761280    fi 
    12771281 
     
    12791283    IGCM_debug_Print 1 "$EXECUTION" 
    12801284 
    1281     IGCM_sys_Chmod u+x runfile  
    1282  
    1283     if ( $DEBUG_sys ) ; then 
    1284         echo "runfile contains : " 
    1285         cat runfile 
    1286     fi 
    1287  
    12881285    IGCM_debug_PopStack "IGCM_sys_build_execution_scripts" 
    12891286} 
    12901287 
    1291  
     1288function IGCM_sys_build_run_file { 
     1289 
     1290IGCM_debug_Print 3 " dummy function : IGCM_sys_build_run_file " 
     1291 
     1292} 
     1293 
Note: See TracChangeset for help on using the changeset viewer.