HP-MPI User's Guide (11th Edition)
Getting started
Getting started using HP-UX or Linux
Chapter 2 23
Step 2. Compile the hello_world executable file:
% $MPI_ROOT/bin/mpicc -o hello_world \
$MPI_ROOT/help/hello_world.c
Step 3. Run the hello_world executable file:
% $MPI_ROOT/bin/mpirun -np 4 hello_world
where -np 4 specifies 4 as the number of processes to run.
Step 4. Analyze hello_world output.
HP-MPI prints the output from running the hello_world executable in
non-deterministic order. The following is an example of the output:
Hello world! I'm 1 of 4 on jawbone
Hello world! I'm 3 of 4 on jawbone
Hello world! I'm 0 of 4 on jawbone
Hello world! I'm 2 of 4 on jawbone
For information on running more complex applications, refer to “Running
applications on HP-UX and Linux” on page 65.
Building and running on a Linux cluster using appfiles
The following is an example of basic compilation and run steps to execute
hello_world.c on a cluster with 4-way parallelism. To build and run
hello_world.c on a cluster using an appfile:
Step 1. Change to a writable directory.
Step 2. Compile the hello_world executable file:
% $MPI_ROOT/bin/mpicc -o hello_world \
$MPI_ROOT/help/hello_world.c
Step 3. Create a file "appfile" for running on nodes n01 and n02 as:
-h n01 -np 2 /path/to/hello_world
-h n02 -np 2 /path/to/hello_world
Step 4. Run the hello_world executable file:
% $MPI_ROOT/bin/mpirun -f appfile
By default, mpirun will rsh/remsh to the remote machines n01 and n02.
If desired, the environment variable MPI_REMSH can be used to specify a
different command, such as /usr/bin/ssh or "ssh -x".