Cudafy The thread has exited with code 259
<p>I have testing some GPU computing samples with cudafy</p>

<p>I have code which compute/creta colection of data, and each loop i want do on every object in collection some GPU operation
CODE:</p>

<pre><code>public override void CountData(List&lt;IData&lt;int&gt;&gt; datas)
{
        for (int i = 0; i &lt; datas.Count; i++)
        {
           Execute(datas[i]);
        }          
}
public static void Execute(IData&lt;int&gt; data)
{
        CudafyModule km = CudafyTranslator.Cudafy();

        GPGPU gpu = CudafyHost.GetDevice(CudafyModes.Target, CudafyModes.DeviceId);
        gpu.LoadModule(km);

        int c;
        int[] dev_c = gpu.Allocate&lt;int&gt;(); // cudaMalloc one Int32
        gpu.Launch().add(data.IntData[0], data.IntData[1], dev_c); // or gpu.Launch(1, 1, "add", 2, 7, dev_c);
        gpu.CopyFromDevice(dev_c, out c);


        Console.WriteLine(c + ";");

        gpu.Free(dev_c);
        chromozome.Result= c;

}
[Cudafy]
public static void add(int a, int b, int[] c)
{
        c[0] = a + b;
}
</code></pre>

<p>This code works for first call of CountData,but after Count data loop end program will stuck and console output says</p>

<p>The thread 0xf50 has exited with code 259 (0x103).
The thread 0x10c has exited with code 259 (0x103).
The thread 0xc30 has exited with code 259 (0x103).
The thread 0xcc0 has exited with code 0 (0x0).
The thread 0x548 has exited with code 0 (0x0).</p>

<p>Have enybody clue where could be problem? i try  gpu.Synchronize, CudafyHost.ClearDevices() , but it always end in this error
Thanks for help</p>

<p>Edit: after some test i found that </p>

<pre><code>gpu.Launch().add(5, 3, dev_c);
</code></pre>

<p>works but:</p>

<pre><code> gpu.Launch().add(data.IntData[0], data.IntData[1], dev_c);
</code></pre>

<p>is not</p>