Cudafy.net 1.27 and Codeproject example

Sep 10, 2014 at 8:39 PM
Edited Sep 10, 2014 at 8:40 PM
Hi,

I am just trying for the first time this api.
I've tried the following example using Cudafy.net 1.26 and it works very well

http://www.codeproject.com/Articles/289551/High-Performance-Queries-GPU-vs-PLINQ-vs-LINQ

when I try to run this example in Cudafy 1.27 it fails to run properly...with messages complaining about "use Tag Struct before using struct"...

can you have a look?

thank you in advance.

regards,
Nelson
Sep 11, 2014 at 4:26 PM
Hi
Are you running in opencl or cuda mode? I suspect opencl. There was a cudafy problem with opencl using structs properly, since its flavour of c expects to find the keyword struct prepending every variable declaration of a complex type, and cudafy's opencl generator isn't outputing "struct" in those cases. I'm not sure if that's been fixed in recent cudafy versions.
Sep 12, 2014 at 7:48 PM
Hello,
Tks for the answer. Yes i am using OpenCL.
One of the interesting points of cudafy is exactly the possibility of using cuda, OpenCL, emulator.
Saldo at this moment i have no clube on how to fix this problem...

Any ideas?

Tks
Coordinator
Sep 15, 2014 at 9:34 AM
CUDAfy with OpenCL is much more limited than with CUDA. Your current issue can likely be worked around by not pointing a new variable at the parameter, but use the parameter directly.
myfunction(mystruct[] a)
{
   mystruct b = a[0]; // Don't do this
   b.Member += 42;  // Don't do this

   a[0].Member += 42; // Do this
}