Selective configuration with startup scripts
As part of running an application, the parallel engine creates a remote shell on all parallel engine processing nodes on which the application will be executed. The remote shells have the same configuration by default.
After the parallel engine creates the remote shell, it copies the environment from the system on which the application was invoked to each remote shell. This means that all remote shells have the same configuration by default.
However, you can override the default and set configuration parameters for individual processing nodes. To do so, you create a parallel engine startup script. If a startup script exists, the parallel engine runs it on all remote shells before it runs your application.
When you invoke an application, the parallel engine looks for the name and location of a startup script as in the following procedure.
- It uses the value of the APT_STARTUP_SCRIPT environment variable.
- It searches the current working directory
for a file named
startup.apt. - Searches for the file
install_dir/etc/startup.apton the system that invoked the parallel engine application, whereinstall_diris the top-level directory of the installation. - If the script is not found, it does not execute a startup script.
Here is a template you can use with Korn shell to write your own startup script.
#!/bin/ksh # specify Korn shell
# your shell commands go here
shift 2 # required for all shells
exec $* # required for all shells
You must include the last two lines of the shell script. This prevents your application from running if your shell script detects an error.
The following startup script for the Bourne shell prints the node name, time, and date for all processing nodes before your application is run:
#!/bin/sh # specify Bourne shell
echo `hostname` `date`
shift 2
exec $*
A single script can perform node-specific initialization by means of a case statement. In the following example, the system has two nodes named node1 and node2. This script performs initialization based on which node it is running on.
#!/bin/sh # use Bourne shell
# Example APT startup script.
case `hostname` in
node1)
# perform node1 init
node-specific directives
;;
node2)
# perform node2 init
node-specific directives
;;
esac
shift 2
exec $*
The parallel engine provides the APT_NO_STARTUP_SCRIPT environment variable to prevent the parallel engine from running the startup script. By default, the parallel engine executes the startup script. If the variable is set, the parallel engine ignores the startup script. This can be useful for debugging a startup script.