|
|
Le 29/03/2011 21:01, Aidy nous fit lire :
> OK I've fiddled around with it a bit, and the first error on (TPATTERN *)Tnormal
> doesn't appear to be an error to do with the casting. That seems to be working
> fine (I created a new TPATTERN * variable and assigned it to the cast Tnormal
> without error) however it errors when using that in the method call to cuNoise.
>
> My declaration of cuNoise is :
>
> __device__ INLINE_NOISE DBL cuNoise (VECTOR EPoint,TPATTERN *TPat)
>
> and is inside the texture file, as it was before (i've moved a lot of things
> around but all methods are still in the same relative places. e.g methods
> originally in texture are now in cuTexture.)
>
> The cuNoise definition clearly requires a TPATTERN pointer, yet I still get the
> error? I am including the cuTexture header file where the prototype of the
> cuNoise method exists. Everything SEEMS correct, and short of the naming of
> methods, it is identical to the original code to the best of my knowledge :(
>
>> Now, there is that __device__ keyword... inlining code might have issue
>> with structures & casting. You might want to rewrite the casted pointer
>> as a reference instead... I do not know if it would work.
>>
>
>
Please, read.
__device__ is going to inline the function (or I'm just getting it
wrong, which is 90% likely).
That means that you cannot give a pointer and hope you can access it's
structure. You need to pass the structure itself.
(and if you are trying what I believe, it cannot work without passing
the content of the structure... which is gonna be a problem because
there is not enough registers for all the fields)
Google clue: __device__
> http://code.google.com/p/stanford-cs193g-sp2010/wiki/TutorialDeviceFunctions
http://forums.nvidia.com/index.php?showtopic=83335
Cuda...
Post a reply to this message
|
|