CUDAfying a struct that is a dependent of a class - both in different files?

Feb 25, 2016 at 7:48 PM
Edited Feb 25, 2016 at 9:51 PM
Hi everyone,

I have a struct 'DDReal' to be CUDAfied that is dependent on a class 'Base' that has static methods to be CUDAfied - both in seperate files in the same project. They are compiled into a DLL assembly that is called by the main program where the CUDAfying takes place.

In the main program, if I do:
      var km = ...Cudafy(typeof(Base));
this compiles OK.

But if I do var
      var km = ...Cudafy(typeof(Base), typeof(DDReal));
there is a compiler error due to DDReal being translated BEFORE Base (as evidenced by the .cu file).

'Base' needs to be translated first followed by 'DDReal'.

Is there anyway I can force this so that the C definitions for class 'Base's static methods appear before the definition for struct 'DDReal' in the resulting CUDAFYSOURCETEMP.cu file?
Mar 6, 2016 at 3:49 PM
Hi
A possible workaround would be to declare both struct and class within a "wrapper" public partial class, and cudafy that one only. Didn't tried it, but it should work...

file1
public partial class CudaWrapper
{
public struct DDReal {...}
}
...
file2
public partial class CudaWrapper
{
public class Base {...}
}
...
var km = ...Cudafy(typeof(CudaWrapper));