Search code examples
c#exit-codecudafy.net

Cudafy The thread has exited with code 259


I have testing some GPU computing samples with cudafy

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

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

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

        int c;
        int[] dev_c = gpu.Allocate<int>(); // 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;
}

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

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).

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

Edit: after some test i found that

gpu.Launch().add(5, 3, dev_c);

works but:

 gpu.Launch().add(data.IntData[0], data.IntData[1], dev_c);

is not


Solution

  • Tahnks to Hans Passant who pinted that this is not problem at all and that gpu card should work wihtou problem. I find error in other part of code. So code above works fine.