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
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML3.2 EN">
<HTML>
<HEAD> <link rel="canonical" href="http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Sys/PetscPrefetchBlock.html" />
<META NAME="GENERATOR" CONTENT="DOCTEXT">
<TITLE>PetscPrefetchBlock</TITLE>
</HEAD>
<BODY BGCOLOR="FFFFFF">
<div id="version" align=right><b>petsc-3.4.2 2013-07-02</b></div>
<A NAME="PetscPrefetchBlock"><H1>PetscPrefetchBlock</H1></A>
Prefetches a block of memory
<H3><FONT COLOR="#CC3333">Synopsis</FONT></H3>
<PRE>
#include "petscsys.h"
void PetscPrefetchBlock(const anytype *a,size_t n,int rw,int t)
</PRE>
Not Collective
<P>
<H3><FONT COLOR="#CC3333">Input Parameters</FONT></H3>
<TABLE border="0" cellpadding="0" cellspacing="0">
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>a </B></TD><TD>- pointer to first element to fetch (any type but usually <A HREF="../Sys/PetscInt.html#PetscInt">PetscInt</A> or <A HREF="../Sys/PetscScalar.html#PetscScalar">PetscScalar</A>)
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>n </B></TD><TD>- number of elements to fetch
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>rw </B></TD><TD>- 1 if the memory will be written to, otherwise 0 (ignored by many processors)
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>t </B></TD><TD>- temporal locality (PETSC_PREFETCH_HINT_{NTA,T0,T1,T2}), see note
</TD></TR></TABLE>
<P>
<P>
<H3><FONT COLOR="#CC3333">Notes</FONT></H3>
The last two arguments (rw and t) must be compile-time constants.
<P>
Adopting Intel's x86/x86-64 conventions, there are four levels of temporal locality. Not all architectures offer
equivalent locality hints, but the following macros are always defined to their closest analogue.
<TABLE border="0" cellpadding="0" cellspacing="0">
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>PETSC_PREFETCH_HINT_NTA </B></TD><TD>- Non-temporal. Prefetches directly to L1, evicts to memory (skips higher level cache unless it was already there when prefetched).
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>PETSC_PREFETCH_HINT_T0 </B></TD><TD>- Fetch to all levels of cache and evict to the closest level. Use this when the memory will be reused regularly despite necessary eviction from L1.
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>PETSC_PREFETCH_HINT_T1 </B></TD><TD>- Fetch to level 2 and higher (not L1).
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>PETSC_PREFETCH_HINT_T2 </B></TD><TD>- Fetch to high-level cache only. (On many systems, T0 and T1 are equivalent.)
</TD></TR></TABLE>
<P>
This function does nothing on architectures that do not support prefetch and never errors (even if passed an invalid
address).
<P>
<P><B><P><B><FONT COLOR="#CC3333">Level:</FONT></B>developer
<BR><FONT COLOR="#CC3333">Location:</FONT></B><A HREF="../../../include/petscsys.h.html#PetscPrefetchBlock">include/petscsys.h</A>
<BR><A HREF="./index.html">Index of all Sys routines</A>
<BR><A HREF="../../index.html">Table of Contents for all manual pages</A>
<BR><A HREF="../singleindex.html">Index of all manual pages</A>
</BODY></HTML>
|