Example #1
0
        public static CUjit_result cuModuleLoadDataEx(IntPtr image, CUjit_options options)
        {
            return Wrap(() =>
            {
                try
                {
                    // todo. an attempt to pass the Target value directly leads to CUDA_ERROR_INVALID_VALUE
                    // as of now, this feature is not really important, so I'm marking it as TBI
                    options.TargetFromContext.AssertTrue();

                    using (var native_options = new nativeModuleLoadDataExOptions(options))
                    {
                        CUmodule module;
                        var error = nativeModuleLoadDataEx(out module, image, native_options.Count, native_options.Keys, native_options.Values);

                        var result = new CUjit_result();
                        result.ErrorCode = error;
                        result.Module = module;
                        result.WallTime = native_options.WallTime;
                        result.InfoLog = native_options.InfoLog;
                        result.ErrorLog = native_options.ErrorLog;
                        return result;
                    }
                }
                catch (CudaException)
                {
                    throw;
                }
                catch (DllNotFoundException dnfe)
                {
                    throw new CudaException(CudaError.NoDriver, dnfe);
                }
                catch (Exception e)
                {
                    throw new CudaException(CudaError.Unknown, e);
                }
            });
        }
Example #2
0
        public static CUjit_result cuModuleLoadDataEx(IntPtr image, CUjit_options options)
        {
            return(Wrap(() =>
            {
                try
                {
                    // todo. an attempt to pass the Target value directly leads to CUDA_ERROR_INVALID_VALUE
                    // as of now, this feature is not really important, so I'm marking it as TBI
                    options.TargetFromContext.AssertTrue();

                    using (var native_options = new nativeModuleLoadDataExOptions(options))
                    {
                        CUmodule module;
                        var error = nativeModuleLoadDataEx(out module, image, native_options.Count, native_options.Keys, native_options.Values);

                        var result = new CUjit_result();
                        result.ErrorCode = error;
                        result.Module = module;
                        result.WallTime = native_options.WallTime;
                        result.InfoLog = native_options.InfoLog;
                        result.ErrorLog = native_options.ErrorLog;
                        return result;
                    }
                }
                catch (CudaException)
                {
                    throw;
                }
                catch (DllNotFoundException dnfe)
                {
                    throw new CudaException(CudaError.NoDriver, dnfe);
                }
                catch (Exception e)
                {
                    throw new CudaException(CudaError.Unknown, e);
                }
            }));
        }