Changeset 621 for trunk/libIGCM/libIGCM_sys
- Timestamp:
- 03/30/12 15:42:12 (12 years ago)
- Location:
- trunk/libIGCM/libIGCM_sys
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libIGCM/libIGCM_sys/libIGCM_sys_mercurex9.ksh
r618 r621 1478 1478 1479 1479 ############################################################ 1480 # Build run file 1480 # Build MPI/OMP scripts 1481 function 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 1567 else # 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 1578 fi 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 } 1481 1586 1482 1587 function 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 1589 IGCM_debug_Print 3 " dummy function : IGCM_sys_build_run_file " 1590 1591 } -
trunk/libIGCM/libIGCM_sys/libIGCM_sys_titane.ksh
r618 r621 1663 1663 echo "IGCM_sys_activ_variables" 1664 1664 fi 1665 ulimit -s 2097152 1665 1666 typeset max_omp 1667 1668 ulimit -s unlimited 1669 1670 (( max_omp = 0 )) 1671 for comp in ${config_ListOfComponents[*]} ; do 1672 1673 eval ExeNameIn=\${config_Executable_${comp}[0]} 1674 eval ExeNameOut=\${config_Executable_${comp}[1]} 1675 1676 # Only if we really have an executable for the component : 1677 if ( [ "X${ExeNameOut}" != X\"\" ] && [ "X${comp}" != "XCPL" ] ) ; then 1678 eval comp_proc_omp_loc=\${${comp}_PROC_OMP} 1679 if [ ${comp_proc_omp_loc} -gt ${max_omp} ] ; then 1680 (( max_omp = comp_proc_omp_loc )) 1681 fi 1682 fi 1683 done 1684 if [ ${max_omp} -gt 1 ] ; then 1685 module load openmp/${max_omp}thds 1686 fi 1687 1666 1688 IGCM_debug_PopStack "IGCM_sys_activ_variables" 1667 1689 } … … 1679 1701 1680 1702 ############################################################ 1681 # Build run file1703 # Build MPI/OMP scripts run file (dummy function) 1682 1704 1683 1705 function IGCM_sys_build_run_file { 1684 IGCM_debug_PushStack "IGCM_sys_build_run_file" $@ 1685 if ( $DEBUG_sys ) ; then 1686 echo "IGCM_sys_build_run_file " $@ 1687 fi 1688 1689 # set Number of processors for OCE here 1690 NUM_PROC_OCE=5 1691 1692 (( NUM_PROC_ATM = $BATCH_NUM_PROC_TOT - NUM_PROC_OCE - 1)) 1693 (( nb_tot_m1 = $BATCH_NUM_PROC_TOT - NUM_PROC_OCE )) 1694 if [ $1 = MPI1 ]; then 1695 cat <<EOF > run_file 1696 -np 1 ./oasis 1697 -np ${NUM_PROC_ATM} ./lmdz.x 1698 -np ${NUM_PROC_OCE} ./opa.xx 1699 EOF 1700 config_UserChoices_JobRunOptions='"--app"' 1701 IGCM_sys_Chmod u+x run_file 1702 fi 1703 IGCM_debug_PopStack "IGCM_sys_build_run_file" 1704 1706 1707 IGCM_debug_Print 3 " dummy function : IGCM_sys_build_run_file " 1708 1709 } 1710 1711 ############################################################ 1712 # Build MPI/OMP scripts 1713 function IGCM_sys_build_execution_scripts 1714 { 1715 IGCM_debug_PushStack "IGCM_sys_build_execution_scripts" $@ 1716 if ( $DEBUG_sys ) ; then 1717 echo "IGCM_sys_build_execution_scripts " $@ 1718 fi 1719 typeset nodes listnodes init_node start_num init_exec comp ExeNameIn ExeNameOut 1720 typeset node_num_current node_current comp_proc_mpi_loc comp_proc_omp_loc 1721 typeset num_corempi nombre_restant_node nombre_restant_comp 1722 1723 if [ ! -f ${SUBMIT_DIR}/Job_${config_UserChoices_JobName} ] ; then 1724 IGCM_debug_Exit "IGCM_sys_titane build_execution_scripts : Job_${config_UserChoices_JobName} doesn't exist in SUBMIT_DIR : ${SUBMIT_DIR} " 1725 fi 1726 1727 if ( ${OK_PARA_MPMD} ) ; then 1728 1729 if [ -f run_file ] ; then 1730 IGCM_sys_Rm -f run_file 1731 fi 1732 touch run_file 1733 1734 if ( ${OK_PARA_OMP} ) ; then 1735 1736 # Hosts treatment 1737 1738 ${HOST_MPIRUN_COMMAND} hostname | sort | uniq > hosts.tmp 1739 1740 i=0 1741 rm -f hosts 1742 IGCM_debug_Print 1 "sys Titane, Hosts avaible :" 1743 for nodes in `cat hosts.tmp` ; do 1744 host[$i]=$nodes 1745 echo "${host[$i]} slots=8 max_slots=8" >> hosts 1746 IGCM_debug_Print 1 ${host[$i]} 1747 i=$((i+1)) 1748 done 1749 rm -f hosts.tmp 1750 1751 listnodes=${host[*]} 1752 1753 EXECUTION="${HOST_MPIRUN_COMMAND} -hostfile hosts" 1754 1755 # Initialisation 1756 1757 init_node=y 1758 node_num_current=0 1759 start_num=0 1760 init_exec=n 1761 1762 # Test : if oasis is there, we put it at the first position 1763 1764 for comp in ${config_ListOfComponents[*]} ; do 1765 1766 if [ "X${comp}" = "XCPL" ] ; then 1767 1768 eval ExeNameIn=\${config_Executable_${comp}[0]} 1769 eval ExeNameOut=\${config_Executable_${comp}[1]} 1770 1771 echo "#!/bin/ksh" > script_${ExeNameOut}.ksh 1772 echo "" >> script_${ExeNameOut}.ksh 1773 echo "export KMP_STACKSIZE=3g" >> script_${ExeNameOut}.ksh 1774 echo "export KMP_LIBRARY=turnaround" >> script_${ExeNameOut}.ksh 1775 echo "export MKL_SERIAL=YES" >> script_${ExeNameOut}.ksh 1776 echo "./${ExeNameOut} > out_${ExeNameOut}.out 2>out_${ExeNameOut}.err" >> script_${ExeNameOut}.ksh 1777 IGCM_sys_Chmod u+x script_${ExeNameOut}.ksh 1778 1779 init_node=n 1780 1781 (( nombre_restant_node = NUM_COREPERNODE - 1 )) 1782 node_num_current=0 1783 node_current=${host[${node_num_current}]} 1784 1785 EXECUTION="${EXECUTION} -H ${node_current} -np 1 ./script_${ExeNameOut}.ksh" 1786 1787 init_exec=y 1788 start_num=1 1789 1790 fi 1791 1792 done 1793 1794 # Then loop on the components (except for oasis) 1795 1796 for comp in ${config_ListOfComponents[*]} ; do 1797 1798 eval ExeNameIn=\${config_Executable_${comp}[0]} 1799 eval ExeNameOut=\${config_Executable_${comp}[1]} 1800 1801 # Only if we really have an executable for the component : 1802 if ( [ "X${ExeNameOut}" != X\"\" ] && [ "X${comp}" != "XCPL" ] ) ; then 1803 1804 eval comp_proc_mpi_loc=\${${comp}_PROC_MPI} 1805 eval comp_proc_omp_loc=\${${comp}_PROC_OMP} 1806 1807 echo "#!/bin/ksh" > script_${ExeNameOut}.ksh 1808 # echo "set -vx" >> script_${ExeNameOut}.ksh 1809 echo "" >> script_${ExeNameOut}.ksh 1810 echo "export KMP_STACKSIZE=3g" >> script_${ExeNameOut}.ksh 1811 echo "export KMP_LIBRARY=turnaround" >> script_${ExeNameOut}.ksh 1812 echo "export MKL_SERIAL=YES" >> script_${ExeNameOut}.ksh 1813 echo "OMP_NUM_THREADS=${comp_proc_omp_loc}" >> script_${ExeNameOut}.ksh 1814 echo "(( MYMPIRANK = OMPI_COMM_WORLD_RANK - ${start_num})) " >> script_${ExeNameOut}.ksh 1815 echo "./${ExeNameOut} > out_${ExeNameOut}.out.\${MYMPIRANK} 2>out_${ExeNameOut}.err.\${MYMPIRANK}" >> script_${ExeNameOut}.ksh 1816 IGCM_sys_Chmod u+x script_${ExeNameOut}.ksh 1817 1818 node_num=0 1819 1820 # We define the number of MPI process to be assigned for the component 1821 1822 nombre_restant_comp=${comp_proc_mpi_loc} 1823 1824 # Loop on the allocated nodes 1825 1826 for node in ${listnodes} ; do 1827 1828 # We go to the current node 1829 if [ ${node_num} = ${node_num_current} ] ; then 1830 1831 node_current=${host[${node_num_current}]} 1832 1833 # If first time on the node : initialisation 1834 1835 if [ ${init_node} = y ] ; then 1836 nombre_restant_node=${NUM_COREPERNODE} 1837 fi 1838 1839 # Test on the number of OMP threads 1840 1841 if [ ${comp_proc_omp_loc} -gt ${nombre_restant_node} ] ; then 1842 (( node_num = node_num + 1 )) 1843 node_num_current=${node_num} 1844 init_node=y 1845 continue 1846 fi 1847 1848 # Number of MPI process to assign 1849 1850 (( num_corempi = nombre_restant_node / comp_proc_omp_loc )) 1851 1852 if [ ${num_corempi} -gt ${nombre_restant_comp} ] ; then 1853 num_corempi=${nombre_restant_comp} 1854 fi 1855 1856 (( nombre_restant_node = nombre_restant_node - num_corempi * comp_proc_omp_loc )) 1857 (( nombre_restant_comp = nombre_restant_comp - num_corempi )) 1858 1859 if [ ${init_exec} = y ] ; then 1860 EXECUTION="${EXECUTION} : -H ${node_current} -np ${num_corempi} ./script_${ExeNameOut}.ksh" 1861 else 1862 EXECUTION="${EXECUTION} -H ${node_current} -np ${num_corempi} ./script_${ExeNameOut}.ksh" 1863 init_exec=y 1864 fi 1865 1866 (( start_num = num_corempi + start_num )) 1867 1868 else 1869 1870 (( node_num = node_num + 1 )) 1871 continue 1872 fi 1873 1874 # Test on the number of core/process remaining on the node/component 1875 1876 if [ ${nombre_restant_node} = 0 ] ; then 1877 (( node_num = node_num + 1 )) 1878 node_num_current=${node_num} 1879 init_node=y 1880 1881 if [ ${nombre_restant_comp} = 0 ] ; then 1882 break 1 1883 fi 1884 else 1885 1886 node_num_current=${node_num} 1887 init_node=n 1888 1889 if [ ${nombre_restant_comp} = 0 ] ; then 1890 break 1 1891 fi 1892 fi 1893 done 1894 fi 1895 done 1896 1897 else 1898 1899 # Then first loop on the components for the coupler ie oasis 1900 1901 ## the coupler ie oasis must be the first one 1902 for comp in ${config_ListOfComponents[*]} ; do 1903 1904 eval ExeNameOut=\${config_Executable_${comp}[1]} 1905 1906 # for CPL component only 1907 if [ "X${comp}" = "XCPL" ] ; then 1908 eval comp_proc_mpi_loc=\${${comp}_PROC_MPI} 1909 echo "-np ${comp_proc_mpi_loc} ./${ExeNameOut} " >> run_file 1910 fi 1911 done 1912 1913 # Then second loop on the components 1914 1915 for comp in ${config_ListOfComponents[*]} ; do 1916 1917 eval ExeNameOut=\${config_Executable_${comp}[1]} 1918 1919 # Only if we really have an executable for the component and not the coupler ie oasis: 1920 if ( [ "X${ExeNameOut}" != X\"\" ] && [ "X${comp}" != "XCPL" ] ) ; then 1921 eval comp_proc_mpi_loc=\${${comp}_PROC_MPI} 1922 echo "-np ${comp_proc_mpi_loc} ./${ExeNameOut} " >> run_file 1923 fi 1924 done 1925 IGCM_sys_Chmod u+x run_file 1926 1927 EXECUTION="${HOST_MPIRUN_COMMAND} --app ./run_file" 1928 1929 fi 1930 1931 else # Only one executable. launch it. 1932 1933 for comp in ${config_ListOfComponents[*]} ; do 1934 1935 # Only if we really have an executable for the component : 1936 eval ExeNameOut=\${config_Executable_${comp}[1]} 1937 if ( [ "X${ExeNameOut}" != X\"\" ] ) ; then 1938 1939 echo "#!/bin/ksh" > script_${ExeNameOut}.ksh 1940 echo "" >> script_${ExeNameOut}.ksh 1941 if ( ${OK_PARA_OMP} ) ; then 1942 eval comp_proc_omp_loc=\${${comp}_PROC_OMP} 1943 echo "OMP_NUM_THREADS=${comp_proc_omp_loc}" >> script_${ExeNameOut}.ksh 1944 fi 1945 if ( ${OK_PARA_MPI} ) ; then 1946 # Default : mpirun used if nb_proc gt 1 1947 # pour sortie out/err par process 1948 # echo "./${ExeNameOut} > out_${ExeNameOut}.out.\${OMPI_COMM_WORLD_RANK} 2>out_${ExeNameOut}.err.\${OMPI_COMM_WORLD_RANK}" >> script_${ExeNameOut}.ksh 1949 echo "./${ExeNameOut}" >> script_${ExeNameOut}.ksh 1950 IGCM_sys_Chmod u+x script_${ExeNameOut}.ksh 1951 EXECUTION="${HOST_MPIRUN_COMMAND} ./script_${ExeNameOut}.ksh" 1952 else 1953 # Default : mpirun is NOT used if nb_proc eq 1 1954 # pour sortie out/err par process 1955 # echo "./${ExeNameOut} > out_${ExeNameOut}.out 2>out_${ExeNameOut}.err" >> script_${ExeNameOut}.ksh 1956 echo "./${ExeNameOut}" >> script_${ExeNameOut}.ksh 1957 IGCM_sys_Chmod u+x script_${ExeNameOut}.ksh 1958 EXECUTION="time ./script_${ExeNameOut}.ksh" 1959 fi 1960 fi 1961 done 1962 1963 fi 1964 1965 IGCM_debug_Print 1 "sys Titane : La commande d execution est " 1966 IGCM_debug_Print 1 $EXECUTION 1967 1968 IGCM_debug_PopStack "IGCM_sys_build_execution_scripts" 1705 1969 } 1706 1970
Note: See TracChangeset
for help on using the changeset viewer.