📄 p4.tex
字号:
%\documentstyle[11pt,titlepage,latexinfo,twoside]{article}\documentstyle[11pt,titlepage,latexinfo-1.2]{article}\textwidth=6.0in \textheight=9.0in\hoffset=-0.5in \voffset=-1.0in\parskip=.1in\pagestyle{empty}\begin{document}\bibliographystyle{plain}\newindex{cp}\newindex{fn}\begin{iftex}{\advance\leftskip 4.0in\noindentDistribution Category: \\Mathematics and \\ \null\nobreak\hspace{.25in} Computer Science (UC-405)\par}\begin{center}\vspace{.2in}{\largeARGONNE NATIONAL LABORATORY\\}9700 South Cass Avenue \\Argonne, IL 60439-4801\end{center}\vspace{.06in}\begin{center}{\large\bf-----------------\\ANL-92/17 \\-----------------\\}\end{center}\vskip .75 in\begin{center}{\Large\bfUser's Guide to the p4 Parallel Programming System}\end{center}\vskip .1 in\begin{center}by\end{center}\vskip .1in\begin{center}{\large \em Ralph Butler* and Ewing Lusk}\vskip .5 inMathematics and Computer Science Division\vskip 1.5 inOctober 1992 \\(Revised, April 1994)\end{center}\vfill\begin{quote}{\small This work was supported in part bythe Applied Mathematical Sciences subprogram of the Office of EnergyResearch underContract W-31-109-Eng-38.}\smallskip\noindent*Also of The University of North Florida, Department of Computer Science, Jacksonville, Florida\end{quote}\clearpage\end{iftex}\pagestyle{headings}\pagenumbering{roman}\tableofcontents\clearpage\addcontentsline{toc}{section}{Abstract}\vskip 3 in\begin{abstract} This is both the reference manual and the User's Guide for the p4 parallel programming system. It contains definitions of all functions for both C and Fortran, examples, a brief tutorial, and discussions of related systems.\end{abstract}\pagenumbering{arabic}\clearpage\setfilename{p4.info}\node Top, Introduction, (dir), (dir)\begin{ifinfo} The p4 Parallel Programming System Ralph Butler Ewing Lusk\begin{menu}* Introduction::* Structure of the Distribution Directory::* Installing p4::* Getting Started::* Specifying Processes in the Procgroup File::* Developing a Simple p4 Program::* Command-Line Arguments::* The p4 Function Library::* p4 Functions for Managing Processes and Clusters::* Functions for Message Passing::* Functions for Shared Memory::* Functions for Timing p4 Programs::* Functions for Debugging p4 Programs::* Miscellaneous Functions::* Fortran Interface::* Faster Startup with the Secure Server::* Utilities for Managing a p4 Session::* Creating Logfiles for Upshot::* Running p4 on Specific Machines::* Some Common Problems and their Solutions::* Concept Index::* Function Index:: --- The Detailed Node Listing ---Installing p4* Installing the p4 System::* Installing the Documentation::* Examples included with the Distribution::Getting Started* A Message-Passing Example::* Program Description::* Analysis of the Program::Developing a Simple p4 Program* A Minimal Example::* A Minimal Example in Fortran::* A More Complicated Example::The p4 Function Library* Overview of the Library::* Return Codes from p4 Functions::p4 Functions for Managing Processes and Clusters* Functions for Process Management::* Functions for Cluster Management::Functions for Message Passing* Explicit Sending and Receiving of Messages::* Global Operations::Functions for Shared Memory* Managing Shared and Local Memory::* Shared Memory Data Types::* Monitor-Building Primitives::* Some Useful Monitors::Creating Logfiles for Upshot* User-Specified Events::* Creating Log Files in Fortran::* Examining Log Files with Upshot::* Automatic Logging of p4 Events::Running p4 on Specific Machines* Invoking a p4 Program::* Machine-Specific Notes::\end{menu}\end{ifinfo}\node Introduction, Structure of the Distribution Directory, Top, Top\section{Introduction}P4 is a library of macros and subroutines developed at Argonne NationalLaboratory for programming a variety of parallel machines. A paperdescribing its functions and use is \cite{butler-lusk:p4-paper}. Itspredecessor was the m4-based ``Argonne macros'' system described in theHolt, Rinehart, and Winston book {\em Portable Programs for ParallelProcessors}, by Lusk, Overbeek, et al., from which p4 takes itsname\cite{lusk-overbeek:p4-book}. The current p4 system maintains thesame basic computational models described there (monitors for theshared-memory model, message-passing for the distributed-memory model,and support for combining the two models) while significantly increasingease and flexibility of use. \xref{Getting Started} for a simple example.P4 is intended to be portable, simple to install and use, and efficient. Itcan be used to program networks of workstations, advanced parallelsupercomputers like the Intel Touchstone Delta and the Alliant CampusHiPPI-based system, and single shared-memory multiprocessors. It hascurrently been installed on the following list of machines: Sequent Symmetry(Dynix and PTX), Convex, Encore Multimax, Alliant FX/8, FX/800, and FX/2800,Cray X/MP, Sun (SunOS and Solaris), NeXT, DEC, Silicon Graphics, HP, and IBMRS6000 workstations, Stardent Titan, BBN GP-1000 and TC-2000, Kendall Square,nCube, Intel IPSC/860, Intel Touchstone Delta, Intel Paragon, Alliant Campus,Thinking Machines' CM-5, and the IBM SP-1 (TCP/Ethernet, TCP/switch, EUI, andEUI-H). It is not difficult to port to new systems. Although p4 tries to becompletely portable, there are a small number of specific exceptions(\xref{Machine-Specific Notes}) that may need to be taken into account on agiven machine.You can obtain the complete distribution of p4 by anonymous ftp from\code{info.mcs.anl.gov} in the directory \file{pub/p4}. See the \code{README}file there for recent news on what is available. Take the file\file{p4-1.4.tar.Z}. The distribution contains all source code,installation instructions, this reference manual, and a collection of examplesin both C and Fortran. \code{Alog} is included in the distribution with p4.The file \file{upshot.tar.Z} contains display facilities that can be used withp4 and other systems.To ask questions about p4, report bugs, contribute examples, etc., you cansend mail to \code{p4@mcs.anl.gov}.The current release is version 1.4. You can check which version of the sourcecode you have by looking at the file \file{lib/p4_patchlevel.h} in thedistribution. You can check which version of the object code you have linkedto by running any p4 program with the command-line option \code{-p4version}(\xref{Command-Line Arguments}).Salient features of p4 include: \begin{itemize}\item support for both message-passing and explicit shared memory operations\item \code{xdr} support for heterogeneous networks\item World Wide Web version of the manual for on-line help\item SYSV IPC support for shared-memory multiprocessing on workstations that support multiple processors, and simulating it on uniprocessors\item instrumentation for automatic logging/tracing\item automatic or user control of message-passing/buffer-management\item error/interrupt handling\item an optional p4 server for quick startup on remote machines\end{itemize}A useful companion system is the \code{alog/upshot} logging and X-based traceexamination facility. (\xref{Creating Logfiles for Upshot}.)\node Structure of the Distribution Directory, Installing p4, Introduction, Top\section{Structure of the Distribution Directory}\cindex{directory structure}The p4 source code distribution contains the following files andsubdirectories:\cindex{OPTIONS}\begin{description}\item[CHANGES] Changes new to this release of p4.\item[Makefile] The makefile for making the p4 system, doing the installation, and making makefiles for user applications.\item[OPTIONS] A file controlling various compile-time options, such as whether System V shared-memory operations are to be enabled, whether system debug message printing is to be enabled, and whether automatic instrumentation of internal p4 operations for the \code{upshot} logging and tracing program is to be done. It also contains the full pathname of the listener to be used.\item[README] General instructions, including how to build and install pr.\item[alog] Source code for the ALOG tracing package.\item[bin] Scripts for starting and killing servers, killing runaway p4 processes, merging \code{upshot} logfiles, and other useful utilities.\item[contrib] Examples contributed by p4 users.\item[contrib_f] Fortran examples contributed by users.\item[doc] The man page, together with this manual and supporting files, including a reference card for p4 routines.\item[include] The include directory for making p4 applications. Most of these are (hard) links into the \code{lib} directory.\item[lib] The source code for the p4 system.\item[lib_f] The Fortran interface for p4. \item[messages] A basic set of message-passing examples in C.\item[messages_f] A basic set of message-passing examples in Fortran.\item[misc] A few odds and ends of programs that fit no special category. Some of these have been found useful during debugging.\item[monitors] A basic set of shared-memory examples in C.\item[servers] The secure and insecure servers.\item[usc] The portable microsecond clock routines.\item[util] Assorted supporting files, particularly for making the p4 distribution. \end{description}\node Installing p4, Getting Started, Structure of the Distribution Directory, Top\section{Installing p4}\cindex{installation}In this section we describe how to install the p4 library, either foryour own personal use or for the use of everyone at your site. In thefirst case you do not need any super-user privileges. In the secondcase, you may or may not, depending on how things are configured atyour site. We also describe how to install and run the examples thatcome with p4, the online help system (this manual as a World Wide Web document)and how to build a working directory for your own programs yet sharethe installed copy of p4 with other users.\begin{menu}* Installing the p4 System::* Installing the Documentation::* Examples included with the Distribution::\end{menu}\node Installing the p4 System, Installing the Documentation, Installing p4, Installing p4\subsection{Installing the p4 System}To build p4, position yourself in the top-level p4 directory (Here we refer tothis directory as \code{p4}, but you may have it as \code{p4-1.4} or somethingsimilar) and type:\begin{example}make all P4ARCH=<machine>\end{example}\noindentwhere <machine> is one of the machine names listed in\file{p4/util/machines}, currently:\cindex{machines}\begin{ifinfo}\begin{description}\item[SUN] Sun-3, Sun386i, Sparc-1, Sparc-2, or Sparc-10 workstations, running SunOS\item[SUN_SOLARIS] Sun workstations running Solaris\item[HP] HP workstations\item[DEC5000] Dec 5000 workstations\item[ALPHA] Dec Alpha workstations\item[NEXT] 68030- or 68040-based NeXT workstations\item[RS6000] IBM RS 6000 series workstations\item[LINUX] IBM-compatible PC's running the LINUX operating system\item[IBM3090] IBM 3090 running IBM's version of UNIX, AIX\item[BALANCE] Sequent Balance shared-memory multiprocessor\item[SYMMETRY] Sequent Symmetry shared-memory multiprocessor\item[SYMMETRY_PTX] Sequent Symmetry shared-memory multiprocessor PTX OS\item[MULTIMAX] Encore Multimax shared-memory multiprocessor\item[GP_1000] BBN GP-1000
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -