CUDAfy Command Line Tool

Coordinator
Dec 1, 2011 at 10:27 AM

If you download the source code or wait for the next release (1.6) then there is a new tool that can be run from command line.  Called cudafycl.exe it cudafies all methods and structs marked with the attribute Cudafy in the target dll or exe and then takes the resulting cudafy module (*.cdfy) and places it in the target dll or exe.  You can then access this from the resources and load the module as usual.  This saves the need to redistribute *.cdfy files or to have the CUDA SDK on target machine.

 

        public void SetUp()
        {
            if (CudafyModule.HasCudafyModuleInAssembly())
            {
                _cm = GetType().Assembly.GetCudafyModule();
            }
            else
            {
                _cm = CudafyModule.TryDeserialize();
                if (_cm == null || !_cm.TryVerifyChecksums())
                {
                    _cm = CudafyTranslator.Cudafy(typeof(PrimitiveStruct), typeof(EmbeddedCudafyModuleTests));
                    _cm.TrySerialize();
                }
            }
            _gpu = CudafyHost.GetDevice(CudafyModes.Target);
            if(_cm != null)
                _gpu.LoadModule(_cm);
        }