<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.0.2" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>k-Wave User Forum &#187; Topic: abut geval</title>
		<link>http://www.k-wave.org/forum/topic/abut-geval</link>
		<description>Support for the k-Wave MATLAB toolbox</description>
		<language>en-US</language>
		<pubDate>Tue, 12 May 2026 23:40:51 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.0.2</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>http://www.k-wave.org/forum/search.php</link>
		</textInput>
		<atom:link href="http://www.k-wave.org/forum/rss/topic/abut-geval" rel="self" type="application/rss+xml" />

		<item>
			<title>Bradley Treeby on "abut geval"</title>
			<link>http://www.k-wave.org/forum/topic/abut-geval#post-750</link>
			<pubDate>Thu, 13 Sep 2012 00:10:03 +0000</pubDate>
			<dc:creator>Bradley Treeby</dc:creator>
			<guid isPermaLink="false">750@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Chao,&#60;/p&#62;
&#60;p&#62;Interestingly enough, although the code runs using Jacket 2.1 without the geval calls, taking them out seems to make the code more than 30% slower. Following your &#60;a href=&#34;http://forums.accelereyes.com/forums/viewtopic.php?f=7&#38;amp;t=3974&#38;amp;p=11906&#38;amp;hilit=geval#p11906&#34;&#62;post&#60;/a&#62; on the Accelereyes forums, I guess it's related to Jacket getting confused as to when it should evaluate the expressions. In the case of k-Wave, the blocks of code between the geval calls contain lots of operations (FFTs, matrix multiplies, etc), so forcing execution still gives the GPU cores plenty of work to do.&#60;/p&#62;
&#60;p&#62;Brad.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Bradley Treeby on "abut geval"</title>
			<link>http://www.k-wave.org/forum/topic/abut-geval#post-477</link>
			<pubDate>Thu, 26 Apr 2012 09:20:48 +0000</pubDate>
			<dc:creator>Bradley Treeby</dc:creator>
			<guid isPermaLink="false">477@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Thanks Chao, that's useful to know!
&#60;/p&#62;</description>
		</item>
		<item>
			<title>huangchao on "abut geval"</title>
			<link>http://www.k-wave.org/forum/topic/abut-geval#post-474</link>
			<pubDate>Sat, 21 Apr 2012 22:46:14 +0000</pubDate>
			<dc:creator>huangchao</dc:creator>
			<guid isPermaLink="false">474@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi,&#60;/p&#62;
&#60;p&#62;I just tested the codes without using gevals calls on my machine, and it gave the same results as the one using geval, so I guess the bsxfun bugs had been fixed in the Jacket 2.1
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Bradley Treeby on "abut geval"</title>
			<link>http://www.k-wave.org/forum/topic/abut-geval#post-353</link>
			<pubDate>Mon, 05 Mar 2012 22:19:24 +0000</pubDate>
			<dc:creator>Bradley Treeby</dc:creator>
			<guid isPermaLink="false">353@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Pavanky,&#60;/p&#62;
&#60;p&#62;Thanks for your comment. Actually, the problem isn't with accuracy in the sense you mention. Rather, when we switched to using &#60;code&#62;bsxfun&#60;/code&#62; in the B.0.4 release of k-Wave, the simulations run on the GPU using Jacket were completely wrong. I tracked this down to a bug in Jacket when using multiple calls to &#60;code&#62;bsxfun&#60;/code&#62; (see &#60;a href=&#34;http://forums.accelereyes.com/forums/viewtopic.php?f=7&#38;amp;t=1259&#34;&#62;here&#60;/a&#62; for details). Adding the calls to &#60;code&#62;geval&#60;/code&#62; fixed the problem. This may have been fixed in later releases of Jacket (I haven't tested this). In any case, we'll leave the &#60;code&#62;geval&#60;/code&#62; calls in for the time being in case anyone is using older versions of the Jacket toolbox.&#60;/p&#62;
&#60;p&#62;Kind regards,&#60;/p&#62;
&#60;p&#62;Brad.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>pavanky on "abut geval"</title>
			<link>http://www.k-wave.org/forum/topic/abut-geval#post-352</link>
			<pubDate>Mon, 05 Mar 2012 21:55:32 +0000</pubDate>
			<dc:creator>pavanky</dc:creator>
			<guid isPermaLink="false">352@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Bradley,&#60;/p&#62;
