![]() |
|
|
|
Running Parallel Programs on Truchas Cluster
Compilation Execution Example
Compilation To compile and link your MPI code in one step, use the appropriate command from the following: mpif77 -i mpich -c ch_p4 -- -o <progname> <filename>.f mpif90 -i mpich -c ch_p4 -- -o <progname> <filename>.f90 mpicc -i mpich -c ch_p4 -- -o <progname> <filename>.f mpiCC -i mpich -c ch_p4 -- -o <progname> <filename>.f Arguments after the double dash are passed to gcc, g77, or f95 directly and can be anything accepted by those compilers. The mpif90 script compiles both FORTRAN 90 and FORTRAN 95 programs.
Execution Before running the program you must construct a process group file in the directory where your executable is. This file is called <progname>.pg and should look something like this: local 0 trucha01 1 /complete/path/to/your/executable trucha02 1 /complete/path/to/your/executable trucha03 1 /complete/path/to/your/executable The first line specifies the number of processes on the local processor (in addition to the one that runs there by default). Each subsiquent line specifies the machines to use for the other processes, the number of processes on that processor, and the path to use to find the executable. It is advisable to use the ruptime command to choose the machines with the lightest load to use for your job. Note: A similar file is constructed automatically by the mpirun script on the IBM machines; this isn't yet set up on the cluster. Now run the executable. MPICH uses secure shell to launch a copy on each machine listed in the .pg file.
Example Suppose that the program hello.c is in the directory /linux. Compile: mpicc -i mpich -c ch_p4 -- -o hello hello.c The file hello.pg: local 0 trucha01 1 /linux/hello trucha02 1 /linux/hello truchag03 1 /linux/hello Run the program by typing "hello"
|
|
|