Files
pj2/doc/edu/rit/gpu/GpuShortArray.html
2016-04-27 01:07:35 -04:00

373 lines
17 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (version 1.7.0_51) on Wed Apr 06 13:11:03 EDT 2016 -->
<title>GpuShortArray (Parallel Java 2 Library Documentation)</title>
<meta name="date" content="2016-04-06">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="GpuShortArray (Parallel Java 2 Library Documentation)";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/GpuShortArray.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../index-files/index-1.html">Index</a></li>
<li><a href="../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../edu/rit/gpu/GpuNotSupportedException.html" title="class in edu.rit.gpu"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../edu/rit/gpu/GpuShortMatrix.html" title="class in edu.rit.gpu"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?edu/rit/gpu/GpuShortArray.html" target="_top">Frames</a></li>
<li><a href="GpuShortArray.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li><a href="#field_summary">Field</a>&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li><a href="#field_detail">Field</a>&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">edu.rit.gpu</div>
<h2 title="Class GpuShortArray" class="title">Class GpuShortArray</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</a></li>
<li>
<ul class="inheritance">
<li><a href="../../../edu/rit/gpu/GpuVbl.html" title="class in edu.rit.gpu">edu.rit.gpu.GpuVbl</a></li>
<li>
<ul class="inheritance">
<li><a href="../../../edu/rit/gpu/GpuArray.html" title="class in edu.rit.gpu">edu.rit.gpu.GpuArray</a></li>
<li>
<ul class="inheritance">
<li>edu.rit.gpu.GpuShortArray</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<br>
<pre>public class <span class="strong">GpuShortArray</span>
extends <a href="../../../edu/rit/gpu/GpuArray.html" title="class in edu.rit.gpu">GpuArray</a></pre>
<div class="block">Class GpuShortArray provides a short integer array GPU variable. This is an
array of type <TT>short</TT> stored in the GPU's memory and mirrored in the
CPU's memory.
<P>
Class GpuShortArray supports mirroring all of the GPU's data array in the
CPU's memory, mirroring only a portion of the GPU's data array in the CPU's
memory, or mirroring none of the GPU's data array. Class GpuShortArray
provides operations for copying all or portions of the data array from the
CPU to the GPU or from the GPU to the CPU.
<P>
To use a short integer array GPU variable:
<OL TYPE=1>
<P><LI>
Construct an instance of class GpuShortArray by calling either the <a href="../../../edu/rit/gpu/Gpu.html#getShortArray(int)"><code>getShortArray()</code></a> method on a <a href="../../../edu/rit/gpu/Gpu.html" title="class in edu.rit.gpu">Gpu</a>
object or the <a href="../../../edu/rit/gpu/Module.html#getShortArray(java.lang.String, int)"><code>getShortArray()</code></a> method
on a <a href="../../../edu/rit/gpu/Module.html" title="class in edu.rit.gpu">Module</a> object, specifying the length of the array
and (optionally) the length of the array portion mirrored in the CPU.
<P><LI>
Set the <a href="../../../edu/rit/gpu/GpuShortArray.html#item"><code>item</code></a> field's elements to the desired values. Call the
<a href="../../../edu/rit/gpu/GpuArray.html#hostToDev()"><code>hostToDev()</code></a> method to copy the mirrored portion of the
array from CPU memory to GPU memory.
<P><LI>
Pass the GpuShortArray object as an argument of a GPU kernel function call.
In the GPU code, this becomes a pointer (type <TT>short int*</TT> or
<TT>unsigned short int*</TT>) to an array of <I>N</I> data elements, where
<I>N</I> is the length of the array. The GPU code sets the array's elements
to the desired values.
<P><LI>
Call the <a href="../../../edu/rit/gpu/GpuArray.html#devToHost()"><code>devToHost()</code></a> method to copy the mirrored portion
of the array from GPU memory to CPU memory. Examine the values of the <a href="../../../edu/rit/gpu/GpuShortArray.html#item"><code>item</code></a> field's elements.
</OL></div>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- =========== FIELD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="field_summary">
<!-- -->
</a>
<h3>Field Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Field Summary table, listing fields, and an explanation">
<caption><span>Fields</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Field and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>short[]</code></td>
<td class="colLast"><code><strong><a href="../../../edu/rit/gpu/GpuShortArray.html#item">item</a></strong></code>
<div class="block">The mirrored portion of the short integer array in CPU memory.</div>
</td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method_summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span>Methods</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../edu/rit/gpu/GpuShortArray.html#devToHost(int, int, int)">devToHost</a></strong>(int&nbsp;dstindex,
int&nbsp;srcindex,
int&nbsp;len)</code>
<div class="block">Copy the given portion of this GPU array from the GPU device's memory to
the host CPU's memory.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../edu/rit/gpu/GpuShortArray.html#hostToDev(int, int, int)">hostToDev</a></strong>(int&nbsp;dstindex,
int&nbsp;srcindex,
int&nbsp;len)</code>
<div class="block">Copy the given portion of this GPU array from the host CPU's memory to
the GPU device's memory.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_edu.rit.gpu.GpuArray">
<!-- -->
</a>
<h3>Methods inherited from class&nbsp;edu.rit.gpu.<a href="../../../edu/rit/gpu/GpuArray.html" title="class in edu.rit.gpu">GpuArray</a></h3>
<code><a href="../../../edu/rit/gpu/GpuArray.html#cpuLength()">cpuLength</a>, <a href="../../../edu/rit/gpu/GpuArray.html#devToHost()">devToHost</a>, <a href="../../../edu/rit/gpu/GpuArray.html#devToHost(int)">devToHost</a>, <a href="../../../edu/rit/gpu/GpuArray.html#hostToDev()">hostToDev</a>, <a href="../../../edu/rit/gpu/GpuArray.html#hostToDev(int)">hostToDev</a>, <a href="../../../edu/rit/gpu/GpuArray.html#length()">length</a></code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_edu.rit.gpu.GpuVbl">
<!-- -->
</a>
<h3>Methods inherited from class&nbsp;edu.rit.gpu.<a href="../../../edu/rit/gpu/GpuVbl.html" title="class in edu.rit.gpu">GpuVbl</a></h3>
<code><a href="../../../edu/rit/gpu/GpuVbl.html#finalize()">finalize</a>, <a href="../../../edu/rit/gpu/GpuVbl.html#free()">free</a></code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class&nbsp;java.lang.<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></h3>
<code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#clone()" title="class or interface in java.lang">clone</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang">equals</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang">getClass</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang">hashCode</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang">notify</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#notifyAll()" title="class or interface in java.lang">notifyAll</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#toString()" title="class or interface in java.lang">toString</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang">wait</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang">wait</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#wait(long, int)" title="class or interface in java.lang">wait</a></code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ FIELD DETAIL =========== -->
<ul class="blockList">
<li class="blockList"><a name="field_detail">
<!-- -->
</a>
<h3>Field Detail</h3>
<a name="item">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>item</h4>
<pre>public final&nbsp;short[] item</pre>
<div class="block">The mirrored portion of the short integer array in CPU memory.</div>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method_detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="hostToDev(int, int, int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>hostToDev</h4>
<pre>public&nbsp;void&nbsp;hostToDev(int&nbsp;dstindex,
int&nbsp;srcindex,
int&nbsp;len)</pre>
<div class="block">Copy the given portion of this GPU array from the host CPU's memory to
the GPU device's memory. <TT>len</TT> elements starting at index
<TT>srcindex</TT> in the CPU array are copied to the GPU array starting
at index <TT>dstindex</TT>.</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../edu/rit/gpu/GpuArray.html#hostToDev(int, int, int)">hostToDev</a></code>&nbsp;in class&nbsp;<code><a href="../../../edu/rit/gpu/GpuArray.html" title="class in edu.rit.gpu">GpuArray</a></code></dd>
<dt><span class="strong">Parameters:</span></dt><dd><code>dstindex</code> - GPU array starting index.</dd><dd><code>srcindex</code> - CPU array starting index.</dd><dd><code>len</code> - Number of elements to copy.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/IndexOutOfBoundsException.html?is-external=true" title="class or interface in java.lang">IndexOutOfBoundsException</a></code> - (unchecked exception) Thrown if <TT>dstindex</TT> &lt; 0,
<TT>srcindex</TT> &lt; 0, <TT>len</TT> &lt; 0, <TT>dstindex+len</TT>
&gt; <TT>length()</TT>, or <TT>srcindex+len</TT> &gt;
<TT>cpuLength()</TT>.</dd>
<dd><code><a href="../../../edu/rit/gpu/GpuException.html" title="class in edu.rit.gpu">GpuException</a></code> - (unchecked exception) Thrown if a GPU error occurred.</dd></dl>
</li>
</ul>
<a name="devToHost(int, int, int)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>devToHost</h4>
<pre>public&nbsp;void&nbsp;devToHost(int&nbsp;dstindex,
int&nbsp;srcindex,
int&nbsp;len)</pre>
<div class="block">Copy the given portion of this GPU array from the GPU device's memory to
the host CPU's memory. <TT>len</TT> elements copied starting at index
<TT>srcindex</TT> in the GPU array are copied to the CPU array starting
at index <TT>dstindex</TT>.</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../edu/rit/gpu/GpuArray.html#devToHost(int, int, int)">devToHost</a></code>&nbsp;in class&nbsp;<code><a href="../../../edu/rit/gpu/GpuArray.html" title="class in edu.rit.gpu">GpuArray</a></code></dd>
<dt><span class="strong">Parameters:</span></dt><dd><code>dstindex</code> - CPU array starting index.</dd><dd><code>srcindex</code> - GPU array starting index.</dd><dd><code>len</code> - Number of elements to copy.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/IndexOutOfBoundsException.html?is-external=true" title="class or interface in java.lang">IndexOutOfBoundsException</a></code> - (unchecked exception) Thrown if <TT>dstindex</TT> &lt; 0,
<TT>srcindex</TT> &lt; 0, <TT>len</TT> &lt; 0, <TT>dstindex+len</TT>
&gt; <TT>cpuLength()</TT>, or <TT>srcindex+len</TT> &gt;
<TT>length()</TT>.</dd>
<dd><code><a href="../../../edu/rit/gpu/GpuException.html" title="class in edu.rit.gpu">GpuException</a></code> - (unchecked exception) Thrown if a GPU error occurred.</dd></dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/GpuShortArray.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../index-files/index-1.html">Index</a></li>
<li><a href="../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../edu/rit/gpu/GpuNotSupportedException.html" title="class in edu.rit.gpu"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../edu/rit/gpu/GpuShortMatrix.html" title="class in edu.rit.gpu"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?edu/rit/gpu/GpuShortArray.html" target="_top">Frames</a></li>
<li><a href="GpuShortArray.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li><a href="#field_summary">Field</a>&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li><a href="#field_detail">Field</a>&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small><FONT SIZE="-2">Copyright &copy; 2013&ndash;2016 by Alan Kaminsky. All rights reserved. Send comments to ark</FONT><FONT SIZE="1" COLOR="#FFFFFF">&shy;</FONT><FONT SIZE="-2">&#64;</FONT><FONT SIZE="1" COLOR="#FFFFFF">&shy;</FONT><FONT SIZE="-2">cs.rit.edu.</FONT></small></p>
</body>
</html>