Changeset 1199 for palm/trunk/SCRIPTS/mrun
- Timestamp:
- Jul 5, 2013 2:52:22 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
palm/trunk/SCRIPTS/mrun
r1197 r1199 22 22 # Current revisions: 23 23 # ------------------ 24 # adjustments for CSC Helsinki (lccrayf) 24 # adjustments for CSC Helsinki (lccrayf), 25 # executables for batch jobs can be created in advance, in order to avoid calling 26 # the compiler within the batch job (only works if batch jobs are submitted on 27 # local host) 25 28 # 26 29 # Former revisions: … … 122 125 cpumax=0 123 126 cpurest=0 127 create_executable_for_batch=false 124 128 delete_temporary_catalog=true 125 129 do_batch=false … … 1747 1751 # FALLS PROGRAMMTEILE UEBERSETZT WERDEN SOLLEN, FOLGEN JETZT EINIGE 1748 1752 # UEBERPRUEFUNGEN UND DAS SETZEN DER PRAEPROZESSOR-DIREKTIVEN 1749 if [[ $do_compile = true ]]1753 if [[ $do_compile = true || $create_executable_for_batch = true ]] 1750 1754 then 1751 1755 … … 1898 1902 # EVENTUELL BEI LOKALEN RECHNUNGEN $-ZEICHEN IN ENVIRONMENT-VARIABLEN 1899 1903 # ERSETZEN 1900 if [[ $do_remote = false && $do_compile = true ]]1904 if [[ $do_remote = false && $do_compile = true || $create_executable_for_batch = true ]] 1901 1905 then 1902 1906 eval fopts=\"$fopts\" … … 2649 2653 2650 2654 2655 # DETERMINE PATH FOR MAKE DEPOSITORY 2656 if [[ $do_batch = false || $create_executable_for_batch = true ]] 2657 then 2658 2659 line="" 2660 grep "%depository_path" $config_file > tmp_mrun 2661 while read line 2662 do 2663 if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] 2664 then 2665 if [[ "$(echo $line | cut -d" " -s -f3)" = "" ]] 2666 then 2667 global_depository_path=`echo $line | cut -d" " -s -f2` 2668 fi 2669 fi 2670 done < tmp_mrun 2671 2672 line="" 2673 grep " $localhost" $config_file | grep "%depository_path" > tmp_mrun 2674 while read line 2675 do 2676 if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] 2677 then 2678 if [[ "$(echo $line | cut -d" " -s -f4)" = "$cond1" && "$(echo $line | cut -d" " -s -f5)" = "$cond2" ]] 2679 then 2680 local_depository_path=`echo $line | cut -d" " -s -f2` 2681 fi 2682 fi 2683 done < tmp_mrun 2684 2685 if [[ "$local_depository_path" = "" ]] 2686 then 2687 if [[ "$global_depository_path" != "" ]] 2688 then 2689 local_depository_path=$global_depository_path 2690 else 2691 printf "\n\n +++ no depository path found in configuration file" 2692 printf "\n for local host \"$localhost\" " 2693 printf "\n please set \"\%depository_path\" in configuration file\n" 2694 locat=config_file; exit 2695 fi 2696 fi 2697 eval local_depository_path=$local_depository_path 2698 [[ "$cond1" != "" ]] && local_depository_path=${local_depository_path}_$cond1 2699 [[ "$cond2" != "" ]] && local_depository_path=${local_depository_path}_$cond2 2700 2701 2702 basename=`echo $mainprog | cut -f1 -d"."` 2703 eval make_depository=${local_depository_path}/${basename}_current_version.tar 2704 if [[ ! -f $make_depository ]] 2705 then 2706 printf "\n" 2707 printf "\n *** WARNING: make depository \"$make_depository\" not found" 2708 printf "\n \"make\" will fail, if the Makefile or other source files are missing\n" 2709 fi 2710 2711 fi 2712 2713 2651 2714 # FALLS AUF DIESER MASCHINE GERECHNET WERDEN SOLL, WERDEN JETZT ENTSPRE- 2652 2715 # CHENDE AKTIONEN DURCHGEFUEHRT … … 2659 2722 chmod go+rx $TEMPDIR 2660 2723 tmpcreate=true 2661 2662 # set striping on lustre file system2663 # if [[ $localhost = lcsgih ]]2664 # then2665 # lfs setstripe -s 8192k -c 16 $TEMPDIR2666 # lfs getstripe $TEMPDIR2667 # fi2668 2724 2669 2725 … … 2692 2748 fi 2693 2749 2694 2695 # PFADNAMEN FUER DAS MAKE-DEPOSITORY ERMITTELN 2696 line="" 2697 grep "%depository_path" $config_file > tmp_mrun 2698 while read line 2699 do 2700 if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] 2701 then 2702 if [[ "$(echo $line | cut -d" " -s -f3)" = "" ]] 2703 then 2704 global_depository_path=`echo $line | cut -d" " -s -f2` 2705 fi 2706 fi 2707 done < tmp_mrun 2708 2709 line="" 2710 grep " $localhost" $config_file | grep "%depository_path" > tmp_mrun 2711 while read line 2712 do 2713 if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] 2714 then 2715 if [[ "$(echo $line | cut -d" " -s -f4)" = "$cond1" && "$(echo $line | cut -d" " -s -f5)" = "$cond2" ]] 2716 then 2717 local_depository_path=`echo $line | cut -d" " -s -f2` 2718 fi 2719 fi 2720 done < tmp_mrun 2721 2722 if [[ "$local_depository_path" = "" ]] 2723 then 2724 if [[ "$global_depository_path" != "" ]] 2725 then 2726 local_depository_path=$global_depository_path 2727 else 2728 printf "\n\n +++ no depository path found in configuration file" 2729 printf "\n for local host \"$localhost\" " 2730 printf "\n please set \"\%depository_path\" in configuration file\n" 2731 locat=config_file; exit 2732 fi 2733 fi 2734 eval local_depository_path=$local_depository_path 2735 [[ "$cond1" != "" ]] && local_depository_path=${local_depository_path}_$cond1 2736 [[ "$cond2" != "" ]] && local_depository_path=${local_depository_path}_$cond2 2737 2738 2739 basename=`echo $mainprog | cut -f1 -d"."` 2740 eval make_depository=${local_depository_path}/${basename}_current_version.tar 2741 if [[ ! -f $make_depository ]] 2742 then 2743 printf "\n" 2744 printf "\n *** WARNING: make depository \"$make_depository\" not found" 2745 printf "\n \"make\" will fail, if the Makefile or other source files are missing\n" 2746 else 2747 cp $make_depository $TEMPDIR_COMPILE 2748 cd $TEMPDIR_COMPILE 2749 tar -xf $make_depository > /dev/null 2>&1 2750 cd - > /dev/null 2751 fi 2750 cp $make_depository $TEMPDIR_COMPILE 2751 cd $TEMPDIR_COMPILE 2752 tar -xf $make_depository > /dev/null 2>&1 2753 cd - > /dev/null 2752 2754 2753 2755 cp SOURCES_FOR_RUN_$fname/* $TEMPDIR_COMPILE … … 2782 2784 2783 2785 2784 # EVTL. UEBERSETZUNGSAKTIONEN STARTEN2786 # IF REQUIRED, START WITH COMPILING ACTIONS 2785 2787 if [[ $do_compile = true ]] 2786 2788 then 2787 2789 2788 2790 2789 # COMPILING WITH MAKE (ON NEC COMPILER IS CALLED ON HOST CROSS) 2790 printf "\n\n\n *** compilation starts \n$striche\n" 2791 printf " *** compilation with make using following options:\n" 2792 printf " make depository: $make_depository" 2793 if [[ "$mopts" != "" ]] 2794 then 2795 printf " make options: $mopts\n" 2796 fi 2797 printf " compilername: $compiler_name\n" 2798 printf " compiler options: $fopts\n" 2799 printf " preprocessor directives: $cpp_options \n" 2800 printf " linker options: $lopts \n" 2801 if [[ "$modules" != "" ]] 2802 then 2803 printf " modules to be load: $modules \n" 2804 fi 2805 printf " source code files: $source_list \n" 2806 2807 if [[ $localhost = nech ]] 2808 then 2809 # init_cmds was ". /SX/opt/etc/initsx.sh;" 2810 ssh $SSH_PORTOPT 136.172.44.192 -l $usern "$init_cmds $module_calls cd \$HOME/work/${usern}.$kennung; sxmake $mopts -f Makefile PROG=a.out F90=$compiler_name COPT=\"$cpp_options\" F90FLAGS=\"$fopts\" LDFLAGS=\"$lopts\" " 2811 cp $TEMPDIR_COMPILE/a.out . 2812 [[ $? != 0 ]] && compile_error=true 2813 rm -rf $TEMPDIR_COMPILE 2814 elif [[ $localhost = ibmh ]] 2815 then 2816 printf " compiler is called via ssh on \"plogin1\" \n" 2817 ssh $SSH_PORTOPT plogin1 -l $usern "$init_cmds export PATH=/sw/ibm/xlf/13.1.0.8/usr/bin:$PATH; $module_calls cd $TEMPDIR; make $mopts -f Makefile PROG=a.out F90=$compiler_name COPT=\"$cpp_options\" F90FLAGS=\"$fopts\" LDFLAGS=\"$lopts\" " 2818 [[ ! -f a.out ]] && compile_error=true 2819 continue # ANDERENFALLS IST STATUS=1, FALLS A.OUT VORHANDEN 2820 # elif [[ $localhost = lccrayf ]] 2821 # then 2822 # printf " compiler is called via ssh on \"sisu-login1\" \n" 2823 # ssh $SSH_PORTOPT sisu-login1 -l $usern "$init_cmds $module_calls cd $TEMPDIR; make $mopts -f Makefile PROG=a.out F90=$compiler_name COPT=\"$cpp_options\" F90FLAGS=\"$fopts\" LDFLAGS=\"$lopts\" " 2824 # [[ ! -f a.out ]] && compile_error=true 2825 # continue # ANDERENFALLS IST STATUS=1, FALLS A.OUT VORHANDEN 2826 elif [[ $localhost = lcsgib ]] 2827 then 2828 printf " compiler is called via ssh on \"bicegate0\" \n" 2829 ssh $SSH_PORTOPT bicegate0 -l $usern "$init_cmds $module_calls cd $TEMPDIR; make $mopts -f Makefile PROG=a.out F90=$compiler_name COPT=\"$cpp_options\" F90FLAGS=\"$fopts\" LDFLAGS=\"$lopts\" " 2830 [[ ! -f a.out ]] && compile_error=true 2831 continue # ANDERENFALLS IST STATUS=1, FALLS A.OUT VORHANDEN 2832 elif [[ $localhost = lcsgih ]] 2833 then 2834 printf " compiler is called via ssh on \"hicegate0\" \n" 2835 ssh $SSH_PORTOPT hicegate0 -l $usern "$init_cmds $module_calls cd $TEMPDIR; make $mopts -f Makefile PROG=a.out F90=$compiler_name COPT=\"$cpp_options\" F90FLAGS=\"$fopts\" LDFLAGS=\"$lopts\" 2>&1 " 2836 [[ ! -f a.out ]] && compile_error=true 2837 continue # ANDERENFALLS IST STATUS=1, FALLS A.OUT VORHANDEN 2838 elif [[ $localhost = lcflow ]] 2839 then 2840 printf " compiler is called via ssh on \"flow\" \n" 2841 ssh $SSH_PORTOPT flow02.hpc.uni-oldenburg.de -l $usern "$init_cmds $module_calls cd $TEMPDIR; make $mopts -f Makefile PROG=a.out F90=$compiler_name COPT=\"$cpp_options\" F90FLAGS=\"$fopts\" LDFLAGS=\"$lopts\" " 2842 [[ ! -f a.out ]] && compile_error=true 2843 continue # ANDERENFALLS IST STATUS=1, FALLS A.OUT VORHANDEN 2844 elif [[ $localhost = lccrayf ]] 2845 then 2846 module list 2847 make $mopts -f Makefile PROG=a.out F90=$compiler_name COPT="$cpp_options" F90FLAGS="$fopts" LDFLAGS="$lopts" 2791 if [[ -f a.out ]] 2792 then 2793 2794 # EXECUTABLE WAS CREATED DURING INTERACTIVE CALL OF MRUN 2795 printf "\n\n\n *** executable a.out found" 2796 printf "\n no compilation required \n" 2797 2848 2798 else 2849 [[ "$init_cmds" != "" ]] && eval $init_cmds 2850 [[ "$module_calls" != "" ]] && eval $module_calls 2851 make $mopts -f Makefile PROG=a.out F90=$compiler_name COPT="$cpp_options" F90FLAGS="$fopts" LDFLAGS="$lopts" 2852 2853 fi 2854 2855 if [[ $? != 0 || "$compile_error" = true || "$module_compile_error" = true ]] 2856 then 2857 printf "\n +++ error occured while compiling or linking" 2858 locat=compile 2859 2860 # WORKAROUND: REMOVE IF CONSTRUCT LATER, BUT KEEP THE EXIT! 2861 # if [[ $localhost != lcsgib && $localhost != lcsgih ]] 2862 # then 2799 2800 # COMPILING WITH MAKE (ON NEC COMPILER IS CALLED ON HOST CROSS) 2801 printf "\n\n\n *** compilation starts \n$striche\n" 2802 printf " *** compilation with make using following options:\n" 2803 printf " make depository: $make_depository" 2804 if [[ "$mopts" != "" ]] 2805 then 2806 printf " make options: $mopts\n" 2807 fi 2808 printf " compilername: $compiler_name\n" 2809 printf " compiler options: $fopts\n" 2810 printf " preprocessor directives: $cpp_options \n" 2811 printf " linker options: $lopts \n" 2812 if [[ "$modules" != "" ]] 2813 then 2814 printf " modules to be load: $modules \n" 2815 fi 2816 printf " source code files: $source_list \n" 2817 2818 if [[ $localhost = nech ]] 2819 then 2820 ssh $SSH_PORTOPT 136.172.44.192 -l $usern "$init_cmds $module_calls cd \$HOME/work/${usern}.$kennung; sxmake $mopts -f Makefile PROG=a.out F90=$compiler_name COPT=\"$cpp_options\" F90FLAGS=\"$fopts\" LDFLAGS=\"$lopts\" " 2821 cp $TEMPDIR_COMPILE/a.out . 2822 [[ $? != 0 ]] && compile_error=true 2823 rm -rf $TEMPDIR_COMPILE 2824 elif [[ $localhost = ibmh ]] 2825 then 2826 printf " compiler is called via ssh on \"plogin1\" \n" 2827 ssh $SSH_PORTOPT plogin1 -l $usern "$init_cmds export PATH=/sw/ibm/xlf/13.1.0.8/usr/bin:$PATH; $module_calls cd $TEMPDIR; make $mopts -f Makefile PROG=a.out F90=$compiler_name COPT=\"$cpp_options\" F90FLAGS=\"$fopts\" LDFLAGS=\"$lopts\" " 2828 [[ ! -f a.out ]] && compile_error=true 2829 continue # ANDERENFALLS IST STATUS=1, FALLS A.OUT VORHANDEN 2830 elif [[ $localhost = lcsgib ]] 2831 then 2832 printf " compiler is called via ssh on \"bicegate0\" \n" 2833 ssh $SSH_PORTOPT bicegate0 -l $usern "$init_cmds $module_calls cd $TEMPDIR; make $mopts -f Makefile PROG=a.out F90=$compiler_name COPT=\"$cpp_options\" F90FLAGS=\"$fopts\" LDFLAGS=\"$lopts\" " 2834 [[ ! -f a.out ]] && compile_error=true 2835 continue # ANDERENFALLS IST STATUS=1, FALLS A.OUT VORHANDEN 2836 elif [[ $localhost = lcsgih ]] 2837 then 2838 printf " compiler is called via ssh on \"hicegate0\" \n" 2839 ssh $SSH_PORTOPT hicegate0 -l $usern "$init_cmds $module_calls cd $TEMPDIR; make $mopts -f Makefile PROG=a.out F90=$compiler_name COPT=\"$cpp_options\" F90FLAGS=\"$fopts\" LDFLAGS=\"$lopts\" 2>&1 " 2840 [[ ! -f a.out ]] && compile_error=true 2841 continue # ANDERENFALLS IST STATUS=1, FALLS A.OUT VORHANDEN 2842 elif [[ $localhost = lcflow ]] 2843 then 2844 printf " compiler is called via ssh on \"flow\" \n" 2845 ssh $SSH_PORTOPT flow02.hpc.uni-oldenburg.de -l $usern "$init_cmds $module_calls cd $TEMPDIR; make $mopts -f Makefile PROG=a.out F90=$compiler_name COPT=\"$cpp_options\" F90FLAGS=\"$fopts\" LDFLAGS=\"$lopts\" " 2846 [[ ! -f a.out ]] && compile_error=true 2847 continue # ANDERENFALLS IST STATUS=1, FALLS A.OUT VORHANDEN 2848 elif [[ $localhost = lccrayf ]] 2849 then 2850 make $mopts -f Makefile PROG=a.out F90=$compiler_name COPT="$cpp_options" F90FLAGS="$fopts" LDFLAGS="$lopts" 2851 else 2852 [[ "$init_cmds" != "" ]] && eval $init_cmds 2853 [[ "$module_calls" != "" ]] && eval $module_calls 2854 make $mopts -f Makefile PROG=a.out F90=$compiler_name COPT="$cpp_options" F90FLAGS="$fopts" LDFLAGS="$lopts" 2855 fi 2856 2857 if [[ $? != 0 || "$compile_error" = true || "$module_compile_error" = true ]] 2858 then 2859 printf "\n +++ error occured while compiling or linking" 2860 locat=compile 2861 2863 2862 exit 2864 #else2865 # locat=normal 2866 #fi2867 else 2868 printf "$striche\n *** compilation finished \n"2869 fi 2863 else 2864 printf "$striche\n *** compilation finished \n" 2865 fi 2866 2867 fi 2868 2870 2869 fi 2871 2870 … … 3682 3681 elif [[ $host = lccrayf ]] 3683 3682 then 3684 echo "aprun -n $ii -N $tasks_per_node -m ${memory}M a.out $ROPTS < runfile_atmos"3685 3683 aprun -n $ii -N $tasks_per_node -m ${memory}M a.out $ROPTS < runfile_atmos 3686 3684 elif [[ $host = lcxe6 || $host = lcxt5m ]] … … 4754 4752 4755 4753 4754 # create executable for batch job 4755 if [[ $create_executable_for_batch = true && $restart_run != true ]] 4756 then 4757 4758 printf "\n *** creating the executable for batch job\n" 4759 4760 # method only works for batch jobs on local hosts 4761 if [[ $host != $localhost ]] 4762 then 4763 printf "\n +++ creation of executables is only allowed for batch jobs on local hosts." 4764 printf "\n Please set create_executable_for_batch = false in the config-file.\n" 4765 locat=create_executable; exit 4766 fi 4767 4768 mkdir $working_directory/SOURCES_FOR_RUN_${fname}/TMPDIR_FOR_CREATING_EXECUTABLE 4769 cd $working_directory/SOURCES_FOR_RUN_${fname}/TMPDIR_FOR_CREATING_EXECUTABLE 4770 4771 cp $make_depository . 4772 tar -xf $make_depository > /dev/null 2>&1 4773 cp ../* . > /dev/null 2>&1 4774 4775 make $mopts -f Makefile PROG=a.out F90=$compiler_name COPT="$cpp_options" F90FLAGS="$fopts" LDFLAGS="$lopts" 4776 4777 if [[ $? != 0 || "$compile_error" = true || "$module_compile_error" = true ]] 4778 then 4779 printf "\n +++ error occured while compiling or linking" 4780 locat=compile 4781 exit 4782 fi 4783 4784 mv a.out .. 4785 cd - > /dev/null 2>&1 4786 rm -rf $working_directory/SOURCES_FOR_RUN_${fname}/TMPDIR_FOR_CREATING_EXECUTABLE 4787 4788 printf " *** executable created in \"$working_directory/SOURCES_FOR_RUN_${fname}\"\n " 4789 4790 fi 4791 4792 4756 4793 # ZUSAMMENSTELLUNG DES JOBSCRIPTS AUF DATEI jobfile 4757 4794 jobfile=jobfile.$RANDOM … … 4785 4822 # BEREITSTELLUNG VON QUELLTEXTEN, MRUN-SCRIPTS UND KONFIGURATIONS- 4786 4823 # DATEI FUER DEN JOB 4787 if [[ $( echo $host | cut -c1-5 ) = lcsgi || $host = ibmkisti ]]4824 if [[ $( echo $host | cut -c1-5 ) = lcsgi || $host = ibmkisti || $host = lccrayf ]] 4788 4825 then 4789 4826 … … 4801 4838 if [[ $host = $localhost ]] 4802 4839 then 4803 echo "cp -r $working_directory/SOURCES_FOR_RUN_$fname ." >> $jobfile 4840 4841 # DUE TO UNKNOWN REASONS, COPY WITH cp COMMAND CREATES CORRUPT 4842 # FILES ON CRAY XC30 SYSTEMS (CSC HELSINKI), rsync IS USED INSTEAD 4843 echo "rsync -ae -t $working_directory/SOURCES_FOR_RUN_$fname ." >> $jobfile 4844 4804 4845 else 4805 4846 if [[ $host != ibmkisti ]] … … 4818 4859 echo "mv SOURCES_FOR_RUN_$fname/$config_file . " >> $jobfile 4819 4860 echo "mv SOURCES_FOR_RUN_$fname/$mrun_script_name . " >> $jobfile 4861 echo "chmod u+rwx $mrun_script_name" >> $jobfile 4820 4862 echo "execute_mrun=true" >> $jobfile 4821 4863 echo " " >> $jobfile
Note: See TracChangeset
for help on using the changeset viewer.