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

390 lines
19 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>GpuFloatMatrix (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="GpuFloatMatrix (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/GpuFloatMatrix.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/GpuFloatArray.html" title="class in edu.rit.gpu"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../edu/rit/gpu/GpuFloatVbl.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/GpuFloatMatrix.html" target="_top">Frames</a></li>
<li><a href="GpuFloatMatrix.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 GpuFloatMatrix" class="title">Class GpuFloatMatrix</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/GpuMatrix.html" title="class in edu.rit.gpu">edu.rit.gpu.GpuMatrix</a></li>
<li>
<ul class="inheritance">
<li>edu.rit.gpu.GpuFloatMatrix</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">GpuFloatMatrix</span>
extends <a href="../../../edu/rit/gpu/GpuMatrix.html" title="class in edu.rit.gpu">GpuMatrix</a></pre>
<div class="block">Class GpuFloatMatrix provides a float matrix GPU variable. This is a
two-dimensional array of type <TT>float</TT> stored in the GPU's memory and
mirrored in the CPU's memory.
<P>
Class GpuFloatMatrix supports mirroring all of the GPU's data matrix in the
CPU's memory, mirroring only a portion of the GPU's data matrix in the CPU's
memory, or mirroring none of the GPU's data matrix. Class GpuFloatMatrix
provides operations for copying all or portions of the data matrix from the
CPU to the GPU or from the GPU to the CPU.
<P>
To use a float matrix GPU variable:
<OL TYPE=1>
<P><LI>
Construct an instance of class GpuFloatMatrix by calling the <a href="../../../edu/rit/gpu/Gpu.html#getFloatMatrix(int, int)"><code>getFloatMatrix()</code></a> method on a <a href="../../../edu/rit/gpu/Gpu.html" title="class in edu.rit.gpu">Gpu</a> object, specifying the number of rows and columns in the matrix and
(optionally) the number of rows and columns in the matrix portion mirrored in
the CPU.
<P><LI>
Set the <a href="../../../edu/rit/gpu/GpuFloatMatrix.html#item"><code>item</code></a> field's elements to the desired values. Call the
<a href="../../../edu/rit/gpu/GpuMatrix.html#hostToDev()"><code>hostToDev()</code></a> method to copy the mirrored portion of the
matrix from CPU memory to GPU memory.
<P><LI>
Pass the GpuFloatMatrix object as an argument of a GPU kernel function call.
In the GPU code, this becomes a pointer (type <TT>float**</TT>) to an array
of <I>R</I> row pointers, where <I>R</I> is the number of rows in the matrix;
each row pointer points to an array of <I>C</I> data elements, where <I>C</I>
is the number of columns in the matrix. The GPU code sets the matrix's
elements to the desired values.
<P><LI>
Call the <a href="../../../edu/rit/gpu/GpuMatrix.html#devToHost()"><code>devToHost()</code></a> method to copy the mirrored portion
of the matrix from GPU memory to CPU memory. Examine the values of the <a href="../../../edu/rit/gpu/GpuFloatMatrix.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>float[][]</code></td>
<td class="colLast"><code><strong><a href="../../../edu/rit/gpu/GpuFloatMatrix.html#item">item</a></strong></code>
<div class="block">The mirrored portion of the float matrix 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/GpuFloatMatrix.html#devToHost(int, int, int, int, int, int)">devToHost</a></strong>(int&nbsp;dstrow,
int&nbsp;dstcol,
int&nbsp;srcrow,
int&nbsp;srccol,
int&nbsp;rowlen,
int&nbsp;collen)</code>
<div class="block">Copy the given portion of this GPU matrix 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/GpuFloatMatrix.html#hostToDev(int, int, int, int, int, int)">hostToDev</a></strong>(int&nbsp;dstrow,
int&nbsp;dstcol,
int&nbsp;srcrow,
int&nbsp;srccol,
int&nbsp;rowlen,
int&nbsp;collen)</code>
<div class="block">Copy the given portion of this GPU matrix 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.GpuMatrix">
<!-- -->
</a>
<h3>Methods inherited from class&nbsp;edu.rit.gpu.<a href="../../../edu/rit/gpu/GpuMatrix.html" title="class in edu.rit.gpu">GpuMatrix</a></h3>
<code><a href="../../../edu/rit/gpu/GpuMatrix.html#cols()">cols</a>, <a href="../../../edu/rit/gpu/GpuMatrix.html#cpuCols()">cpuCols</a>, <a href="../../../edu/rit/gpu/GpuMatrix.html#cpuRows()">cpuRows</a>, <a href="../../../edu/rit/gpu/GpuMatrix.html#devToHost()">devToHost</a>, <a href="../../../edu/rit/gpu/GpuMatrix.html#devToHost(int, int)">devToHost</a>, <a href="../../../edu/rit/gpu/GpuMatrix.html#hostToDev()">hostToDev</a>, <a href="../../../edu/rit/gpu/GpuMatrix.html#hostToDev(int, int)">hostToDev</a>, <a href="../../../edu/rit/gpu/GpuMatrix.html#rows()">rows</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;float[][] item</pre>
<div class="block">The mirrored portion of the float matrix 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, int, int, int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>hostToDev</h4>
<pre>public&nbsp;void&nbsp;hostToDev(int&nbsp;dstrow,
int&nbsp;dstcol,
int&nbsp;srcrow,
int&nbsp;srccol,
int&nbsp;rowlen,
int&nbsp;collen)</pre>
<div class="block">Copy the given portion of this GPU matrix from the host CPU's memory to
the GPU device's memory. <TT>rowlen</TT>&times;<TT>collen</TT> elements
starting at indexes <TT>[srcrow][srccol]</TT> in the CPU matrix are
copied to the GPU matrix starting at indexes <TT>[dstrow][dstcol]</TT>.</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../edu/rit/gpu/GpuMatrix.html#hostToDev(int, int, int, int, int, int)">hostToDev</a></code>&nbsp;in class&nbsp;<code><a href="../../../edu/rit/gpu/GpuMatrix.html" title="class in edu.rit.gpu">GpuMatrix</a></code></dd>
<dt><span class="strong">Parameters:</span></dt><dd><code>dstrow</code> - GPU matrix starting row index.</dd><dd><code>dstcol</code> - GPU matrix starting column index.</dd><dd><code>srcrow</code> - CPU matrix starting row index.</dd><dd><code>srccol</code> - CPU matrix starting column index.</dd><dd><code>rowlen</code> - Number of rows to copy.</dd><dd><code>collen</code> - Number of columns 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>dstrow</TT> &lt; 0,
<TT>dstcol</TT> &lt; 0, <TT>srcrow</TT> &lt; 0, <TT>srccol</TT> &lt;
0, <TT>rowlen</TT> &lt; 0, <TT>collen</TT> &lt; 0,
<TT>dstrow+rowlen</TT> &gt; <TT>rows()</TT>, <TT>dstcol+collen</TT>
&gt; <TT>cols()</TT>, <TT>srcrow+rowlen</TT> &gt; <TT>cpuRows()</TT>,
or <TT>srccol+collen</TT> &gt; <TT>cpuCols()</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, int, int, int)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>devToHost</h4>
<pre>public&nbsp;void&nbsp;devToHost(int&nbsp;dstrow,
int&nbsp;dstcol,
int&nbsp;srcrow,
int&nbsp;srccol,
int&nbsp;rowlen,
int&nbsp;collen)</pre>
<div class="block">Copy the given portion of this GPU matrix from the GPU device's memory to
the host CPU's memory. <TT>rowlen</TT>&times;<TT>collen</TT> elements
starting at indexes <TT>[srcrow][srccol]</TT> in the GPU matrix are
copied to the CPU matrix starting at indexes <TT>[dstrow][dstcol]</TT>.</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../edu/rit/gpu/GpuMatrix.html#devToHost(int, int, int, int, int, int)">devToHost</a></code>&nbsp;in class&nbsp;<code><a href="../../../edu/rit/gpu/GpuMatrix.html" title="class in edu.rit.gpu">GpuMatrix</a></code></dd>
<dt><span class="strong">Parameters:</span></dt><dd><code>dstrow</code> - CPU matrix starting row index.</dd><dd><code>dstcol</code> - CPU matrix starting column index.</dd><dd><code>srcrow</code> - GPU matrix starting row index.</dd><dd><code>srccol</code> - GPU matrix starting column index.</dd><dd><code>rowlen</code> - Number of rows to copy.</dd><dd><code>collen</code> - Number of columns 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>dstrow</TT> &lt; 0,
<TT>dstcol</TT> &lt; 0, <TT>srcrow</TT> &lt; 0, <TT>srccol</TT> &lt;
0, <TT>rowlen</TT> &lt; 0, <TT>collen</TT> &lt; 0,
<TT>dstrow+rowlen</TT> &gt; <TT>cpuRows()</TT>,
<TT>dstcol+collen</TT> &gt; <TT>cpuCols()</TT>,
<TT>srcrow+rowlen</TT> &gt; <TT>rows()</TT>, or
<TT>srccol+collen</TT> &gt; <TT>cols()</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/GpuFloatMatrix.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/GpuFloatArray.html" title="class in edu.rit.gpu"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../edu/rit/gpu/GpuFloatVbl.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/GpuFloatMatrix.html" target="_top">Frames</a></li>
<li><a href="GpuFloatMatrix.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>