I am using CUDAfy .NET and want to pass a struct array within a struct to the device.
I have declared them in c# as shown below:
[Cudafy(eCudafyType.Struct)]
[StructLayout(LayoutKind.Sequential)]
public struct A
{
[MarshalAs(UnmanagedType.ByValArray, ArraySubType= UnmanagedType.Struct, SizeConst = 3)]
public B[] ba;
}
[Cudafy(eCudafyType.Struct)]
[StructLayout(LayoutKind.Sequential)]
public struct B
{
public byte id;
}
This results in the following source code for the GPU:
struct B
{
unsigned char id;
};
struct A
{
B ba [3];
int baLen0;
};
And I get this compilation error from an attempt to convert it to OpenCL code:
Compilation error: <kernel>:20:2: error: must use 'struct' tag to refer to type 'B'
B ba [3]; int baLen0;
^
struct
I realize this could be an issue between the marshalling and how CUDAfy .NET handles structures, but is there any way I could possibly fix this?
Thanks in advance