Changeset 616 for trunk/libIGCM/libIGCM_config
- Timestamp:
- 03/29/12 10:56:09 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libIGCM/libIGCM_config/libIGCM_config.ksh
r591 r616 603 603 fi 604 604 605 typeset ExeNameIn ExeNameFirst CompNameFirst 606 typeset comp i 607 typeset tempvar tempvarMPI tempvarNOD NbElts j NbExec 608 609 (( PROCESSUS_NUMBER = 0 )) 610 (( i=0 )) 611 (( NbExec=0 )) 612 613 OK_PARA_MPI=false 614 OK_PARA_OMP=false 615 OK_PARA_NOD=false 616 OK_PARA_MPMD=false 617 618 for comp in ${config_ListOfComponents[*]} ; do 619 620 IGCM_debug_Print 1 ${comp} 621 622 eval ExeNameIn=\${config_Executable_${comp}[0]} 623 624 # NO order in config.card for parallelized values ! 625 # just use suffix : MPI , OMP and NOD (for number of NODes.) 626 627 # NOD is the number of NODes allocated 628 eval ${comp}_PROC_NOD=0 629 630 # MPI is the number of MPI processus per nodes 631 eval ${comp}_PROC_MPI=0 632 633 # OMP is the number of OpenMP threads per MPI processus 634 eval ${comp}_PROC_OMP=0 635 636 # Only if we really have an executable for the component : 637 if [ X${ExeNameIn} != X\"\" ] ; then 638 639 # Keep the first executable found and the first CompName 640 ExeNameFirst=${ExeNameIn} 641 CompNameFirst=${comp} 642 643 # Are we a second executable? 644 (( NbExec = NbExec + 1 )) 645 646 # set 1 MPI task, 1 OpenMP thread and 1 node as default 647 eval ${comp}_PROC_MPI=1 648 eval ${comp}_PROC_OMP=1 649 eval ${comp}_PROC_NOD=1 650 651 eval NbElts=\${#config_Executable_${comp}[@]} 652 653 if [ ${NbElts} -ge 2 ] ; then 654 (( j = 2 )) 655 656 while [ $j -lt ${NbElts} ] ; do 657 eval tempvar=\${config_Executable_${comp}[${j}]} 658 659 if [ X${tempvar} = X ] ; then 660 echo "Error reading MPI/OMP parameters !!!" 661 echo "Check your config.card." 662 exit 1 663 fi 664 665 eval IGCM_debug_Print 2 ${tempvar} 666 667 case ${tempvar} in 668 *[mM][pP][iI]*) 669 # Read MPI parameter for composante 670 eval ${comp}_PROC_MPI=$( echo ${tempvar} | tr '[a-z]' '[A-Z]' | sed -e "s/MPI//" ) 671 OK_PARA_MPI=true;; 672 *[oO][mM][pP]*) 673 # Read OMP parameter for composante 674 eval ${comp}_PROC_OMP=$( echo ${tempvar} | tr '[a-z]' '[A-Z]' | sed -e "s/OMP//" ) 675 OK_PARA_OMP=true;; 676 *[nN][oO][dD]*) 677 # Read NOD (NumBer of Nodes) parameter for composante 678 eval ${comp}_PROC_NOD=$( echo ${tempvar} | tr '[a-z]' '[A-Z]' | sed -e "s/NOD//" ) 679 OK_PARA_NOD=true 680 OK_PARA_MPI=true;; 681 esac 682 683 (( j = j + 1 )) 684 done 685 686 fi 687 688 eval tempvarMPI=\${${comp}_PROC_MPI} 689 eval tempvarNOD=\${${comp}_PROC_NOD} 690 eval tempvarOMP=\${${comp}_PROC_OMP} 691 692 (( PROCESSUS_NUMBER = PROCESSUS_NUMBER + tempvarMPI * tempvarNOD * tempvarOMP )) 693 694 fi 695 696 (( i=i+1 )) 697 done 698 699 # set MPMD mode if more than 2 executable names. 700 [ ${NbExec} -ge 2 ] && OK_PARA_MPMD=true 701 702 # Verification of BATCH_NUM_PROC_TOT total number of processors set in job header. 703 if [ X${BATCH_NUM_PROC_TOT} != X ] ; then 704 # BATCH_NUM_PROC_TOT is set 705 if ( ${OK_PARA_MPI} ) ; then 706 IGCM_debug_Print 1 "MPI/OMP/NOD found into config.card and BATCH_NUM_PROC_TOT = ${BATCH_NUM_PROC_TOT} " 707 else 708 # with previous method. 709 if [ ${BATCH_NUM_PROC_TOT} -gt 1 ] ; then 710 # with more than 1 proc 711 if ( ${OK_PARA_MPMD} ) ; then 712 # with MPMD ie CPL/oasis method 713 echo "We will use default number of MPI tasks for this machine : " 714 echo "${DEFAULT_NUM_PROC_OCE} for OCE; " 715 echo "${DEFAULT_NUM_PROC_CPL} for CPL; " 716 echo "${DEFAULT_NUM_PROC_ATM} for ATM; " 717 echo "${DEFAULT_NUM_PROC_TOTAL} for the total number of processors; " 718 OK_PARA_MPI=true 719 CPL_PROC_MPI=${DEFAULT_NUM_PROC_CPL} 720 OCE_PROC_MPI=${DEFAULT_NUM_PROC_OCE} 721 ATM_PROC_MPI=${DEFAULT_NUM_PROC_ATM} 722 NUM_PROC_CPL=${DEFAULT_NUM_PROC_CPL} # for backward compatibility 723 NUM_PROC_OCE=${DEFAULT_NUM_PROC_OCE} # for backward compatibility 724 NUM_PROC_ATM=${DEFAULT_NUM_PROC_ATM} # for backward compatibility 725 PROCESSUS_NUMBER=${DEFAULT_NUM_PROC_TOTAL} 726 else 727 # with have only one executable 728 echo "We will use ${BATCH_NUM_PROC_TOT} MPI tasks for ${CompNameFirst} : ${config_Executable_Name} " 729 OK_PARA_MPI=true 730 eval ${CompNameFirst}_PROC_MPI=${BATCH_NUM_PROC_TOT} 731 PROCESSUS_NUMBER=${BATCH_NUM_PROC_TOT} 732 fi 733 else 734 PROCESSUS_NUMBER=1 735 fi 736 fi 737 # Verification with PBS parameter 738 if [ ${BATCH_NUM_PROC_TOT} -ne ${PROCESSUS_NUMBER} ] ; then 739 echo "Warning with parallelization parameters !" 740 echo "Job header variable BATCH_NUM_PROC_TOT = ${BATCH_NUM_PROC_TOT} " 741 echo "is the total number of _processors_ reserved." 742 echo "It is not equal to the sum of _processus_ = ${PROCESSUS_NUMBER}." 743 echo "We stop now." 744 exit 1 745 fi 746 else # BATCH_NUM_PROC_TOT="" 747 if ( ${OK_PARA_MPI} ) ; then 748 echo "You have not given a value of ${BATCH_NUM_PROC_TOT} processors," 749 echo "but you have filled the parallel parameter in config->Executable->list." 750 echo "Please add BATCH_NUM_PROC_TOT variable in job header." 751 echo "We stop now." 752 exit 1 753 else 754 # sequential case ! 755 if [ ${PROCESSUS_NUMBER} -eq 0 ] ; then 756 (( PROCESSUS_NUMBER = 1 )) 757 echo "PROCESSUS_NUMBER is all 0 (sequential use of old definition in config->Executable->list)." 758 echo "We set it to 1." 759 fi 760 fi 761 fi 762 763 IGCM_debug_Print 1 "MPI/OMP treatment PROCESSUS_NUMBER = ${PROCESSUS_NUMBER}" 764 765 IGCM_sys_build_execution_scripts 766 605 767 ExecutionFail=false 606 768
Note: See TracChangeset
for help on using the changeset viewer.