The P4 version of FASTLINK utilizes the shared-memory model. It has been successfully run on Sun multiprocessor workstations running Solaris, DEC Alphas running OSF, and SGI Challenges running IRIX. It will likely run with minor modifications on other platforms supported by P4. We are eager to provide portability assistance if you can provide us access to your shared-memory multiprocessor. Please note that while P4 message-passing programs can also be run on networks of workstations, P4 FASTLINK will not. If you are interested in running parallel FASTLINK on a network of UNIX workstations, please refer to the file README.parallel for more information.
ftp info.mcs.anl.govLogin as "anonymous", and use your full e-mail address as password.
cd pub/p4Remember to use binary mode for transfer. To retrieve the distribution:
bin get p4-1.4.tar.Z
uncompress p4-1.4.tar.Z tar xvf p4-1.4or
zcat p4-1.4.tar.Z | tar xvf -Then, go to the directory created.
cd p4-1.4The distribution contains all the source code, installation instructions, a complete reference manual, and a number of sample programs. Refer to the README in the directory doc for details about the documentation.
To build P4, you will need to specify the specific architecture of your machine. Type:
make P4ARCH=< machine >where
make P4ARCH=SUN_SOLARISThe default makefile uses the cc compiler. If you wish to use another compiler, you can edit the file util/defs.all. Look for the section corresponding to your architecture, and change the variables CC and CLINKER. If you have trouble compiling P4, please consult your system administrator for assistance.
To install, type:
make install INSTALLDIR=< dir >where < dir > is the directory where you want P4 to be installed. The directory you choose here will be the P4_HOME_DIR that you will need to supply in the FASTLINK Makefile.
/* #define SYSV_IPC */Since this line is commented out, by default P4 is always built *without* SYSV_IPC. If your system requires SYSV_IPC, you should change the above line to:
#define SYSV_IPCThis change, of course, must be made *before* compiling P4.
The P4 documentation states that in certain cases, you can build P4 with *or* without SYSV_IPC. From our experience, however, FASTLINK has specific requirements for each system that in each case mandate only one of these options. In general, with the exception of SOLARIS, it seems that shared-memory multiprocessors require SYSV_IPC in order to run FASTLINK properly. Refer to the following sections on building P4 for SOLARIS, IRIX, and OSF for details.
A final note on SYSV_IPC: due to the way this protocol allocates shared data, if a P4 run crashes before completion, some of the data may not be properly de-allocated. If a run crashes, you should use the "ipcs" utility to determine if there is any unclaimed data. The command:
ipcs -cwill tell you if you have any stray message queues, shared memory, or semaphores lying around. You can use the "ipcrm" command to remove any, should they exist. Consult your local documentation (man pages) for details.
On some systems, make might crash while building in the directory "alog", due to a header file that can have different names on different systems. Since FASTLINK does not make use of the alog package, you should just be able to restart make (using the same P4ARCH flag as before), and it should proceed smoothly until the end.
Make sure to read the notes in the section "Hooking FASTLINK and P4 Together" below that relate to SOLARIS.
First, note that for IRIX, P4 must be built *with* SYSV_IPC. Refer to the section "Building P4, Using SYSV_IPC" above for details. The make variable P4ARCH should be defined as SGI.
Next, from our experience, the linking flag -lsun automatically included in the Makefile did not work. You can disable this by editing the file defs.all in the P4 util directory. Look for the line:
# BEGIN SGIin defs.all. Eight lines below this, you will see the line:
MDEP_LIBS = -lsunComment this line out, by changing it to:
#MDEP_LIBS = -lsunMake sure that the line you comment out comes before the line:
# END SGIFinally, you must modify the source code for compilation. There are two ways you can do this:
First, if you have access to the unix "patch" utility, you can use the file p4_patchfile.IRIX found in the directory 3.0P/irix of the FASTLINK distribution to make these changes. First copy this file into the P4 distribution directory p4-1.4/lib. Then cd to this directory. Within the p4-1.4/lib directory, type:
patch < p4_patchfile.IRIXIn the event that you don't have patch available, you can make the modifications by hand. The files you need to change are in the lib directory in the P4 distribution. They are p4_secure.c, and p4_sock_cr.c. Only three lines of code need to be changed.
char *getpw(host, name)to:
char *p4_getpw(host, name)
char *getpw();to:
char *p4_getpw();
rc = start_slave(host, username, pgm, serv_port, am_slave_c, getpw);to:
rc = start_slave(host, username, pgm, serv_port, am_slave_c, p4_getpw);
Make sure to read the notes in the section "Hooking FASTLINK and P4 Together" below that relate to IRIX.
For OSF, P4 must be built *with* SYSV_IPC. Refer to the section "Building P4, Using SYSV_IPC" above for details. The make variable P4ARCH should be defined as ALPHA.
When running P4 FASTLINK, you may have to increase the maximum allowed size of a shared-memory block to run the code. This can be done by editing the /etc/sysconfigtab file and adding the following entry:
ipc:
shm-max = 16777216 (or whatever size you need, in bytes)
and rebooting.
When building the P4 version of FASTLINK, you will need to examine the following variables in the FASTLINK Makefile:
PARLIB = -DIS_P4=1
Make sure that the other definition of PARLIB is commented out.
PARINCLPATH = -I$(P4_INCLDIR)
Again, make sure that the other definition of PARINCLPATH is commented
out.
P4_HOME_DIR = /usr/lib/p4-1.4
P4_MDEP_LD = -lsocket -lnsl -lthread
as well as the line:
SYSDEP = -DSOLARIS
in order to successfully compile FASTLINK. If your compiler complains
about "undefined symbol"s, or about "EXIT_FAILURE redefined", it is
likely you have forgotten to uncomment one of these lines.
make ilink.p4 make linkmap.p4 make mlink.p4respectively. Alternately, you can build all three with:
make installp4These will put the corresponding executables wherever the BINDIR flag (described in README.makefile) points to.
ln -s ../bin/ilink.p4 ilinkThere are some compilation flags you may want to set to prepare for a run. See README.Makefile or the Makefile itself for instructions.
-nmust be appended, where
linkmapbecomes
linkmap -n 8When modifying lcp-produced scripts be careful that the first occurrence of the string ilink, linkmap, or mlink is a parameter to lsp, and therefore should not be altered. It is the second occurrence which is actually the call to the program, where the flag must be set.
If you use the automatic estimate of maxworkingset and the code complains that this estimate is too low, you have hit a bug and should report it (see README.bugreport). However, you can still use the -w flag to work around the bug, while I fix it.
For example, to run ILINK with maxworkingset defined to 40, you would type:
ilink -w 40The error message you would encounter if maxworkingset is too low will report what the current value is. You may try incrementally larger values until the run succeeds.
-p4gm < nbytes >where < nbytes > is the number of bytes of global memory to allocate. This parameter is really measured in bytes, not any larger units.
FASTLINK has been tuned to calculate in advance the amount of memory it will need, and to request the proper amount for you. In general, it will request a bit more memory than is actually needed, just to be safe. If, for some reason, a run fails because it does not have sufficient shared memory, or if your machine refuses to grant the amount FASTLINK specifies, you can override FASTLINK's calculation and specify the amount of global memory you would like with this flag. You can use the -m flag (described in the next section) to see how much memory FASTLINK is requesting, and try manually to request a bit less.
linkmap -n 2 -myielded:
LINKMAP is currently compiled with PRECOMPUTE=1.
Shared memory usage for this run will be as follows:
memory usage total request
calculated (including fudge factor)
----------------------------------------------
7441589 bytes 9301986 bytes
Recompiling with PRECOMPUTE=0 would yield:
memory usage total request
calculated (including fudge factor)
----------------------------------------------
6360069 bytes 7950086 bytes
Please refer to the README.makefile and README.p4 for details.
As was mentioned above in the section on "Specifying memory usage",
FASTLINK calculates how much memory a run is likely to require, and then
adds in a little extra (the fudge factor). You can see from this message
both the original amount calculated, and the amount of the final request.
You can use the amount calculated as a lower bound on reasonable requests
with -p4gm.
You can also see from this message the difference in memory usage between compiling with PRECOMPUTE=0 and PRECOMPUTE=1. This can be useful when determining whether or not you can expect to compute a given run on your system.
As with the -n flag above, -w, -p4gm, and -m would need to be added to your lcp-produced script if you use them in conjunction with a script.
Execution time (!parallelThetas) = 0.099 Execution time (parallelThetas) for 1 = 0.052 Execution time (parallelThetas) for 2 = 0.896 Execution time (parallelThetas) for 3 = 0.096 Execution time (!parallelThetas) = 0.086 Elapsed time: 1.28 secondsEach of the "Execution time" statements will appear one at a time as computation progresses. The difference between parallelThetas and !parallelThetas has to do with whether all processors are working together on a single theta, or whether they are working independently on different thetas. The "Elapsed time" statement shows the total execution time for the entire run.
In general, error messages produced by P4 will look like:
p4_error:where
p0_xxxxx: p4_error:where xxxxx is the pid (process id) of the FASTLINK program. Most any other error message you see is likely a FASTLINK error message.
If you encounter a P4 error message near the beginning of a run (ie, before the first theta evaluation is complete), and the program quits, it is likely that you do not have enough shared memory available for this run. Likewise, if you encounter a FASTLINK error message with the phrase "MALLOC ERROR", you need more memory. See the above section on "Analyzing memory usage" for possible remedies.
Another common problem is getting different results for a run on 1 processor, and the same run on more than 1 processor. If this happens to you, it is likely that you have not defined SYSV_IPC properly for your system. Please refer to the section above on "Using SYSV_IPC" for details.
If you encounter an error that you feel is not of the flavor described above, please send us as precise a description of the problem as possible (including output, etc.) so we can try to help discern the cause of the problem. Please refer to README.bugreport for guidlines on submitting a bug report.