سؤال

How can you have a struct full of arrays in cudafy?

This appears a somewhat trivial issue, but I could not find an easy implementation of it on the net.

Some links suggest it cannot be done, see for example: Passing an array within a structure in CUDAfy

While others suggest it can be done through a somewhat lengthy helper function, see for example http://cudafy.codeplex.com/discussions/283527

I am looking to pass a single struct into my Cudafy kernel, where for example the struct looks like...

    [Cudafy]
    public struct myStructTwo
    {
        public float[] value_x;
        public float[] value_y;
        public float[] value_z;
    }


    public struct myStructTwo
    {
        public IntPtr value_x;
        public IntPtr value_y;
        public IntPtr value_z;
    }
هل كانت مفيدة؟

المحلول

The question has been addressed in a Codeplex answer. It looks to be possible using a fixed size e.g.

[Cudafy]
public struct myStructTwo
{
    public float value_x[size];
}

I will let this question remain open in case further responses are received.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top