Professor Norm Matloff
Dept. of Computer Science
University of California at Davis
Davis, CA 95616
(Please mail any questions to Norm Matloff.)
Contents:
To install p4, type
make all P4ARCH=
where
You can then type
Add a statement like
to your .cshrc file. (This is just an example. Set P4_HOME_DIR to
whichever directory contains the p4 lib, include, etc. directories.)
Later, when you compile and run p4 applications, make sure that
they are in your shell search path.
Set up the following alias:
(This should all be on one line.)
A typical command line for execution of a binary x would be something like
where the -p4pg flag states that the next file is a "procgroup"
("process group") startup_file of the form
The "local" machine is the one you run the program from. It is
considered node 0, and the rest are nodes 1, 2 and so on, in the
order listed. These node numbers are reflected in the calls
to p4_get_my_id() and p4_dprintf(). The program will definitely
run on node 0, and then create processes as needed on the other
nodes.
Note carefully that all the output from printf() calls will be collected
and printed at whichever machine you started it. These may be
interspersed together from different nodes, making your output difficult
or impossible to read. (Note: This interspersing of printf() outputs
is quite common in parallel systems.)
Don't use printf() calls for most of your debugging. Your debugging
will be much easier and faster if you use a debugging tool, such as
gdb. To use gdb with p4, follow
the directions given in my parallel debugging
guide, at http://heather.cs.ucdavis.edu/~matloff/pardebug.html.
ALL_DIRS = $(P4_DIRS) $(EXAMPLES_DIRS) \
doc usc/usctest misc
make clean
to remove unneeded files.
Environment and Path
setenv P4_HOME_DIR ~matloff/Pub/P4
Compiling p4 application programs:
alias p4cc "gcc -g -I$P4_HOME_DIR/include -o \!* \!*.c
-L$P4_HOME_DIR/lib/libp4.a -lp4"
Running p4 application programs:
x -p4pg startup_file
local 0
machine_name1 1 full_path_executable_file_name
machine_name2 1 full_path_executable_file_name
machine_name3 1 full_path_executable_file_name
machine_name4 1 full_path_executable_file_name
etc.
Output
Debugging: