3

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?

John Trinder
  • 127
  • 4

1 Answers1

0

Cudafy, alas, does not cater for this scenario: Cudafy puts all struct definitions BEFORE the class method prototype declarations in the output source code .cu file.

So I've modifed the Cudafy source code in order solve my problem. I've added a 2-param constructor to the class of attribute 'Cudafy' such that the 2nd param can specify default behaviour or the pre-struct prototype declaration of a class method. All Cudafy's unit tests and examples check out OK plus my own unit tests.

If anyone's interested I can upload the source + DLL to github.

John Trinder
  • 127
  • 4