Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Performance of CUDAfy module

Every time I build and run my CUDAfy code, it takes considerable time for loading the module and translating it. Is there any way to reduce the time taken during translation and loading?

like image 431
Alchemist Avatar asked Jan 12 '16 10:01

Alchemist


1 Answers

It may not be desirable to always call Cudafy if the GPU code has not been changed. You can cache the Cudafy modules by using serialization.

CudafyModule km = CudafyModule.TryDeserialize();
if (km == null || !km.TryVerifyChecksums())
{
    km = CudafyTranslator.Cudafy();
    km.Serialize();
}

The TryDeserialize method will attempt to find a *.cdfy file in the current directory with the same file name as the calling type. If this is not found or fails then null is returned and try making a new module.If it is not null then check whether the cached module refers to the same version of the .NET code it was created from. To do this call TryVerifyChecksums. If this returns false then it means the cached module was out of date and it is advisable to cudafy a new one.

like image 139
Abdul Avatar answered Sep 16 '22 12:09

Abdul