|
|
Setting up program environments in batch mode/prog/setup Setup script for all crystallography software
/prog/setup is FOSS and part of a SourceForge project called ProgPorts, which is maintained by myself and Robert Campbell. There are some things to keep in mind when running /prog/setup as a shell command to execute a program, either interactively or in batch (i.e. with "qsub"). First, the environment and path variables must be passed to the shell that is actually running the program. Normally one uses the source script_name command within the csh or tcsh shells to do this, because source executes the commands in the script without creating a new shell. Therefore any new environment variables that get set in the script are then set within the shell. That is why you must neither execute it directly as /prog/setup program_name nor, nor as an argument to a shell; csh /prog/setup program_name. Instead, use the following form of execution with the source command. source /prog/setup program_name Another common problem is getting the "setup" script to recognize the command line argument (i.e. the name of the program for which you wish to set up the environment). The latter does not seem to work properly when running in the csh shell. I have tested the source /prog/setup program_name command in a script and have found that it only works correctly within the tcsh. Hence one can do: tcsh -f my_scriptor if the first line of the script is #! /bin/tcsh -f just: my_scriptin which the script also contains: source /prog/setup program_namebefore the program is run. This will work, whether your script is run interactively or submitted to a batch queue (e.g. qsub -q long my_script, or qsub -q verylong -s /bin/tcsh my_script . Do a man qsub for more details on the options to the qsub program). The "-f" flag means "fast start" and neither your ~/.cshrc nor ~/.login scripts, if a login shell, will be sourced. For example, to run the CCP4 version 3.5 program dm: #! /bin/tcsh -f source /prog/setup ccp4_v35 dm hklin ../protein_1.mtz hklout protein_1_dm_1.mtz << EOF-DM labin FP=Fp SIGFP=SIGFp PHIO=PHIC FOMO=FOM FREE=FreeR_flag solc 0.35 combine omit sets 20 mode solv hist mult ncycle auto EOF-DM Instead of sourcing the setup script within your program script, you can put source /prog/setup program_namein your .cshrc, and remove the "-f" from the "#! /bin/tcsh" shell invocation and your program script will have the environment variables correctly defined. Note that only your ~/.cshrc and not your ~/.login is sourced when you simply execute a script or run the script using the batch command using: tcsh my_scriptand so you are better to put any source /prog/setup program_name commands into your ~/.cshrc file and not in your ~/.login file. Qsub on the other hand does source both your ~/.cshrc and ~/.login files. Last revised: Friday, 18-Aug-2006 13:59:40 EDT |
|