Instructions in case attachment didn't come through (was Re: Preparing for a 0.5 release...)

4 views
Skip to first unread message

Robert Munafo

unread,
Dec 15, 2012, 8:24:39 PM12/15/12
to reaction-...@googlegroups.com, Tim Hutton, fededv
I didn't say so, but that message had an attachment "ising-test.vti".
In case you don't get it, here are instructions to create your own:

* In your Ready patterns list, hold down the Control key while
selecting "Ising_regime.vti".

* This will open "Ising_regime.vti" into TextEdit.

* In TextEdit, do a "Save As..." and put the copy on your desktop (or
somewhere else that is convenient) and give it a new name. I called it
"ising-test" and it created a textfile called "ising-test.txt".

* Now edit "ising-test.txt" and remove everything starting with:
"<rule name=..." down to "</rule>".

* In its place, put all the following:

--->8---cut here---8<---
<rule name="Fitzhugh-Nagumo" type="kernel"
neighborhood_type="vertex" neighborhood_range="1"
neighborhood_weight="laplacian">
<kernel number_of_chemicals="2" block_size_x="4"
block_size_y="1" block_size_z="1">
__kernel void rd_compute(__global float4 *a_in,__global float4
*b_in,__global float4 *a_out,__global float4 *b_out)
{
const int x = get_global_id(0);
const int y = get_global_id(1);
const int z = get_global_id(2);
const int X = get_global_size(0);
const int Y = get_global_size(1);
const int Z = get_global_size(2);
const int i_here = X*(Y*z + y) + x;

float4 a = a_in[i_here];
float4 b = b_in[i_here];

// compute the Laplacians of each chemical
// 2D standard 9-point stencil: [ 1,4,1; 4,-20,4; 1,4,1 ] / 6
const int xm1 = ((x-1+X) &amp; (X-1)); // wrap (assumes X is a power of 2)
const int xp1 = ((x+1) &amp; (X-1));
const int ym1 = ((y-1+Y) &amp; (Y-1));
const int yp1 = ((y+1) &amp; (Y-1));
const int i_n = X*(Y*z + ym1) + x;
const int i_ne = X*(Y*z + ym1) + xp1;
const int i_e = X*(Y*z + y) + xp1;
const int i_se = X*(Y*z + yp1) + xp1;
const int i_s = X*(Y*z + yp1) + x;
const int i_sw = X*(Y*z + yp1) + xm1;
const int i_w = X*(Y*z + y) + xm1;
const int i_nw = X*(Y*z + ym1) + xm1;
float4 a_n = a_in[i_n];
float4 a_ne = a_in[i_ne];
float4 a_e = a_in[i_e];
float4 a_se = a_in[i_se];
float4 a_s = a_in[i_s];
float4 a_sw = a_in[i_sw];
float4 a_w = a_in[i_w];
float4 a_nw = a_in[i_nw];
float4 b_n = b_in[i_n];
float4 b_ne = b_in[i_ne];
float4 b_e = b_in[i_e];
float4 b_se = b_in[i_se];
float4 b_s = b_in[i_s];
float4 b_sw = b_in[i_sw];
float4 b_w = b_in[i_w];
float4 b_nw = b_in[i_nw];
float4 laplacian_a = (float4)(a_n.x*0.666667 + a_n.y*0.166667 +
a.y*0.666667 + a_s.y*0.166667 + a_s.x*0.666667 + a_sw.w*0.166667 +
a_w.w*0.666667 + a_nw.w*0.166667,
a_n.y*0.666667 + a_n.z*0.166667 + a.z*0.666667 + a_s.z*0.166667 +
a_s.y*0.666667 + a_s.x*0.166667 + a.x*0.666667 + a_n.x*0.166667,
a_n.z*0.666667 + a_n.w*0.166667 + a.w*0.666667 + a_s.w*0.166667 +
a_s.z*0.666667 + a_s.y*0.166667 + a.y*0.666667 + a_n.y*0.166667,
a_n.w*0.666667 + a_ne.x*0.166667 + a_e.x*0.666667 +
a_se.x*0.166667 + a_s.w*0.666667 + a_s.z*0.166667 + a.z*0.666667 +
a_n.z*0.166667) - a*((float4)3.333333);
float4 laplacian_b = (float4)(b_n.x*0.666667 + b_n.y*0.166667 +
b.y*0.666667 + b_s.y*0.166667 + b_s.x*0.666667 + b_sw.w*0.166667 +
b_w.w*0.666667 + b_nw.w*0.166667,
b_n.y*0.666667 + b_n.z*0.166667 + b.z*0.666667 + b_s.z*0.166667 +
b_s.y*0.666667 + b_s.x*0.166667 + b.x*0.666667 + b_n.x*0.166667,
b_n.z*0.666667 + b_n.w*0.166667 + b.w*0.666667 + b_s.w*0.166667 +
b_s.z*0.666667 + b_s.y*0.166667 + b.y*0.666667 + b_n.y*0.166667,
b_n.w*0.666667 + b_ne.x*0.166667 + b_e.x*0.666667 +
b_se.x*0.166667 + b_s.w*0.666667 + b_s.z*0.166667 + b.z*0.666667 +
b_n.z*0.166667) - b*((float4)3.333333);

float4 delta_a=(float4)(0.0f,0.0f,0.0f,0.0f);
float4 delta_b=(float4)(0.0f,0.0f,0.0f,0.0f);

float timestep = 0.020000f;
float a0 = -0.100000f;
float a1 = 2.000000f;
float epsilon = 0.050000f;
float delta = 4.000000f;
float k1 = 1.000000f;
float k2 = 0.000000f;
float k3 = 1.000000f;
delta_a = k1*a - k2*a*a - a*a*a - b + laplacian_a;
delta_b = epsilon*(k3*a - a1*b - a0) + delta*laplacian_b;
a_out[i_here] = a + timestep * delta_a;
b_out[i_here] = b + timestep * delta_b;
}

</kernel>

</rule>
--->8---cut here---8<---

* Now save the file and quit TextEdit.

* In the Finder, change the filename extension from "ising-test.txt"
to "ising-test.vti".

* Open it. It should load into Ready, and if my fix works, you'll get
the same thing you'd get if you were using the ATI Radeon or in Ready
0.4.

- Robert

On 12/15/12, Robert Munafo <mro...@gmail.com> wrote:
> Thank you Federico for the details! [...]
>
> I have created a test version of the "ising" VTI that includes this
> fix. I verified that it works on my system (which is MacOS 10.6) when
> using the Core i7-2720QM as the OpenCL device -- so at least this
> change doesn't make it any worse as far as I can tell.
>
> If this works for you, then it'll be the same fix for the other VTI
> files that you reported: it looks like they all have the same error
> messages.

--
Robert Munafo -- mrob.com
Follow me at: gplus.to/mrob - fb.com/mrob27 - twitter.com/mrob_27 -
mrob27.wordpress.com - youtube.com/user/mrob143 - rilybot.blogspot.com
Reply all
Reply to author
Forward
0 new messages