Changeset 556 for branches/libIGCM_MPI_OpenMP
- Timestamp:
- 02/21/12 19:25:29 (12 years ago)
- Location:
- branches/libIGCM_MPI_OpenMP
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/libIGCM_MPI_OpenMP/libIGCM_config/libIGCM_config.ksh
r493 r556 538 538 fi 539 539 540 typeset ExeNameIn 540 typeset ExeNameIn ExeNameFirst CompNameFirst 541 541 typeset comp i 542 typeset tempvar tempvarMPI tempvarNOD NbElts j 542 typeset tempvar tempvarMPI tempvarNOD NbElts j NbExec 543 543 544 544 (( PROCESSUS_NUMBER = 0 )) 545 545 (( i=0 )) 546 (( NbExec=0 )) 546 547 547 548 OK_PARA_MPI=false 548 549 OK_PARA_OMP=false 549 550 OK_PARA_NOD=false 551 OK_PARA_MPMD=false 552 550 553 for comp in ${config_ListOfComponents[*]} ; do 551 554 … … 568 571 # Only if we really have an executable for the component : 569 572 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 570 586 eval NbElts=\${#config_Executable_${comp}[@]} 587 571 588 if [ ${NbElts} -ge 2 ] ; then 572 589 (( j = 2 )) 573 eval ${comp}_PROC_MPI=1574 eval ${comp}_PROC_OMP=1575 eval ${comp}_PROC_NOD=1576 590 577 591 while [ $j -lt ${NbElts} ] ; do … … 591 605 592 606 case ${tempvar} in 593 * MPI)607 *[mM][pP][iI]*) 594 608 # Read MPI parameter for composante 595 609 eval ${comp}_PROC_MPI=$( echo ${tempvar} | sed -e "s/MPI//" ) 596 610 OK_PARA_MPI=true;; 597 * OMP)611 *[oO][mM][pP]*) 598 612 # Read OMP parameter for composante 599 613 eval ${comp}_PROC_OMP=$( echo ${tempvar} | sed -e "s/OMP//" ) 600 614 OK_PARA_OMP=true;; 601 * NOD)615 *[nN][oO][dD]*) 602 616 # Read NOD (NumBer of Nodes) parameter for composante 603 617 eval ${comp}_PROC_NOD=$( echo ${tempvar} | sed -e "s/NOD//" ) … … 609 623 done 610 624 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 ))615 625 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 616 633 fi 617 634 … … 619 636 done 620 637 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. 631 642 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 638 644 if ( ! ${OK_PARA_MPI} ) ; then 645 # with previous method. 639 646 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 646 663 else 647 664 PROCESSUS_NUMBER=1 648 665 fi 649 666 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="" 651 678 if ( ${OK_PARA_MPI} ) ; then 652 679 echo "You have not given a value of ${BATCH_NUM_PROC_TOT} processors," 653 680 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." 656 682 echo "We stop now." 657 683 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}" 660 695 661 696 # if ( ${OK_PARA_MPI} || ${OK_PARA_OMP} || ${OK_PARA_NOD} ) ; then -
branches/libIGCM_MPI_OpenMP/libIGCM_sys/libIGCM_sys_vargas.ksh
r499 r556 1138 1138 typeset NbNodes_Job NbProc_Job comp_proc_mpi_loc comp_proc_omp_loc mpi_count 1139 1139 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 1158 1151 if ( ${OK_PARA_OMP} ) ; then 1159 1152 # NEW : 2 Noeuds … … 1191 1184 fi 1192 1185 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 1200 1188 1201 1189 # Then first loop on the components for the coupler ie oasis … … 1218 1206 until [ ${mpi_count} -gt ${comp_proc_mpi_loc} ] ; do 1219 1207 if ( ${OK_PARA_OMP} ) ; then 1220 echo "env OMP_NUM_THREADS=${comp_proc_omp_loc} ./${ExeNameOut} " >> run file1208 echo "env OMP_NUM_THREADS=${comp_proc_omp_loc} ./${ExeNameOut} " >> run_file 1221 1209 else 1222 echo "./${ExeNameOut}" >> run file1210 echo "./${ExeNameOut}" >> run_file 1223 1211 fi 1224 1212 (( mpi_count = mpi_count + 1 )) … … 1226 1214 else 1227 1215 if ( ${OK_PARA_OMP} ) ; then 1228 echo "env OMP_NUM_THREADS=${comp_proc_omp_loc} ./${ExeNameOut} " >> run file1216 echo "env OMP_NUM_THREADS=${comp_proc_omp_loc} ./${ExeNameOut} " >> run_file 1229 1217 else 1230 echo "./${ExeNameOut} " >> run file1218 echo "./${ExeNameOut} " >> run_file 1231 1219 fi 1232 1220 fi … … 1252 1240 until [ ${mpi_count} -gt ${comp_proc_mpi_loc} ] ; do 1253 1241 if ( ${OK_PARA_OMP} ) ; then 1254 echo "env OMP_NUM_THREADS=${comp_proc_omp_loc} ./${ExeNameOut} " >> run file1242 echo "env OMP_NUM_THREADS=${comp_proc_omp_loc} ./${ExeNameOut} " >> run_file 1255 1243 else 1256 echo "./${ExeNameOut}" >> run file1244 echo "./${ExeNameOut}" >> run_file 1257 1245 fi 1258 1246 (( mpi_count = mpi_count + 1 )) … … 1260 1248 else 1261 1249 if ( ${OK_PARA_OMP} ) ; then 1262 echo "env OMP_NUM_THREADS=${comp_proc_omp_loc} ./${ExeNameOut} " >> run file1250 echo "env OMP_NUM_THREADS=${comp_proc_omp_loc} ./${ExeNameOut} " >> run_file 1263 1251 else 1264 echo "./${ExeNameOut} " >> runfile 1252 # to be tested : no MPI only OpenMP into MPMD mode 1253 echo "./${ExeNameOut} " >> run_file 1265 1254 fi 1266 1255 fi … … 1268 1257 done 1269 1258 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 1261 else # 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 1274 fi 1275 1276 IGCM_sys_Chmod u+x run_file 1277 if ( $DEBUG_sys ) ; then 1278 echo "run_file contains : " 1279 cat run_file 1276 1280 fi 1277 1281 … … 1279 1283 IGCM_debug_Print 1 "$EXECUTION" 1280 1284 1281 IGCM_sys_Chmod u+x runfile1282 1283 if ( $DEBUG_sys ) ; then1284 echo "runfile contains : "1285 cat runfile1286 fi1287 1288 1285 IGCM_debug_PopStack "IGCM_sys_build_execution_scripts" 1289 1286 } 1290 1287 1291 1288 function IGCM_sys_build_run_file { 1289 1290 IGCM_debug_Print 3 " dummy function : IGCM_sys_build_run_file " 1291 1292 } 1293
Note: See TracChangeset
for help on using the changeset viewer.