📄 node88.html
字号:
<html><!DOCTYPE HTML PUBLIC "-//W3O//DTD W3 HTML 2.0//EN">
<!Converted with LaTeX2HTML 95.1 (Fri Jan 20 1995) by Nikos Drakos (nikos@cbl.leeds.ac.uk), CBLU, University of Leeds >
<HEAD>
<TITLE>7.6 Other HPF Features</TITLE>
</HEAD>
<BODY>
<meta name="description" value="7.6 Other HPF Features">
<meta name="keywords" value="book">
<meta name="resource-type" value="document">
<meta name="distribution" value="global">
<P>
<BR> <HR><a href="msgs0.htm#2" tppabs="http://www.dit.hcmut.edu.vn/books/system/par_anl/tppmsgs/msgs0.htm#2"><img ALIGN=MIDDLE src="asm_color_tiny.gif" tppabs="http://www.dit.hcmut.edu.vn/books/system/par_anl/asm_color_tiny.gif" alt="[DBPP]"></a> <A NAME=tex2html3012 HREF="node87.html" tppabs="http://www.dit.hcmut.edu.vn/books/system/par_anl/node87.html"><IMG ALIGN=MIDDLE ALT="previous" SRC="previous_motif.gif" tppabs="http://www.dit.hcmut.edu.vn/books/system/par_anl/previous_motif.gif"></A> <A NAME=tex2html3020 HREF="node89.html" tppabs="http://www.dit.hcmut.edu.vn/books/system/par_anl/node89.html"><IMG ALIGN=MIDDLE ALT="next" SRC="next_motif.gif" tppabs="http://www.dit.hcmut.edu.vn/books/system/par_anl/next_motif.gif"></A> <A NAME=tex2html3018 HREF="node82.html" tppabs="http://www.dit.hcmut.edu.vn/books/system/par_anl/node82.html"><IMG ALIGN=MIDDLE ALT="up" SRC="up_motif.gif" tppabs="http://www.dit.hcmut.edu.vn/books/system/par_anl/up_motif.gif"></A> <A NAME=tex2html3022 HREF="node1.html" tppabs="http://www.dit.hcmut.edu.vn/books/system/par_anl/node1.html"><IMG ALIGN=MIDDLE ALT="contents" SRC="contents_motif.gif" tppabs="http://www.dit.hcmut.edu.vn/books/system/par_anl/contents_motif.gif"></A> <A NAME=tex2html3023 HREF="node133.html" tppabs="http://www.dit.hcmut.edu.vn/books/system/par_anl/node133.html"><IMG ALIGN=MIDDLE ALT="index" SRC="index_motif.gif" tppabs="http://www.dit.hcmut.edu.vn/books/system/par_anl/index_motif.gif"></A> <a href="msgs0.htm#3" tppabs="http://www.dit.hcmut.edu.vn/books/system/par_anl/tppmsgs/msgs0.htm#3"><img ALIGN=MIDDLE src="search_motif.gif" tppabs="http://www.dit.hcmut.edu.vn/books/system/par_anl/search_motif.gif" alt="[Search]"></a> <BR>
<B> Next:</B> <A NAME=tex2html3021 HREF="node89.html" tppabs="http://www.dit.hcmut.edu.vn/books/system/par_anl/node89.html">7.7 Performance Issues</A>
<B>Up:</B> <A NAME=tex2html3019 HREF="node82.html" tppabs="http://www.dit.hcmut.edu.vn/books/system/par_anl/node82.html">7 High Performance Fortran</A>
<B> Previous:</B> <A NAME=tex2html3013 HREF="node87.html" tppabs="http://www.dit.hcmut.edu.vn/books/system/par_anl/node87.html">7.5 Dummy Arguments and Modularity</A>
<BR><HR><P>
<H1><A NAME=SECTION03460000000000000000>7.6 Other HPF Features</A></H1>
<P>
In this section, we discuss several miscellaneous aspects of HPF; we also
list HPF features not covered in this book.
<P>
<H2><A NAME=SECTION03461000000000000000>7.6.1 System Inquiry Intrinsic Functions</A></H2>
<P>
<A NAME=secinq> </A>
<P>
<A NAME=11277> </A>
HPF introduces a small set of intrinsic functions in addition to those
defined in F90. The two most relevant to parallel program
<A NAME=11278> </A>
design are the system inquiry functions <tt> NUMBER_OF_PROCESSORS</tt> and
<A NAME=11280> </A>
<tt> PROCESSORS_SHAPE</tt>. These functions allow a program to obtain
information about the <em> number
</em> of physical processors on
which it executes and the <em> topology
</em> connecting these
processors. This information can be used to write
programs that run efficiently on varying numbers of processors and
processor configuration. The functions are modeled on the F90 inquiry
functions <tt> SIZE</tt> and <tt> SHAPE</tt>, respectively, and provide a view
of the underlying computer as a rectilinear, multidimensional
processor array. A call to <tt> NUMBER_OF_PROCESSORS</tt> has the
general form
<tt> NUMBER_OF_PROCESSORS(dim)</tt>
<P>
where <tt> dim</tt> is an optional argument. A call to this function
returns the number of processors in the underlying array or, if the
optional argument is present, the size of this array along a specified
dimension. A call to <tt> PROCESSORS_SHAPE</tt> has the following
general form.
<tt> PROCESSORS_SHAPE()</tt>
<P>
It returns an array with rank (dimension) one and with size the rank
of the underlying processor array. The <em> i</em>
th element gives the
size of the underlying array in its <em> i</em>
th dimension.
<P>
<P><A NAME=11768> </A><IMG BORDER=0 ALIGN=BOTTOM ALT="" SRC="img979.gif" tppabs="http://www.dit.hcmut.edu.vn/books/system/par_anl/img979.gif">
<BR><STRONG>Figure 7.8:</STRONG> Examples of values returned by HPF system inquiry intrinsic
functions.
<A NAME=fighpfinq> </A><BR>
<P>
<P>
The representation of a particular physical computer as a
processor array is implementation dependent and not specified in HPF.
Two representative examples are presented in Figure <A HREF="node88.html#fighpfinq" tppabs="http://www.dit.hcmut.edu.vn/books/system/par_anl/node88.html#fighpfinq">7.8</A>.
System inquiry functions can be included in array declarations and HPF
directives, hence permitting a program to declare abstract processor
arrays that match available physical resources. For example, in the
following code the first directive declares an abstract processor
array <tt> P</tt> with size equal to the number of physical processors.
<A NAME=11305> </A>
The F90 inquiry function <tt> SIZE</tt> is then used to declare an integer
<A NAME=11307> </A>
array <tt> Q</tt> with size corresponding to the rank (dimension) of the
physical processor array.
<P>
<PRE> !HPF$ PROCESSORS P(NUMBER_OF_PROCESSORS())
integer Q(SIZE(PROCESSORS_SHAPE()))
</PRE>
<P>
<H2><A NAME=SECTION03462000000000000000>7.6.2 Storage and Sequence Association</A></H2>
<P>
<A NAME=secsequence> </A>
<P>
<A NAME=11311> </A>
Both F77 and F90 allow programmers to write programs that depend on a
<A NAME=11312> </A>
linear storage model, that is, a view of memory as linear, one
dimensional, and sequentially addressed. This is the case if a
program depends on <em> storage association</em>, using <tt> common</tt> or
<tt> equivalence</tt> statements to align storage locations. (This might
be done to reuse storage, for example.) It is also the case if a
<A NAME=11316> </A>
program relies on <em> sequence association</em>, for example, passing an
array as an actual argument and then declaring the corresponding dummy
argument to have a different size or shape.
<P>
Storage and sequence association are not natural concepts when data are
distributed over multiple processors.
<A NAME=11318> </A>
If always enforced in an HPF compiler, they could compromise performance.
<A NAME=11319> </A>
Therefore, HPF states that by
default, storage and sequence association are <em> not
</em>
supported. Hence, without the use of additional directives,
it not possible to do the following:
<OL><LI>
Pass an array element as an actual argument to a subroutine, and
declare the corresponding dummy argument to be an array.
<P>
<LI>
Pass an array or array section as an actual argument to a subroutine,
and declare the corresponding dummy argument to have a different size
or shape.
<P>
<LI>
Pass an assumed size array (an array declared with a dimension of <tt>
*</tt>, for example, <tt> DIMENSION(32,*)</tt>) as as an actual argument.
<P>
<LI>
Declare the same <tt> COMMON</tt> block to contain different variables in
different parts of a program, or use the <tt> EQUIVALENCE</tt> statement
except in certain restricted cases.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -