1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128
|
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<!--Converted with LaTeX2HTML 96.1-h (September 30, 1996) by Nikos Drakos (nikos@cbl.leeds.ac.uk), CBLU, University of Leeds -->
<HTML>
<HEAD>
<TITLE>Contexts</TITLE>
<META NAME="description" CONTENT="Contexts">
<META NAME="keywords" CONTENT="slug">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<LINK REL=STYLESHEET HREF="slug.css">
</HEAD>
<BODY LANG="EN" >
<A NAME="tex2html3070" HREF="node72.html"><IMG WIDTH=37 HEIGHT=24 ALIGN=BOTTOM ALT="next" SRC="http://www.netlib.org/utk/icons/next_motif.gif"></A> <A NAME="tex2html3068" HREF="node69.html"><IMG WIDTH=26 HEIGHT=24 ALIGN=BOTTOM ALT="up" SRC="http://www.netlib.org/utk/icons/up_motif.gif"></A> <A NAME="tex2html3062" HREF="node70.html"><IMG WIDTH=63 HEIGHT=24 ALIGN=BOTTOM ALT="previous" SRC="http://www.netlib.org/utk/icons/previous_motif.gif"></A> <A NAME="tex2html3072" HREF="node1.html"><IMG WIDTH=65 HEIGHT=24 ALIGN=BOTTOM ALT="contents" SRC="http://www.netlib.org/utk/icons/contents_motif.gif"></A> <A NAME="tex2html3073" HREF="node190.html"><IMG WIDTH=43 HEIGHT=24 ALIGN=BOTTOM ALT="index" SRC="http://www.netlib.org/utk/icons/index_motif.gif"></A> <BR>
<B> Next:</B> <A NAME="tex2html3071" HREF="node72.html">Scoped Operations</A>
<B>Up:</B> <A NAME="tex2html3069" HREF="node69.html">Basics</A>
<B> Previous:</B> <A NAME="tex2html3063" HREF="node70.html">Process Grid</A>
<BR> <P>
<H2><A NAME="SECTION04412000000000000000">Contexts</A></H2>
<A NAME="secblacscontext"> </A>
<P>
In ScaLAPACK, and thus the BLACS,
each process grid is enclosed in a
context<A NAME="2291"> </A><A NAME="2292"> </A>.
Similarly, a context is associated
with every global matrix in ScaLAPACK.
The use of a context provides the
ability to have separate ``universes''
of message passing. This means that
a process grid can safely communicate
even if other (possibly overlapping)
process grids are also communicating.
Thus, a context is a powerful mechanism
for avoiding unintentional nondeterminism
in message passing and provides support
for the design of safe, modular software
libraries. In MPI<A NAME="2293"> </A><A NAME="2294"> </A>,
this concept is referred to as a
<EM>communicator</EM>.
<P>
A context partitions the communication
space. A message sent from one context
cannot be received in another context.
The use of separate communication
contexts by distinct libraries (or
distinct library routine invocations)
insulates communication internal to a
specific library routine from external
communication that may be going on within
the user's program.
<P>
In most respects, we can use the terms
<EM>process grid</EM> and <EM>context</EM>
interchangeably. For example, we may
say we perform an operation ``in context X''
or ``in process grid X''. The slight
difference here is that the user may
define two identical process grids
(say, two <IMG WIDTH=37 HEIGHT=24 ALIGN=MIDDLE ALT="tex2html_wrap_inline14534" SRC="img252.gif"> process grids,
both of which use processes 0, 1, and 2),
but each will be enclosed in its own
context, so that they are distinct in
operation, even though they are
indistinguishable from a process
grid standpoint.
<P>
Another example of the use of context
might be to define a normal two-dimensional
process grid within which most computation
takes place. However, in certain portions
of the code it may be more convenient to
access the processes as a one-dimensional
process grid, whereas at other times we may
wish, for instance, to share information
among nearest neighbors. In such cases,
we will want each process to have access
to three contexts: the two-dimensional
process grid, the one-dimensional process
grid, and a small process grid that contains
the process and its nearest neighbors.
<P>
Therefore, we see that context allows us to
<UL>
<LI> create arbitrary groups of processes,
<LI> create an indeterminate number of overlapping
and/or disjoint process grids, and
<LI> isolate the process grid so that they do not
interfere with each other.
</UL>
<P>
The BLACS has two process grid
creation<A NAME="2300"> </A>
routines, <TT>BLACS_GRIDINIT</TT> and
<TT>BLACS_GRIDMAP</TT>,<A NAME="2303"> </A><A NAME="2304"> </A><A NAME="2305"> </A>
that create a process grid and its
enclosing context. These routines
return context handles<A NAME="2306"> </A><A NAME="2307"> </A>,
which are simple integers, assigned by
the BLACS to identify the context.
Subsequent BLACS routines will be
passed these handles, which allow
the BLACS to determine from which
context/process grid a routine is
being called. The user <EM>should
never alter or change these handles;</EM>
they are opaque data objects that are
only meaningful for the BLACS routines.
<P>
A defined context consumes resources.
It is therefore advisable to release
contexts when they are no longer needed.
This release is done via the routine
<TT>BLACS_GRIDEXIT</TT><A NAME="2310"> </A>.
When the entire BLACS system is shut down
(via a call to <TT>BLACS_EXIT</TT><A NAME="2312"> </A>),
all outstanding contexts are automatically
freed. Further details about these
routines can be found in Appendix <A HREF="node185.html#chapqrefblacs">D.3</A>.
<P>
<HR><A NAME="tex2html3070" HREF="node72.html"><IMG WIDTH=37 HEIGHT=24 ALIGN=BOTTOM ALT="next" SRC="http://www.netlib.org/utk/icons/next_motif.gif"></A> <A NAME="tex2html3068" HREF="node69.html"><IMG WIDTH=26 HEIGHT=24 ALIGN=BOTTOM ALT="up" SRC="http://www.netlib.org/utk/icons/up_motif.gif"></A> <A NAME="tex2html3062" HREF="node70.html"><IMG WIDTH=63 HEIGHT=24 ALIGN=BOTTOM ALT="previous" SRC="http://www.netlib.org/utk/icons/previous_motif.gif"></A> <A NAME="tex2html3072" HREF="node1.html"><IMG WIDTH=65 HEIGHT=24 ALIGN=BOTTOM ALT="contents" SRC="http://www.netlib.org/utk/icons/contents_motif.gif"></A> <A NAME="tex2html3073" HREF="node190.html"><IMG WIDTH=43 HEIGHT=24 ALIGN=BOTTOM ALT="index" SRC="http://www.netlib.org/utk/icons/index_motif.gif"></A> <BR>
<B> Next:</B> <A NAME="tex2html3071" HREF="node72.html">Scoped Operations</A>
<B>Up:</B> <A NAME="tex2html3069" HREF="node69.html">Basics</A>
<B> Previous:</B> <A NAME="tex2html3063" HREF="node70.html">Process Grid</A>
<P><ADDRESS>
<I>Susan Blackford <BR>
Tue May 13 09:21:01 EDT 1997</I>
</ADDRESS>
</BODY>
</HTML>
|