&#60;p&#62;Just to clarify, the problem was with accuracy. for the following snippet of code &#60;/p&#62;
&#60;p&#62;C = A*B;&#60;br /&#62;
E = C + D;&#60;/p&#62;
&#60;p&#62;The compiler merges the multiply and add into a single operation E = madd(A, B, D); which is less accurate (but much faster) than one seperate multiply and add.&#60;/p&#62;
&#60;p&#62;If you do geval(C); before doing E = C+D, the multiply and add are performed separately and you get the most accurate results.&#60;/p&#62;
&#60;p&#62;So if you are not using multiply / add combination the geval is not necessary.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Bradley Treeby on "abut geval"</title>
			<link>http://www.k-wave.org/forum/topic/abut-geval#post-349</link>
			<pubDate>Sat, 03 Mar 2012 01:05:27 +0000</pubDate>
			<dc:creator>Bradley Treeby</dc:creator>
			<guid isPermaLink="false">349@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Chao,&#60;/p&#62;
&#60;p&#62;Accelereyes Jacket uses a concept known as &#60;a href=&#34;http://wiki.accelereyes.com/wiki/index.php/Lazy_Evaluation&#34;&#62;lazy evaluation&#60;/a&#62; in which the lines of code are not necessarily executed immediately in the order they are written. Instead, it tries to calculate when the most efficient time to calculate these values might be. If you use the variable again in your code and the previous line of code hasn't yet executed, it is calculated then to make sure your computations are correct.&#60;/p&#62;
&#60;p&#62;At least in earlier versions of Jacket, this wasn't working correctly when multiple calls to &#60;code&#62;bsxfun&#60;/code&#62; are used. The &#60;code&#62;geval&#60;/code&#62; command forces Jacket to make sure the values for &#60;code&#62;ux_sgx&#60;/code&#62; (etc) are up to date, rather than waiting for the lazy evaluation to catch up. &#60;/p&#62;
&#60;p&#62;When &#60;code&#62;&#38;#39;DataCast&#38;#39;&#60;/code&#62; is set to &#60;code&#62;&#38;#39;gsingle&#38;#39;&#60;/code&#62; or &#60;code&#62;&#38;#39;gdouble&#38;#39;&#60;/code&#62;, the values of all the loop variables reside in GPU memory.&#60;/p&#62;
&#60;p&#62;I hope that helps,&#60;/p&#62;
&#60;p&#62;Brad.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>huangchao on "abut geval"</title>
			<link>http://www.k-wave.org/forum/topic/abut-geval#post-347</link>
			<pubDate>Fri, 02 Mar 2012 23:57:56 +0000</pubDate>
			<dc:creator>huangchao</dc:creator>
			<guid isPermaLink="false">347@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi, Dr. Cox and Dr. Treeby,&#60;/p&#62;
&#60;p&#62;I have some questions about the following codes in the 'kspaceFirstOrder2D' function:&#60;/p&#62;
&#60;p&#62;    ux_sgx = bsxfun(@times, pml_x_sgx, ...&#60;br /&#62;
        bsxfun(@times, pml_x_sgx, ux_sgx) ...&#60;br /&#62;
        - dt./ rho0_sgx .* real(ifft2( bsxfun(@times, ddx_k_shift_pos, kappa .* p_k) )) ...&#60;br /&#62;
        );&#60;br /&#62;
    uy_sgy = bsxfun(@times, pml_y_sgy, ...&#60;br /&#62;
        bsxfun(@times, pml_y_sgy, uy_sgy) ...&#60;br /&#62;
        - dt./ rho0_sgy .* real(ifft2( bsxfun(@times, ddy_k_shift_pos, kappa .* p_k) )) ...&#60;br /&#62;
        );&#60;/p&#62;
&#60;p&#62;    % force bsxfun compatability with Accelereyes GPU toolbox&#60;br /&#62;
    if strncmp(data_cast, 'g', 1);&#60;br /&#62;
        geval(ux_sgx, uy_sgy);&#60;br /&#62;
    end   &#60;/p&#62;
&#60;p&#62;I am confused about the use of the 'geval' function. Since 'ux_sgx' and 'uy_sgy' have been computed in the above lines, what's the purpose to use 'geval'. I don't understand the comments 'force bsxfun compatability with Accelereyes GPU toolbox'.&#60;/p&#62;
&#60;p&#62;Also, do 'ux_sgx' and 'uy_sgy' comupted in the first 2 statements reside in the CPU memory, while 'ux_sgx' and 'uy_sgy' comupted by 'geval' reside in GPU memroy?&#60;/p&#62;
&#60;p&#62;Thanks,&#60;br /&#62;
Chao
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
