Changeset 807 for palm/trunk/SCRIPTS/mrun
- Timestamp:
- Jan 25, 2012 11:53:51 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
palm/trunk/SCRIPTS/mrun
r759 r807 234 234 # 15/09/11 - Siggi - new option -w tp set the maximum number of parallel 235 235 # io streams, option -T is obligatory from now on 236 # 25/01/12 - BjornM - a namelist file check prior to the model run has 237 # been implemented (check_namelist_files). 238 # New option -z can be used to skip the check 236 239 237 240 … … 248 251 archive_save=true 249 252 archive_system=none 253 check_namelist_files=true 250 254 compiler_name="" 251 255 cond1="" … … 311 315 package_list="" 312 316 punkte="..........................................................." 317 p3d_suffix="" 313 318 queue=none 314 319 read_from_config="" … … 449 454 # BEI TERMINAL-BREAK: 450 455 trap 'rm -rf $working_directory/tmp_mrun 456 rm -rf $working_directory/tmp_check_namelist_files 451 457 [[ $tmpcreate = true ]] && (cd; rm -rf $TEMPDIR) 452 458 if [[ -f ~/job_queue/JOBINFO.$QSUB_REQID ]] … … 479 485 # SHELLSCRIPT-OPTIONEN EINLESEN UND KOMMANDO NEU ZUSAMMENSETZEN, FALLS ES 480 486 # FUER FOLGEJOBS BENOETIGT WIRD 481 while getopts :a:AbBc:Cd:D:Fg:G:h:H:i:IkK:m:M:n:o:O:p:P:q:r:R:s:St:T:u:U:vw:xX:yY: option487 while getopts :a:AbBc:Cd:D:Fg:G:h:H:i:IkK:m:M:n:o:O:p:P:q:r:R:s:St:T:u:U:vw:xX:yY:z option 482 488 do 483 489 case $option in … … 521 527 (y) ocean_file_appendix=true; mc="$mc -y";; 522 528 (Y) run_coupled_model=true; coupled_dist=$OPTARG; mc="$mc -Y'$OPTARG'";; 529 (z) check_namelist_files=false; mc="$mc -z";; 523 530 (\?) printf "\n +++ unknown option $OPTARG \n" 524 531 printf "\n --> type \"$0 ?\" for available options \n" … … 2394 2401 fi 2395 2402 fi 2396 2397 2398 2399 2400 # FALLS AUF DIESER MASCHINE GERECHNET WERDEN SOLL, WERDEN JETZT ENTSPRE- 2401 # CHENDE AKTIONEN DURCHGEFUEHRT 2403 2404 #### PERFORM PARAMETER FILE CHECK (COUPLED RUNS ARE NOT SUPPORTED YET) 2405 if [[ $check_namelist_files == true && $fromhost == $localhost && $run_coupled_model == false ]] 2406 then 2407 if [[ $ocean_file_appendix == true ]] 2408 then 2409 d3par_string="d3o#" 2410 d3fpar_string="d3of" 2411 else 2412 d3par_string="d3#" 2413 d3fpar_string="d3f" 2414 fi 2415 2416 tmp_check=${working_directory}/tmp_check 2417 2418 # GET PARAMETER FILE SUFFIX (USUALLY "_P3D") 2419 line="" 2420 found=false 2421 grep "$d3par_string" $config_file | grep "PARIN" > $tmp_check 2422 while read line1 2423 do 2424 line="$line1" 2425 if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] 2426 then 2427 # EVENTUELLE DOPPELPUNKTE AUS OPTIONSSTRING ENTFERNEN 2428 p3d_suffix=`echo $line | tr -s " " | cut -d" " -s -f5` 2429 found=true 2430 fi 2431 done < $tmp_check 2432 2433 if [[ $found = false ]] 2434 then 2435 printf "\n +++ no PARIN list entry found for $d3par_string in the configuration file." 2436 2437 locat=check_namelist; exit 2438 fi 2439 2440 # GET RESTART PARAMETER FILE SUFFIX (USUALLY "_P3DF"). THIS FILE MIGHT IS 2441 # NOT NECESSARILY REQUIRED 2442 line="" 2443 found=false 2444 grep "d3f" $config_file | grep "PARIN" > $tmp_check 2445 while read line1 2446 do 2447 line="$line1" 2448 if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] 2449 then 2450 p3df_suffix=`echo $line | tr -s " " | cut -d" " -s -f5` 2451 found=true 2452 fi 2453 done < $tmp_check 2454 2455 if [[ $found = false ]] 2456 then 2457 printf "\n +++ no PARIN list entry found for d3f in the configuration file." 2458 fi 2459 2460 rm -rf ${working_directory}/tmp_check 2461 2462 # DEFINE VARIABLES FOR FREQUENTLY USED DIRECTORIES 2463 check_depository="${working_directory}/trunk/UTIL" 2464 check_sources="${working_directory}/tmp_check_namelist_files" 2465 2466 # CHECK IF THE A P3DF FILE MUST BE CHECKED 2467 for item in $input_list 2468 do 2469 if [[ "$item" == "restart" || "$item" == d3f || "$item" == d3of ]] 2470 then 2471 check_restart=1 2472 else 2473 check_restart=0 2474 fi 2475 done 2476 2477 # ERROR IF NO PARAMETER FILE WAS FOUND, OTHERWISE PROCEED 2478 if [[ ! -f $working_directory/JOBS/$fname/INPUT/${fname}${p3d_suffix} ]] 2479 then 2480 printf "\n\n +++ ERROR: parameter file (${fname}${p3d_suffix}) not found." 2481 locat=check_namelist; exit 2482 fi 2483 2484 # CHECK IF THE RESTART PARAMETER FILE EXISTS (IF NECESSARY) 2485 if [[ $check_restart == 1 ]] 2486 then 2487 if [[ ! -f $working_directory/JOBS/$fname/INPUT/${fname}${p3df_suffix} ]] 2488 then 2489 printf "\n\n +++ WARNING: restart parameter file (${fname}${p3df_suffix}) is missing." 2490 check_restart=0 2491 answer=dummy 2492 printf "\n\n" 2493 2494 while [[ "$answer" != c && "$answer" != C && "$answer" != a && "$answer" != A ]] 2495 do 2496 printf " >>> continue anyway (c(ontinue)/a(bort)) ? " 2497 read answer 2498 done 2499 if [[ $answer = a || $answer = A ]] 2500 then 2501 printf "\n +++ Aborting...." 2502 locat=normal; exit 2503 fi 2504 else 2505 check_restart=1 2506 fi 2507 fi 2508 2509 # CREATE TEMPORARY SOURCES_FOR_CHECK PATH 2510 mkdir $check_sources 2511 cd $check_sources 2512 2513 # CHECK FOR USER CODE, OTHERWISE USE THE PRECOMPILED CHECK_NAMELIST_FILES.X 2514 if [[ -d $working_directory/USER_CODE/$fname ]] 2515 then 2516 printf "\n\n *** copying files from $check_depository" 2517 cp $check_depository/check_namelist_files.tar ./ 2518 2519 printf "\n\n *** untar of makefile and source files in $check_sources" 2520 tar -xf check_namelist_files.tar > /dev/null 2>&1 2521 2522 printf "\n\n *** adding user code." 2523 cp $working_directory/USER_CODE/$fname/* ./ 2524 touch check_namelist_files.f90 2525 2526 # GET COMPILER OPTIONS AND PERFORM MAKE 2527 printf "\n\n *** compiling code if necessary...\n" 2528 copts_check="-cpp -D_parallel -D__check" 2529 make -f Makefile_check F90=$compiler_name_ser COPT="$copts_check" 2530 2531 # GET MAKE OUTPUT 2532 if [[ $? != 0 ]] 2533 then 2534 rm -rf $check_sources 2535 locat=check_namelist; exit 2536 fi 2537 else 2538 cp $PALM_BIN/check_namelist_files.x ./ 2539 fi 2540 2541 cp $working_directory/JOBS/$fname/INPUT/${fname}${p3d_suffix} ./PARIN 2542 if [[ $check_restart == 1 ]] 2543 then 2544 cp $working_directory/JOBS/$fname/INPUT/${fname}${p3df_suffix} ./PARINF 2545 fi 2546 2547 # CREATE ENVPAR FILE, WHICH IS NEEDED BY CHECK_NAMELIST_FILES.X 2548 cat > ENVPAR << %%END%% 2549 &envpar run_identifier = '$fname', host = '$localhost', 2550 write_binary = '$write_binary', tasks_per_node = $tasks_per_node, 2551 maximum_parallel_io_streams = $maximum_parallel_io_streams, 2552 maximum_cpu_time_allowed = ${cpumax}., 2553 revision = '$global_revision', 2554 local_dvrserver_running = $local_dvrserver_running / 2555 2556 %%END%% 2557 2558 # SAFETY CHECK: ONLY PROCEED IF THE PARAMETER CHECK PROGRAM WAS PROPERLY COMPILED 2559 if [[ ! -f check_namelist_files.x ]] then 2560 printf "\n +++ WARNING: check_namelist_files.x not found." 2561 answer=dummy 2562 printf "\n\n" 2563 while [[ "$answer" != c && "$answer" != C && "$answer" != a && "$answer" != A ]] 2564 do 2565 printf " >>> continue anyway (c(ontinue)/a(bort)) ? " 2566 read answer 2567 done 2568 if [[ $answer = a || $answer = A ]] 2569 then 2570 printf "\n +++ Aborting..." 2571 rm -rf $check_sources 2572 locat=normal; exit 2573 else 2574 printf "\n *** Skipping parameter file check." 2575 fi 2576 else 2577 # STARTING THE PARAMETER FILE CHECK 2578 printf "\n\n *** starting parameter file check..." 2579 2580 # CHECKING THE P3D FILE 2581 printf "\n\n (1) checking $fname$p3d_suffix" 2582 echo "$numprocs 0" > VARIN 2583 errors=`./check_namelist_files.x < VARIN 2>&1` 2584 2585 check_error=false 2586 if [[ "$errors" == "" ]] 2587 then 2588 printf " --> o.k." 2589 else 2590 printf " --> failed." 2591 check_error=true 2592 printf "\n\n $errors" 2593 fi 2594 2595 # CHECKING THE PD3F FILE IF NECESSARY 2596 if [[ $check_restart == 1 && $check_error == false ]] 2597 then 2598 printf "\n\n (2) checking $fname$p3df_suffix" 2599 2600 # FIRST CHECK IF INITIALIZING_ACTIONS="READ_RESTART_DATA" IS SET IN &INIPAR LIST 2601 found=false 2602 cat PARINF|while read line 2603 do 2604 line=$(echo $line|sed 's/ //g') 2605 if [[ $line == *"&inipar"* ]] 2606 then 2607 start_search=true 2608 fi 2609 2610 if [[ $start_search == true ]] 2611 then 2612 if [[ $line == *"initializing_actions='read_restart_data'"* ]] 2613 then 2614 found=true 2615 break 2616 fi 2617 fi 2618 2619 if [[ $line == *"/"* ]] 2620 then 2621 start_search=false 2622 fi 2623 2624 done 2625 2626 if [[ $found = false ]] 2627 then 2628 printf "\n\n +++ ERROR: initializing_actions = 'read_restart_data' not found" 2629 printf "\n in &inipar list in $fname$p3df_suffix." 2630 rm -rf $check_sources 2631 locat=check_namelist; exit 2632 fi 2633 2634 echo "$numprocs 1" > VARIN 2635 errors=`./check_namelist_files.x < VARIN 2>&1` 2636 2637 if [[ "$errors" == "" ]] 2638 then 2639 printf " --> o.k." 2640 else 2641 printf " --> failed." 2642 check_error=true 2643 printf "\n\n $errors" 2644 fi 2645 fi 2646 2647 # REPORT ERRORS AND CONTINUE/EXIT 2648 if [[ $check_error == true ]] 2649 then 2650 printf "\n +++ errors found in the parameter file!\n" 2651 answer=dummy 2652 printf "\n\n" 2653 2654 while [[ "$answer" != c && "$answer" != C && "$answer" != a && "$answer" != A ]] 2655 do 2656 printf " >>> continue anyway (c(ontinue)/a(bort)) ? " 2657 read answer 2658 done 2659 2660 if [[ $answer = a || $answer = A ]] 2661 then 2662 printf "\n +++ Aborting..." 2663 rm -rf $check_sources 2664 locat=normal; exit 2665 fi 2666 else 2667 printf "\n\n *** parameter file(s) seem(s) to be o.k.\n" 2668 fi 2669 rm -rf $check_sources 2670 fi 2671 else 2672 printf "\n\n +++ skipping parameter file check\n" 2673 fi 2674 2675 cd $working_directory 2676 2677 # FALLS AUF DIESER MASCHINE GERECHNET WERDEN SOLL, WERDEN JETZT ENTSPRE- 2678 # CHENDE AKTIONEN DURCHGEFUEHRT 2402 2679 if [[ $do_batch = false ]] 2403 2680 then … … 2588 2865 [[ "$module_calls" != "" ]] && eval $module_calls 2589 2866 make $mopts -f Makefile PROG=a.out F90=$compiler_name COPT="$cpp_options" F90FLAGS="$fopts" LDFLAGS="$lopts" 2867 2590 2868 fi 2591 2869
Note: See TracChangeset
for help on using the changeset viewer.