Ignore:
Timestamp:
06/16/11 12:31:47 (13 years ago)
Author:
mmaipsl
Message:

First version for MPI/OpenMP integration in libIGCM.
Work only on titane for instance.

File:
1 edited

Legend:

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

    r473 r490  
    108108    eval Script_Output_Prefix=${config_UserChoices_Script_Output_Prefix:='Script_Output'} 
    109109    IGCM_debug_Print 3 "Script_Output_Prefix = ${Script_Output_Prefix}" 
    110     eval Exe_Output=out_${config_Executable_Name} 
    111     IGCM_debug_Print 3 "Exe_Output           = ${Exe_Output}" 
     110#MM : obsolete ! 
     111#    eval Exe_Output=out_${config_Executable_Name} 
     112    eval Exe_Output=out_execution 
     113#    IGCM_debug_Print 3 "Exe_Output           = ${Exe_Output}" 
    112114 
    113115    #================================== 
     
    536538    fi 
    537539 
     540    typeset ExeNameIn 
     541    typeset comp i 
     542    typeset tempvar tempvarMPI tempvarNOD NbElts j 
     543 
     544    (( PROCESSUS_NUMBER = 0 )) 
     545    (( i=0 )) 
     546 
     547    OK_PARA_MPI=false 
     548    OK_PARA_OMP=false 
     549    OK_PARA_NOD=false 
     550    for comp in ${config_ListOfComponents[*]} ; do 
     551 
     552        IGCM_debug_Print 1 ${comp} 
     553 
     554        eval ExeNameIn=\${config_Executable_${comp}[0]} 
     555 
     556        # NO order in config.card for parallelized values !  
     557        # just use suffix : MPI , OMP and NOD (for number of NODes.) 
     558 
     559        # NOD is the number of NODes allocated 
     560        eval ${comp}_PROC_NOD=0 
     561 
     562        # MPI is the number of MPI processus per nodes 
     563        eval ${comp}_PROC_MPI=0 
     564 
     565        # OMP is the number of OpenMP threads per MPI processus 
     566        eval ${comp}_PROC_OMP=0 
     567         
     568        # Only if we really have an executable for the component : 
     569        if [ X${ExeNameIn} != X\"\" ] ; then 
     570            eval NbElts=\${#config_Executable_${comp}[@]} 
     571            if [ ${NbElts} -gt 2 ] ; then 
     572                (( j = 2 )) 
     573                eval ${comp}_PROC_MPI=1 
     574                eval ${comp}_PROC_OMP=1 
     575                eval ${comp}_PROC_NOD=1 
     576 
     577                while [ $j -lt ${NbElts} ] ; do  
     578                    eval tempvar=\${config_Executable_${comp}[${j}]} 
     579 
     580                    echo  
     581#MM BUG impossible ?! 
     582                    if [ X${tempvar} == X ] ; then 
     583                        echo "Error reading MPI/OMP parameters !!!"  
     584                        echo "Check your config.card."  
     585                    # MM : à enlever : 
     586                        exit 1 
     587                        #break 
     588                    fi 
     589 
     590# pb                eval ${comp}_PROC_MPI=1 
     591# pb                eval ${comp}_PROC_OMP=1 
     592# pb                eval ${comp}_PROC_NOD=1 
     593 
     594                    eval IGCM_debug_Print 2 ${tempvar} 
     595 
     596                    case ${tempvar} in 
     597                        *MPI) 
     598                            # Read MPI parameter for composante 
     599                            eval ${comp}_PROC_MPI=$( echo ${tempvar} | sed -e "s/MPI//" ) 
     600                            OK_PARA_MPI=true;; 
     601                        *OMP) 
     602                            # Read OMP parameter for composante 
     603                            eval ${comp}_PROC_OMP=$( echo ${tempvar} | sed -e "s/OMP//" ) 
     604                            OK_PARA_OMP=true;; 
     605                        *NOD) 
     606                            # Read NOD (NumBer of Nodes) parameter for composante 
     607                            eval ${comp}_PROC_NOD=$( echo ${tempvar} | sed -e "s/NOD//" ) 
     608                            OK_PARA_NOD=true 
     609                            OK_PARA_MPI=true;; 
     610                    esac 
     611 
     612                    (( j = j + 1 )) 
     613                done 
     614 
     615                eval tempvarMPI=\${${comp}_PROC_MPI} 
     616                eval tempvarNOD=\${${comp}_PROC_NOD} 
     617                eval tempvarOMP=\${${comp}_PROC_OMP} 
     618                (( PROCESSUS_NUMBER = PROCESSUS_NUMBER + tempvarMPI * tempvarNOD * tempvarOMP )) 
     619            fi 
     620        fi 
     621 
     622        (( i=i+1 )) 
     623    done 
     624 
     625    # sequential case ! 
     626    if [ ${PROCESSUS_NUMBER} -eq 0 ] ; then 
     627        (( PROCESSUS_NUMBER = 1 )) 
     628        echo "PROCESSUS_NUMBER is all 0 (sequential use of old definition in config->Executable->list)." 
     629        echo "We set it to 1." 
     630    fi 
     631 
     632    IGCM_debug_Print 1 "MPI/OMP treatment PROCESSUS_NUMBER = ${PROCESSUS_NUMBER}" 
     633 
     634    # Verification with PBS parameter 
     635    if [ X${BATCH_NUM_PROC_TOT} != X ] ; then 
     636        if [ ${BATCH_NUM_PROC_TOT} -ne ${PROCESSUS_NUMBER} ] ; then 
     637            echo "Warning with parallelization parameters !" 
     638            echo "PBS variable BATCH_NUM_PROC_TOT = ${BATCH_NUM_PROC_TOT} " 
     639            echo " is the total number of _processors_ reserved." 
     640            echo "It is not equal to the sum of _processus_ in config.card = ${PROCESSUS_NUMBER}." 
     641        fi 
     642        if ( ! ${OK_PARA_MPI} ) ; then 
     643            if [ ${BATCH_NUM_PROC_TOT} -gt 1 ] ; then 
     644                echo "You have given a reservation of ${BATCH_NUM_PROC_TOT} processors," 
     645                echo "but you havn't filled the parallel parameter in config->Executable->list." 
     646                echo "This is the old method and it is no more supported." 
     647                echo "Please read documentation or config specific comments." 
     648                echo "We stop now." 
     649                exit 1 
     650            else  
     651                PROCESSUS_NUMBER=1 
     652            fi 
     653        fi 
     654    else 
     655        if ( ${OK_PARA_MPI} ) ; then 
     656            echo "You have not given a value of ${BATCH_NUM_PROC_TOT} processors," 
     657            echo "but you have filled the parallel parameter in config->Executable->list." 
     658            echo "This is the old method and it is no more supported." 
     659            echo "Please read documentation or config specific comments." 
     660            echo "We stop now." 
     661            exit 1 
     662        fi 
     663    fi 
     664 
     665#     if ( ${OK_PARA_MPI} || ${OK_PARA_OMP} || ${OK_PARA_NOD} ) ; then 
     666    IGCM_sys_build_execution_scripts 
     667#     fi 
     668 
    538669    ExecutionFail=false 
    539670 
Note: See TracChangeset for help on using the changeset viewer.