Ignore:
Timestamp:
03/30/12 15:42:12 (12 years ago)
Author:
sdipsl
Message:
  • I messed up the merge (episode 2 : it will be at least a trilogy) mercure sx9 and titane
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libIGCM/libIGCM_sys/libIGCM_sys_mercurex9.ksh

    r618 r621  
    14781478 
    14791479############################################################ 
    1480 # Build run file 
     1480# Build MPI/OMP scripts 
     1481function IGCM_sys_build_execution_scripts  
     1482{ 
     1483    IGCM_debug_PushStack "IGCM_sys_build_execution_scripts" $@ 
     1484    if ( $DEBUG_sys ) ; then 
     1485        echo "IGCM_sys_build_execution_scripts " $@ 
     1486    fi 
     1487 
     1488    typeset NbNodes_Job NbProc_Job comp_proc_mpi_loc comp_proc_omp_loc mpi_count 
     1489     
     1490    if [ ! -f ${SUBMIT_DIR}/Job_${config_UserChoices_JobName} ]  ; then 
     1491        IGCM_debug_Exit "IGCM_sys_mercurex9 build_execution_scripts : Job_${config_UserChoices_JobName} don't exist in SUBMIT_DIR : ${SUBMIT_DIR} " 
     1492    fi 
     1493 
     1494    if ( ${OK_PARA_MPMD} ) ; then 
     1495 
     1496        if [ -f run_file ] ; then 
     1497            IGCM_sys_Rm -f run_file 
     1498        fi 
     1499        touch run_file 
     1500 
     1501        if ( ${OK_PARA_OMP} ) ; then 
     1502                IGCM_debug_Print 2 "Error in config.card on SX9 : OpenMP not available" 
     1503                exit 1 
     1504        else 
     1505# OLD : 
     1506#PBS -v BATCH_NUM_PROC_TOT=4 
     1507#PBS -l cpunum_job=${BATCH_NUM_PROC_TOT} 
     1508            echo "Job_${config_UserChoices_JobName} includes BATCH_NUM_PROC_TOT = \c" 
     1509            cat ${SUBMIT_DIR}/Job_${config_UserChoices_JobName} | grep -- "-v *BATCH_NUM_PROC_TOT" | sed -e "s/.*BATCH_NUM_PROC_TOT *= *//"  
     1510            NbProc_Job=$( cat ${SUBMIT_DIR}/Job_${config_UserChoices_JobName} | grep -- "-v *BATCH_NUM_PROC_TOT" | sed -e "s/.*BATCH_NUM_PROC_TOT *= *//" ) 
     1511            NbProc_Job=${NbProc_Job:=0} 
     1512            if [ ${NbProc_Job} -eq 0 ] ; then 
     1513                IGCM_debug_Print 2 "Error in Job_${config_UserChoices_JobName} ressources : no BATCH_NUM_PROC_TOT defined with MPI only run." 
     1514                exit 1 
     1515            fi 
     1516        fi 
     1517 
     1518# run_file construction 
     1519 
     1520# Then first loop on the components for the coupler ie oasis 
     1521 
     1522### the coupler ie oasis must be the first one 
     1523    for comp in ${config_ListOfComponents[*]} ; do 
     1524         
     1525        eval ExeNameIn=\${config_Executable_${comp}[0]} 
     1526        eval ExeNameOut=\${config_Executable_${comp}[1]} 
     1527             
     1528        # for CPL component only 
     1529        if [ "X${comp}" = "XCPL" ] ; then 
     1530 
     1531            eval comp_proc_mpi_loc=\${${comp}_PROC_MPI} 
     1532            eval comp_proc_omp_loc=\${${comp}_PROC_OMP} 
     1533             
     1534            if ( ${OK_PARA_MPI} ) ; then  
     1535                echo "-p ${comp_proc_mpi_loc} -e ./${ExeNameOut}" >> run_file  
     1536            fi 
     1537        fi 
     1538    done 
     1539 
     1540# Then second loop on the components 
     1541 
     1542    for comp in ${config_ListOfComponents[*]} ; do 
     1543         
     1544        eval ExeNameIn=\${config_Executable_${comp}[0]} 
     1545        eval ExeNameOut=\${config_Executable_${comp}[1]} 
     1546             
     1547        # Only if we really have an executable for the component and not the coupler ie oasis: 
     1548        if ( [ "X${ExeNameOut}" != X\"\" ] && [ "X${comp}" != "XCPL" ] ) ; then 
     1549 
     1550            eval comp_proc_mpi_loc=\${${comp}_PROC_MPI} 
     1551            eval comp_proc_omp_loc=\${${comp}_PROC_OMP} 
     1552             
     1553            if ( ${OK_PARA_MPI} ) ; then  
     1554                    echo "-p ${comp_proc_mpi_loc} -e ./${ExeNameOut}" >> run_file  
     1555            fi 
     1556        fi 
     1557    done 
     1558 
     1559    EXECUTION="${HOST_MPIRUN_COMMAND} -f ./run_file" 
     1560 
     1561    IGCM_sys_Chmod u+x run_file 
     1562    if ( $DEBUG_sys ) ; then 
     1563      echo "run_file contains : " 
     1564      cat run_file 
     1565    fi 
     1566 
     1567else # Only one executable. launch it. 
     1568 
     1569    for comp in ${config_ListOfComponents[*]} ; do 
     1570 
     1571        eval ExeNameIn=\${config_Executable_${comp}[0]} 
     1572        eval ExeNameOut=\${config_Executable_${comp}[1]} 
     1573 
     1574        [ "X${ExeNameOut}" != X\"\" ] &&  EXECUTION="time mpirun -np ${BATCH_NUM_PROC_TOT} ./${ExeNameOut}" 
     1575 
     1576    done 
     1577 
     1578fi 
     1579 
     1580    IGCM_debug_Print 1 "sys mercurex9 : execution command is " 
     1581    IGCM_debug_Print 1 "$EXECUTION" 
     1582 
     1583    IGCM_debug_PopStack "IGCM_sys_build_execution_scripts" 
     1584 
     1585} 
    14811586 
    14821587function IGCM_sys_build_run_file { 
    1483   IGCM_debug_PushStack "IGCM_sys_build_run_file" $@ 
    1484   if ( $DEBUG_sys ) ; then 
    1485     echo "IGCM_sys_build_run_file " $@ 
    1486   fi 
    1487   (( NUM_PROC_ATM = BATCH_NUM_PROC_TOT - 1 )) 
    1488   (( NUM_PROC_OASIS = BATCH_NUM_PROC_TOT - NUM_PROC_ATM )) 
    1489   (( NUM_PROC_OCE = BATCH_NUM_PROC_TOT - NUM_PROC_ATM )) 
    1490    
    1491   if [ $1 = MPI2 ]; then 
    1492     cat <<EOF > run_file 
    1493 -p 1 -np 1 -e ./oasis 
    1494 EOF 
    1495     (( NUM_PROCESS = BATCH_NUM_PROC_TOT + 1 )) 
    1496     config_UserChoices_JobRunOptions='"-max_np ${NUM_PROCESS} -f"' 
    1497  
    1498   elif [ $1 = MPI1 ]; then 
    1499     cat <<EOF > run_file 
    1500 -p $NUM_PROC_OASIS -e ./oasis 
    1501 -p $NUM_PROC_ATM -e ./lmdz.x 
    1502 -p $NUM_PROC_OCE -e ./opa.xx 
    1503 EOF 
    1504   fi 
    1505   IGCM_debug_PopStack "IGCM_sys_build_run_file" 
    1506 } 
     1588 
     1589IGCM_debug_Print 3 " dummy function : IGCM_sys_build_run_file " 
     1590 
     1591} 
Note: See TracChangeset for help on using the changeset viewer.