This project is read-only.

Remind developer to Cudafy type

Dec 19, 2011 at 7:30 PM

Referenced types from Cudafied types must of course be Cudafied also. I forgot to do this and the following happened:

In my constructor which looks like this

public GridSettings(...

the line

float r0 = AirIntrinsicProperties.R0;

got translated to -- presumably because I forgot to Cudafy AirIntrinsicProperties by including it among the types to Cudafy --

float r = R0;

and the error message I got was error: identifier "R0" is undefined

Has I not checked the translated code and compared it to the original C# source, I would have had no idea what happened. For some reason the symbol AirIntrinsicProperties has completely become ignored! (Incidentally r0 has been renamed to r also O_o. Why beats me, but if it works, good.)

Before I used to avoid constructors in structs to be Cudafied... and I guess this is a good idea...

Dec 21, 2011 at 10:38 AM

Code is translated into CUDA C via a complex process most of which is kindly handled by the brilliant ILSpy code which in turn uses the amazingly power Mono.Cecil code.  Sometimes variables cannot be known since IL does not store by original name or ILSpy/Mono.Cecil renames.

Tracking which structs are used by device code can of course be done.  It is however rather non-trivial and we've not had the time, especially since nvcc will give clues in its output.  Examining the generated code is an unfortuate requirement now and then, but at least the option is there.  You can use the CudafyModuleViewer GUI to simplify looking at code that did compile successfully into a module.

If you or anyone else gets a chance to look into how to perform such a test then please let me know and we can tackle it together.