Changeset 623 for trunk/libIGCM/libIGCM_sys/libIGCM_sys_titane.ksh
- Timestamp:
- 03/30/12 16:57:50 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libIGCM/libIGCM_sys/libIGCM_sys_titane.ksh
r621 r623 14 14 #========================================================= 15 15 # The documentation of this file can be automatically generated 16 # if you use the prefix #D- for comments to be extracted. 16 # if you use the prefix #D- for comments to be extracted. 17 17 # Extract with command: cat lib* | grep "^#D-" | cut -c "4-" 18 18 #========================================================= … … 22 22 #D-#================================================== 23 23 #D- 24 #D- This ksh library if a layer under some usefull 24 #D- This ksh library if a layer under some usefull 25 25 #D-environment variables and shell commands. 26 26 #D-All those definitions depend on host particularities. … … 42 42 # YOU MUST COMPILE YOUR EXE FILES FOR DRYRUN MODE ! 43 43 # ------------------------------------------------------------------------------------- 44 # | DRYRUN= | Date computations, | sys_Get| Exe | sys_Put_Out; sys_Put_Rest |45 # | | Cp/Exe param files || Chmod | |46 # | | Qsub | 44 # | DRYRUN= | Date computations, | sys_Get | Exe | sys_Put_Out; sys_Put_Rest | 45 # | | Cp/Exe param files | | Chmod | | 46 # | | Qsub | | | | 47 47 # ------------------------------------------------------------------------------------- 48 # | 0 | yes | yes| yes | yes |48 # | 0 | yes | yes | yes | yes | 49 49 # ------------------------------------------------------------------------------------- 50 # | 1 | yes | yes| yes | no |50 # | 1 | yes | yes | yes | no | 51 51 # ------------------------------------------------------------------------------------- 52 # | 2 | yes | yes| no | no |52 # | 2 | yes | yes | no | no | 53 53 # ------------------------------------------------------------------------------------- 54 # | 3 | yes | no| no | no |54 # | 3 | yes | no | no | no | 55 55 # ------------------------------------------------------------------------------------- 56 56 … … 194 194 195 195 NUM_COREPERNODE=8 196 196 197 197 #==================================================== 198 198 #- Default number of MPI task for IPSL coupled model … … 274 274 # if [ "X$( grep rebuild_from tmp_IGCM_sys_RshPost_$$ )" != "X" ] ; then 275 275 # #little hack so that rebuild submission is done on titane not an cesium 276 # 276 # 277 277 # libIGCM_POST_sed=$( echo $libIGCM_POST | sed 's/\//\\\//g' ) 278 278 # POST_DIR_sed=$( echo ${POST_DIR} | sed 's/\//\\\//g' ) … … 282 282 # sed "s/Script_Post_Output=/Script_Output=${POST_DIR_sed}\//g" tmp.txt > tmp_IGCM_sys_RshPost_$$ 283 283 # \mv tmp.txt tmp_IGCM_sys_RshPost_$$ 284 # 284 # 285 285 # echo cat tmp_IGCM_sys_RshPost_$$ AFTER 286 286 # cat tmp_IGCM_sys_RshPost_$$ … … 355 355 356 356 if [ ! -z ${config_UserChoices_MailName} ] ; then 357 357 mail -s "${config_UserChoices_JobName} ${status}" ${config_UserChoices_MailName} < job_end.mail 358 358 elif [ -f ~/.forward ] ; then 359 359 mail -s "${config_UserChoices_JobName} ${status}" $( cat ~/.forward ) < job_end.mail 360 360 fi 361 361 sleep 10 … … 405 405 fi 406 406 #- creation de repertoire sur le serveur fichier 407 if [ ! -d ${1} ]; then 407 if [ ! -d ${1} ]; then 408 408 \mkdir -p $1 409 409 if [ $? -gt 0 ] ; then … … 426 426 fi 427 427 #- creation de repertoire sur le serveur fichier 428 if [ ! -d ${1} ]; then 428 if [ ! -d ${1} ]; then 429 429 \mkdir -p $1 430 430 if [ $? -gt 0 ] ; then … … 716 716 # fi 717 717 # (( i = i + 1 )) 718 # done 718 # done 719 719 # ============ CESIUM END ============ # 720 720 … … 727 727 728 728 #D-************************* 729 #D- File transfer functions 729 #D- File transfer functions 730 730 #D-************************* 731 731 #D- … … 796 796 elif [ $MYLANG = "en" ] ; then 797 797 case $RET in 798 0) return;; 798 0) return;; 799 799 1) echo "rsync error : Syntax or usage error " 800 800 return;; … … 969 969 970 970 typeset RET 971 971 972 972 echo mv $@ > out_rsync 2>&1 973 973 \mv $@ >> out_rsync 2>&1 974 974 RET=$? 975 975 976 976 if [ ${RET} -gt 0 ] ; then 977 977 echo "IGCM_sys_Mv : error in mv." … … 1132 1132 RET=$? 1133 1133 1134 # 1135 # 1136 # 1137 1138 # 1139 # 1140 # 1141 1142 # 1143 # 1144 1145 # 1146 # 1134 # #RSYNC WITH NETWORK SSH CALL 1135 # echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} > out_rsync 2>&1 1136 # ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} >> out_rsync 2>&1 1137 1138 # #RSYNC WITH NFS USE 1139 # echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1 1140 # ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> out_rsync 2>&1 1141 1142 # RET=$? 1143 # IGCM_sys_Rsync_out $RET 1144 1145 # ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 1146 # (( RET=RET+$? )) 1147 1147 1148 1148 if [ ${RET} -gt 0 ] ; then … … 1229 1229 # typeset WORKPATH FILEPATH 1230 1230 # WORKPATH=$( dirname $2 | sed -e "s|${R_OUT}|${R_BUF}|" ) 1231 # IGCM_sys_MkdirWork ${WORKPATH} 1231 # IGCM_sys_MkdirWork ${WORKPATH} 1232 1232 # FILEPATH=${WORKPATH}/$( basename $2 ) 1233 1233 # # … … 1237 1237 if [ X${JobType} = XRUN ] ; then 1238 1238 if [ X${3} = X ] ; then 1239 1239 IGCM_sys_Chmod 444 ${1} 1240 1240 fi 1241 1241 fi … … 1245 1245 RET=$? 1246 1246 1247 # 1248 # 1249 # 1250 1251 # 1252 # 1253 # 1254 1255 # 1256 # 1257 1258 # 1259 # 1247 # #RSYNC WITH NETWORK SSH CALL 1248 # echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} > out_rsync 2>&1 1249 # ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} >> out_rsync 2>&1 1250 1251 # #RSYNC WITH NFS USE 1252 # echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1 1253 # ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> out_rsync 2>&1 1254 1255 # RET=$? 1256 # IGCM_sys_Rsync_out $RET 1257 1258 # ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 1259 # (( RET=RET+$? )) 1260 1260 1261 1261 if [ ${RET} -gt 0 ] ; then … … 1296 1296 if [ X${JobType} = XRUN ] ; then 1297 1297 if [ X${3} = X ] ; then 1298 1298 IGCM_sys_Chmod 444 ${1} 1299 1299 fi 1300 1300 fi … … 1326 1326 IGCM_debug_PushStack "IGCM_sys_Get" $@ 1327 1327 1328 typeset DEST RET dm_liste ifile target file_work 1328 typeset DEST RET dm_liste ifile target file_work 1329 1329 1330 1330 if ( $DEBUG_sys ) ; then … … 1383 1383 # RET=$? 1384 1384 # if [ ${RET} -gt 0 ] ; then 1385 # 1386 # 1387 # 1385 # echo "ERROR IGCM_sys_Get : again demigration error :" 1386 # cat out_rsync 1387 # IGCM_debug_Exit "IGCM_sys_Get" 1388 1388 # fi 1389 1389 # else … … 1398 1398 (( RET=0 )) 1399 1399 for target in ${dm_liste[*]} ; do 1400 1401 1402 1400 local_file=$( basename ${target} ) 1401 \cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1 1402 (( RET = RET + $? )) 1403 1403 done 1404 1404 else … … 1407 1407 fi 1408 1408 1409 # 1410 # 1411 # 1412 1413 # 1414 # 1415 # 1416 1417 # 1418 # 1419 1420 # 1421 # 1409 # #RSYNC WITH NETWORK SSH CALL 1410 # echo ${RSYNC} ${RSYNC_opt} -e ssh ${STOREHOST}:"${dm_liste}" ${STOREHOST}:${RUN_DIR}/${DEST} > out_rsync 2>&1 1411 # ${RSYNC} ${RSYNC_opt} -e ssh ${STOREHOST}:"${dm_liste}" ${STOREHOST}:${RUN_DIR}/${DEST} >> out_rsync 2>&1 1412 1413 # #RSYNC WITH NFS USE 1414 # echo ${RSYNC} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} > out_rsync 2>&1 1415 # ${RSYNC} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} >> out_rsync 2>&1 1416 1417 # RET=$? 1418 # IGCM_sys_Rsync_out $RET 1419 1420 # ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 1421 # (( RET=RET+$? )) 1422 1422 1423 1423 if [ ${RET} -gt 0 ] ; then … … 1442 1442 IGCM_debug_PushStack "IGCM_sys_GetBuffer" $@ 1443 1443 1444 typeset DEST RET buf_liste ifile target file_work 1444 typeset DEST RET buf_liste ifile target file_work 1445 1445 1446 1446 if ( $DEBUG_sys ) ; then … … 1460 1460 (( RET=0 )) 1461 1461 for target in ${buf_liste[*]} ; do 1462 1463 1464 1462 local_file=$( basename ${target} ) 1463 \cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1 1464 (( RET = RET + $? )) 1465 1465 done 1466 1466 else … … 1502 1502 #D-#================================================== 1503 1503 #D-function IGCM_sys_GetDate_FichArchive 1504 #D-* Purpose: donne la date filesys d'un fichier sur le filesystem ARCHIVE 1504 #D-* Purpose: donne la date filesys d'un fichier sur le filesystem ARCHIVE 1505 1505 #D-* Examples: 1506 1506 #D- … … 1538 1538 /ccc/cont003/home/dsm/p86maf/bin/dods_rm public/${LOGIN}/${R_DODS}/${1} # > out_dods_rm 2>&1 1539 1539 RET=$? 1540 1540 1541 1541 # if [ ${RET} -gt 0 ] ; then 1542 # 1543 # 1544 # 1542 # echo "IGCM_sys_Dods_Rm : error." 1543 # cat out_dods_rm 1544 # IGCM_debug_Exit "IGCM_sys_Dods_Rm" 1545 1545 # else 1546 # 1546 # rm out_dods_rm 1547 1547 # fi 1548 1548 … … 1575 1575 RET=$? 1576 1576 1577 # 1578 # 1579 # 1580 # 1581 # 1582 # 1583 # 1577 # if [ ${RET} -gt 0 ] ; then 1578 # echo "IGCM_sys_Dods_Cp : error." 1579 # cat out_dods_cp 1580 # IGCM_debug_Exit "IGCM_sys_Dods_Cp" 1581 # else 1582 # rm out_dods_cp 1583 # fi 1584 1584 1585 1585 else … … 1627 1627 IGCM_sys_Dods_Cp ${1} 1628 1628 RET=0 1629 1629 1630 1630 if [ ${RET} -gt 0 ] ; then 1631 1631 echo "IGCM_sys_Put_Dods : error." … … 1670 1670 (( max_omp = 0 )) 1671 1671 for comp in ${config_ListOfComponents[*]} ; do 1672 1672 1673 1673 eval ExeNameIn=\${config_Executable_${comp}[0]} 1674 1674 eval ExeNameOut=\${config_Executable_${comp}[1]} 1675 1675 1676 1676 # Only if we really have an executable for the component : 1677 1677 if ( [ "X${ExeNameOut}" != X\"\" ] && [ "X${comp}" != "XCPL" ] ) ; then … … 1711 1711 ############################################################ 1712 1712 # Build MPI/OMP scripts 1713 function IGCM_sys_build_execution_scripts 1713 function IGCM_sys_build_execution_scripts 1714 1714 { 1715 1715 IGCM_debug_PushStack "IGCM_sys_build_execution_scripts" $@ … … 1717 1717 echo "IGCM_sys_build_execution_scripts " $@ 1718 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 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 1721 typeset num_corempi nombre_restant_node nombre_restant_comp 1722 1722 … … 1737 1737 1738 1738 ${HOST_MPIRUN_COMMAND} hostname | sort | uniq > hosts.tmp 1739 1739 1740 1740 i=0 1741 1741 rm -f hosts … … 1748 1748 done 1749 1749 rm -f hosts.tmp 1750 1750 1751 1751 listnodes=${host[*]} 1752 1753 EXECUTION="${HOST_MPIRUN_COMMAND} -hostfile hosts" 1754 1752 1753 EXECUTION="${HOST_MPIRUN_COMMAND} -hostfile hosts" 1754 1755 1755 # Initialisation 1756 1756 … … 1761 1761 1762 1762 # Test : if oasis is there, we put it at the first position 1763 1763 1764 1764 for comp in ${config_ListOfComponents[*]} ; do 1765 1765 1766 1766 if [ "X${comp}" = "XCPL" ] ; then 1767 1767 1768 1768 eval ExeNameIn=\${config_Executable_${comp}[0]} 1769 1769 eval ExeNameOut=\${config_Executable_${comp}[1]} 1770 1770 1771 1771 echo "#!/bin/ksh" > script_${ExeNameOut}.ksh 1772 1772 echo "" >> script_${ExeNameOut}.ksh … … 1776 1776 echo "./${ExeNameOut} > out_${ExeNameOut}.out 2>out_${ExeNameOut}.err" >> script_${ExeNameOut}.ksh 1777 1777 IGCM_sys_Chmod u+x script_${ExeNameOut}.ksh 1778 1778 1779 1779 init_node=n 1780 1780 1781 1781 (( nombre_restant_node = NUM_COREPERNODE - 1 )) 1782 1782 node_num_current=0 1783 1783 node_current=${host[${node_num_current}]} 1784 1785 EXECUTION="${EXECUTION} -H ${node_current} -np 1 ./script_${ExeNameOut}.ksh" 1786 1784 1785 EXECUTION="${EXECUTION} -H ${node_current} -np 1 ./script_${ExeNameOut}.ksh" 1786 1787 1787 init_exec=y 1788 1788 start_num=1 1789 1789 1790 1790 fi 1791 1791 1792 1792 done 1793 1793 1794 1794 # Then loop on the components (except for oasis) 1795 1795 1796 1796 for comp in ${config_ListOfComponents[*]} ; do 1797 1797 1798 1798 eval ExeNameIn=\${config_Executable_${comp}[0]} 1799 1799 eval ExeNameOut=\${config_Executable_${comp}[1]} 1800 1800 1801 1801 # Only if we really have an executable for the component : 1802 1802 if ( [ "X${ExeNameOut}" != X\"\" ] && [ "X${comp}" != "XCPL" ] ) ; then … … 1804 1804 eval comp_proc_mpi_loc=\${${comp}_PROC_MPI} 1805 1805 eval comp_proc_omp_loc=\${${comp}_PROC_OMP} 1806 1806 1807 1807 echo "#!/bin/ksh" > script_${ExeNameOut}.ksh 1808 1808 # echo "set -vx" >> script_${ExeNameOut}.ksh … … 1815 1815 echo "./${ExeNameOut} > out_${ExeNameOut}.out.\${MYMPIRANK} 2>out_${ExeNameOut}.err.\${MYMPIRANK}" >> script_${ExeNameOut}.ksh 1816 1816 IGCM_sys_Chmod u+x script_${ExeNameOut}.ksh 1817 1817 1818 1818 node_num=0 1819 1820 # We define the number of MPI process to be assigned for the component 1819 1820 # We define the number of MPI process to be assigned for the component 1821 1821 1822 1822 nombre_restant_comp=${comp_proc_mpi_loc} 1823 1823 1824 1824 # Loop on the allocated nodes 1825 1825 … … 1829 1829 if [ ${node_num} = ${node_num_current} ] ; then 1830 1830 1831 1832 1833 # If first time on the node : initialisation 1831 node_current=${host[${node_num_current}]} 1832 1833 # If first time on the node : initialisation 1834 1834 1835 1835 if [ ${init_node} = y ] ; then 1836 1836 nombre_restant_node=${NUM_COREPERNODE} 1837 1838 1837 fi 1838 1839 1839 # Test on the number of OMP threads 1840 1840 1841 1841 if [ ${comp_proc_omp_loc} -gt ${nombre_restant_node} ] ; then 1842 1842 (( node_num = node_num + 1 )) 1843 1843 node_num_current=${node_num} … … 1849 1849 1850 1850 (( num_corempi = nombre_restant_node / comp_proc_omp_loc )) 1851 1852 1851 1852 if [ ${num_corempi} -gt ${nombre_restant_comp} ] ; then 1853 1853 num_corempi=${nombre_restant_comp} 1854 1854 fi 1855 1855 1856 1856 (( nombre_restant_node = nombre_restant_node - num_corempi * comp_proc_omp_loc )) 1857 1858 1859 1857 (( nombre_restant_comp = nombre_restant_comp - num_corempi )) 1858 1859 if [ ${init_exec} = y ] ; then 1860 1860 EXECUTION="${EXECUTION} : -H ${node_current} -np ${num_corempi} ./script_${ExeNameOut}.ksh" 1861 else 1861 else 1862 1862 EXECUTION="${EXECUTION} -H ${node_current} -np ${num_corempi} ./script_${ExeNameOut}.ksh" 1863 1863 init_exec=y … … 1865 1865 1866 1866 (( start_num = num_corempi + start_num )) 1867 1867 1868 1868 else 1869 1870 (( node_num = node_num + 1 )) 1871 1869 1870 (( node_num = node_num + 1 )) 1871 continue 1872 1872 fi 1873 1874 # Test on the number of core/process remaining on the node/component 1875 1873 1874 # Test on the number of core/process remaining on the node/component 1875 1876 1876 if [ ${nombre_restant_node} = 0 ] ; then 1877 1877 (( node_num = node_num + 1 )) 1878 1879 1878 node_num_current=${node_num} 1879 init_node=y 1880 1880 1881 1881 if [ ${nombre_restant_comp} = 0 ] ; then … … 1885 1885 1886 1886 node_num_current=${node_num} 1887 1888 1889 1890 1891 1887 init_node=n 1888 1889 if [ ${nombre_restant_comp} = 0 ] ; then 1890 break 1 1891 fi 1892 1892 fi 1893 1893 done 1894 1894 fi 1895 1895 done 1896 1896 1897 1897 else 1898 1898 … … 1900 1900 1901 1901 ## the coupler ie oasis must be the first one 1902 1903 1904 1905 1906 1907 1908 1909 echo "-np ${comp_proc_mpi_loc} ./${ExeNameOut} " >> run_file 1910 1911 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 1912 1913 1913 # Then second loop on the components 1914 1914 1915 1916 1917 1918 1915 for comp in ${config_ListOfComponents[*]} ; do 1916 1917 eval ExeNameOut=\${config_Executable_${comp}[1]} 1918 1919 1919 # Only if we really have an executable for the component and not the coupler ie oasis: 1920 1921 1922 echo "-np ${comp_proc_mpi_loc} ./${ExeNameOut} " >> run_file 1923 1924 1925 1926 1927 1928 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 1929 fi 1930 1930 … … 1934 1934 1935 1935 # Only if we really have an executable for the component : 1936 1937 if ( [ "X${ExeNameOut}" != X\"\" ] ) ; then 1938 1939 1940 1941 if ( ${OK_PARA_OMP} ) ; then 1942 1943 echo "OMP_NUM_THREADS=${comp_proc_omp_loc}" >> script_${ExeNameOut}.ksh 1944 1945 if ( ${OK_PARA_MPI} ) ; then 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 1946 # Default : mpirun used if nb_proc gt 1 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 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 1961 done 1962 1962 1963 1963 fi 1964 1964
Note: See TracChangeset
for help on using the changeset viewer.