本文整理汇总了C#中CUResult类的典型用法代码示例。如果您正苦于以下问题:C# CUResult类的具体用法?C# CUResult怎么用?C# CUResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CUResult类属于命名空间,在下文中一共展示了CUResult类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: CudaException
/// <summary>
///
/// </summary>
/// <param name="error"></param>
public CudaException(CUResult error)
: base(GetErrorMessageFromCUResult(error))
{
this._cudaError = error;
this._internalDescripton = GetInternalDescriptionFromCUResult(error);
this._internalName = GetInternalNameFromCUResult(error);
}
开发者ID:lvaleriu,项目名称:managedCuda,代码行数:11,代码来源:CudaException.cs
示例2: CudaSurface
/// <summary>
/// Creates a new surface from array memory. Allocates new array.
/// </summary>
/// <param name="kernel"></param>
/// <param name="surfName"></param>
/// <param name="flags"></param>
/// <param name="format"></param>
/// <param name="width">In elements</param>
/// <param name="height">In elements</param>
/// <param name="depth">In elements</param>
/// <param name="numChannels"></param>
/// <param name="arrayFlags"></param>
public CudaSurface(CudaKernel kernel, string surfName, CUSurfRefSetFlags flags, CUArrayFormat format, SizeT width, SizeT height, SizeT depth, CudaArray3DNumChannels numChannels, CUDAArray3DFlags arrayFlags)
{
_surfref = new CUsurfref();
res = DriverAPINativeMethods.ModuleManagement.cuModuleGetSurfRef(ref _surfref, kernel.CUModule, surfName);
Debug.WriteLine(String.Format("{0:G}, {1}: {2}, Surface name: {3}", DateTime.Now, "cuModuleGetSurfRef", res, surfName));
if (res != CUResult.Success) throw new CudaException(res);
_flags = flags;
_format = format;
_height = height;
_width = width;
_depth = depth;
_numChannels = (int)numChannels;
_name = surfName;
_module = kernel.CUModule;
_cufunction = kernel.CUFunction;
_channelSize = CudaHelperMethods.GetChannelSize(format);
_dataSize = height * width * depth * _numChannels * _channelSize;
_array = new CudaArray3D(format, width, height, depth, numChannels, arrayFlags);
res = DriverAPINativeMethods.SurfaceReferenceManagement.cuSurfRefSetArray(_surfref, _array.CUArray, flags);
Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cuSurfRefSetArray", res));
if (res != CUResult.Success) throw new CudaException(res);
}
开发者ID:lvaleriu,项目名称:managedCuda,代码行数:37,代码来源:CudaSurface.cs
示例3: CudaEvent
/// <summary>
/// Creates a new Event
/// </summary>
/// <param name="flags">Parameters for event creation</param>
public CudaEvent(CUEventFlags flags)
{
_event = new CUevent();
res = DriverAPINativeMethods.Events.cuEventCreate(ref _event, flags);
Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cuEventCreate", res));
if (res != CUResult.Success) throw new CudaException(res);
}
开发者ID:lvaleriu,项目名称:managedCuda,代码行数:12,代码来源:CudaEvent.cs
示例4: CudaStream
/// <summary>
/// Creates a new Stream
/// </summary>
/// <param name="flags">Parameters for stream creation (must be <see cref="CUStreamFlags.None"/>)</param>
public CudaStream(CUStreamFlags flags)
{
_stream = new CUstream();
res = DriverAPINativeMethods.Streams.cuStreamCreate(ref _stream, flags);
Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cuStreamCreate", res));
if (res != CUResult.Success) throw new CudaException(res);
_isOwner = true;
}
开发者ID:lvaleriu,项目名称:managedCuda,代码行数:13,代码来源:CudaStream.cs
示例5: CudaSurfObject
/// <summary>
/// Creates a surface object. <c>ResDesc</c> describes
/// the data to perform surface load/stores on. <c>ResDesc.resType</c> must be
/// <see cref="CUResourceType.Array"/> and <c>ResDesc.hArray</c>
/// must be set to a valid CUDA array handle.
/// </summary>
/// <param name="array">CudaArray1D</param>
public CudaSurfObject(CudaArray1D array)
{
_resDesc = new CudaResourceDesc(array);
_surfObject = new CUsurfObject();
res = DriverAPINativeMethods.SurfaceObjects.cuSurfObjectCreate(ref _surfObject, ref _resDesc);
Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cuSurfObjectCreate", res));
if (res != CUResult.Success) throw new CudaException(res);
}
开发者ID:lvaleriu,项目名称:managedCuda,代码行数:16,代码来源:CudaSurfObject.cs
示例6: CudaTexObject
/// <summary>
/// Creates a texture object and returns it in pTexObject. pResDesc describes the data to texture from. pTexDesc
/// describes how the data should be sampled.
/// </summary>
/// <param name="resDesc">CudaResourceDesc</param>
/// <param name="texDesc">CudaTextureDescriptor</param>
public CudaTexObject(CudaResourceDesc resDesc, CudaTextureDescriptor texDesc)
{
_resDesc = resDesc;
_texDesc = texDesc;
_texObject = new CUtexObject();
res = DriverAPINativeMethods.TextureObjects.cuTexObjectCreate(ref _texObject, ref _resDesc, ref _texDesc, IntPtr.Zero);
Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cuTexObjectCreate", res));
if (res != CUResult.Success) throw new CudaException(res);
}
开发者ID:lvaleriu,项目名称:managedCuda,代码行数:18,代码来源:CudaTexObject.cs
示例7: CudaLinker
/// <summary>
/// Creates a pending JIT linker invocation.
/// </summary>
/// <param name="options">Collection of linker and compiler options</param>
public CudaLinker(CudaJitOptionCollection options)
{
_state = new CUlinkState();
if (options == null)
res = DriverAPINativeMethods.ModuleManagement.cuLinkCreate(0, null, null, ref _state);
else
res = DriverAPINativeMethods.ModuleManagement.cuLinkCreate((uint)options.Count, options.Options, options.Values, ref _state);
Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cuLinkCreate", res));
if (res != CUResult.Success)
throw new CudaException(res);
}
开发者ID:lvaleriu,项目名称:managedCuda,代码行数:20,代码来源:CudaLinker.cs
示例8: CudaTextureArray1D
/// <summary>
/// Creates a new 1D texture from array memory. Allocates new array.
/// </summary>
/// <param name="kernel"></param>
/// <param name="texName"></param>
/// <param name="addressMode"></param>
/// <param name="filterMode"></param>
/// <param name="flags"></param>
/// <param name="format"></param>
/// <param name="size">In elements</param>
/// <param name="numChannels"></param>
public CudaTextureArray1D(CudaKernel kernel, string texName, CUAddressMode addressMode, CUFilterMode filterMode, CUTexRefSetFlags flags, CUArrayFormat format, SizeT size, CudaArray1DNumChannels numChannels)
{
_texref = new CUtexref();
res = DriverAPINativeMethods.ModuleManagement.cuModuleGetTexRef(ref _texref, kernel.CUModule, texName);
Debug.WriteLine(String.Format("{0:G}, {1}: {2}, Texture name: {3}", DateTime.Now, "cuModuleGetTexRef", res, texName));
if (res != CUResult.Success) throw new CudaException(res);
res = DriverAPINativeMethods.TextureReferenceManagement.cuTexRefSetAddressMode(_texref, 0, addressMode);
Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cuTexRefSetAddressMode", res));
if (res != CUResult.Success) throw new CudaException(res);
res = DriverAPINativeMethods.TextureReferenceManagement.cuTexRefSetFilterMode(_texref, filterMode);
Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cuTexRefSetFilterMode", res));
if (res != CUResult.Success) throw new CudaException(res);
res = DriverAPINativeMethods.TextureReferenceManagement.cuTexRefSetFlags(_texref, flags);
Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cuTexRefSetFlags", res));
if (res != CUResult.Success) throw new CudaException(res);
res = DriverAPINativeMethods.TextureReferenceManagement.cuTexRefSetFormat(_texref, format, (int)numChannels);
Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cuTexRefSetFormat", res));
if (res != CUResult.Success) throw new CudaException(res);
_filtermode = filterMode;
_flags = flags;
_addressMode = addressMode;
_format = format;
_size = size;
_numChannels = (int)numChannels;
_name = texName;
_module = kernel.CUModule;
_cufunction = kernel.CUFunction;
_channelSize = CudaHelperMethods.GetChannelSize(format);
_dataSize = size * _numChannels * _channelSize;
_array = new CudaArray1D(format, size, numChannels);
res = DriverAPINativeMethods.TextureReferenceManagement.cuTexRefSetArray(_texref, _array.CUArray, CUTexRefSetArrayFlags.OverrideFormat);
Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cuTexRefSetArray", res));
if (res != CUResult.Success) throw new CudaException(res);
//res = DriverAPINativeMethods.ParameterManagement.cuParamSetTexRef(_cufunction, CUParameterTexRef.Default, _texref);
//Debug.WriteLine("{0:G}, {1}: {2}", DateTime.Now, "cuParamSetTexRef", res);
//if (res != CUResult.Success) throw new CudaException(res);
}
开发者ID:lvaleriu,项目名称:managedCuda,代码行数:52,代码来源:CudaTextureArray1D.cs
示例9: AddCallback
/// <summary>
/// Adds a callback to be called on the host after all currently enqueued
/// items in the stream have completed. For each
/// cuStreamAddCallback call, the callback will be executed exactly once.
/// The callback will block later work in the stream until it is finished.
/// <para/>
/// The callback may be passed <see cref="CUResult.Success"/> or an error code. In the event
/// of a device error, all subsequently executed callbacks will receive an
/// appropriate <see cref="CUResult"/>.
/// <para/>
/// Callbacks must not make any CUDA API calls. Attempting to use a CUDA API
/// will result in <see cref="CUResult.ErrorNotPermitted"/>. Callbacks must not perform any
/// synchronization that may depend on outstanding device work or other callbacks
/// that are not mandated to run earlier. Callbacks without a mandated order
/// (in independent streams) execute in undefined order and may be serialized.
/// <para/>
/// This API requires compute capability 1.1 or greater. See
/// cuDeviceGetAttribute or ::cuDeviceGetProperties to query compute
/// capability. Attempting to use this API with earlier compute versions will
/// return <see cref="CUResult.ErrorNotSupported"/>.
/// </summary>
/// <param name="callback">The function to call once preceding stream operations are complete</param>
/// <param name="userData">User specified data to be passed to the callback function. Use GCAlloc to pin a managed object</param>
/// <param name="flags">Callback flags (must be CUStreamAddCallbackFlags.None)</param>
public void AddCallback(CUstreamCallback callback, IntPtr userData, CUStreamAddCallbackFlags flags)
{
if (disposed) throw new ObjectDisposedException(this.ToString());
res = DriverAPINativeMethods.Streams.cuStreamAddCallback(_stream, callback, userData, flags);
Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cuStreamAddCallback", res));
if (res != CUResult.Success) throw new CudaException(res);
}
开发者ID:lvaleriu,项目名称:managedCuda,代码行数:33,代码来源:CudaStream.cs
示例10: WaitEvent
/// <summary>
/// Make a compute stream wait on an event<para/>
/// Makes all future work submitted to the Stream wait until <c>hEvent</c>
/// reports completion before beginning execution. This synchronization
/// will be performed efficiently on the device.
/// <para/>
/// The stream will wait only for the completion of the most recent
/// host call to <see cref="CudaEvent.Record()"/> on <c>hEvent</c>. Once this call has returned,
/// any functions (including <see cref="CudaEvent.Record()"/> and <see cref="Dispose()"/> may be
/// called on <c>hEvent</c> again, and the subsequent calls will not have any
/// effect on this stream.
/// <para/>
/// If <c>hStream</c> is 0 (the NULL stream) any future work submitted in any stream
/// will wait for <c>hEvent</c> to complete before beginning execution. This
/// effectively creates a barrier for all future work submitted to the context.
/// <para/>
/// If <see cref="CudaEvent.Record()"/> has not been called on <c>hEvent</c>, this call acts as if
/// the record has already completed, and so is a functional no-op.
/// </summary>
/// <returns></returns>
public void WaitEvent(CUevent cuevent)
{
if (disposed) throw new ObjectDisposedException(this.ToString());
res = DriverAPINativeMethods.Streams.cuStreamWaitEvent(_stream, cuevent, 0);
Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cuStreamWaitEvent", res));
if (res != CUResult.Success) throw new CudaException(res);
}
开发者ID:lvaleriu,项目名称:managedCuda,代码行数:28,代码来源:CudaStream.cs
示例11: Query
/// <summary>
/// Returns true if all operations in the stream have completed, or
/// false if not.
/// </summary>
/// <returns></returns>
public bool Query()
{
if (disposed) throw new ObjectDisposedException(this.ToString());
res = DriverAPINativeMethods.Streams.cuStreamQuery(_stream);
Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cuStreamQuery", res));
if (res != CUResult.Success && res != CUResult.ErrorNotReady) throw new CudaException(res);
if (res == CUResult.Success) return true;
return false; // --> ErrorNotReady
}
开发者ID:lvaleriu,项目名称:managedCuda,代码行数:15,代码来源:CudaStream.cs
示例12: Synchronize
/// <summary>
/// Waits until the device has completed all operations in the stream. If the context was created
/// with the <see cref="CUCtxFlags.BlockingSync"/> flag, the CPU thread will block until the stream is finished with all of its
/// tasks.
/// </summary>
public void Synchronize()
{
if (disposed) throw new ObjectDisposedException(this.ToString());
res = DriverAPINativeMethods.Streams.cuStreamSynchronize(_stream);
Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cuStreamSynchronize", res));
if (res != CUResult.Success) throw new CudaException(res);
}
开发者ID:lvaleriu,项目名称:managedCuda,代码行数:12,代码来源:CudaStream.cs
示例13: GetInternalNameFromCUResult
private static string GetInternalNameFromCUResult(CUResult error)
{
IntPtr name = new IntPtr();
DriverAPINativeMethods.ErrorHandling.cuGetErrorName(error, ref name);
string val = Marshal.PtrToStringAnsi(name);
return val;
}
开发者ID:lvaleriu,项目名称:managedCuda,代码行数:8,代码来源:CudaException.cs
示例14: BindArray
/// <summary>
/// Bind a CudaArray3D to a surface reference.
/// </summary>
/// <param name="kernel"></param>
/// <param name="surfName"></param>
/// <param name="flags"></param>
/// <param name="array"></param>
public static void BindArray(CudaKernel kernel, string surfName, CUSurfRefSetFlags flags, CudaArray3D array)
{
CUsurfref surfref = new CUsurfref();
CUResult res = DriverAPINativeMethods.ModuleManagement.cuModuleGetSurfRef(ref surfref, kernel.CUModule, surfName);
Debug.WriteLine(String.Format("{0:G}, {1}: {2}, Surface name: {3}", DateTime.Now, "cuModuleGetSurfRef", res, surfName));
if (res != CUResult.Success) throw new CudaException(res);
res = DriverAPINativeMethods.SurfaceReferenceManagement.cuSurfRefSetArray(surfref, array.CUArray, flags);
Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cuSurfRefSetArray", res));
if (res != CUResult.Success) throw new CudaException(res);
}
开发者ID:lvaleriu,项目名称:managedCuda,代码行数:18,代码来源:CudaSurface.cs
示例15: GetLevelAsCUArray
/// <summary>
/// Returns a CUDA array that represents a single mipmap level
/// of the CUDA mipmapped array.
/// </summary>
/// <param name="level">Mipmap level</param>
public CUarray GetLevelAsCUArray(uint level)
{
CUarray array = new CUarray();
res = DriverAPINativeMethods.ArrayManagement.cuMipmappedArrayGetLevel(ref array, _mipmappedArray, level);
Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cuMipmappedArrayGetLevel", res));
if (res != CUResult.Success)
throw new CudaException(res);
return array;
}
开发者ID:lvaleriu,项目名称:managedCuda,代码行数:16,代码来源:CudaMipmappedArray.cs
示例16: CudaMipmappedArray
/// <summary>
/// Creates a CUDA mipmapped array according to <c>descriptor</c>. <para/>
/// Width, Height, and Depth are the width, height, and depth of the CUDA array (in elements); the following
/// types of CUDA arrays can be allocated:<para/>
/// – A 1D mipmapped array is allocated if Height and Depth extents are both zero.<para/>
/// – A 2D mipmapped array is allocated if only Depth extent is zero.<para/>
/// – A 3D mipmapped array is allocated if all three extents are non-zero.<para/>
/// – A 1D layered CUDA mipmapped array is allocated if only Height is zero and the <see cref="CUDAArray3DFlags.Layered"/>
/// flag is set. Each layer is a 1D array. The number of layers is determined by the depth extent.
/// – A 2D layered CUDA mipmapped array is allocated if all three extents are non-zero and the <see cref="CUDAArray3DFlags.Layered"/>
/// flag is set. Each layer is a 2D array. The number of layers is determined by the depth extent.
/// – A cubemap CUDA mipmapped array is allocated if all three extents are non-zero and the <see cref="CUDAArray3DFlags.Cubemap"/>
/// flag is set. Width must be equal to Height, and Depth must be six. A
/// cubemap is a special type of 2D layered CUDA array, where the six layers represent the six faces of a
/// cube. The order of the six layers in memory is the same as that listed in CUarray_cubemap_face.
/// – A cubemap layered CUDA mipmapped array is allocated if all three extents are non-zero, and both,
/// <see cref="CUDAArray3DFlags.Cubemap"/> and <see cref="CUDAArray3DFlags.Layered"/> flags are set. Width must be equal
/// to Height, and Depth must be a multiple of six. A cubemap layered CUDA array is a special type of
/// 2D layered CUDA array that consists of a collection of cubemaps. The first six layers represent the first
/// cubemap, the next six layers form the second cubemap, and so on.
/// </summary>
/// <param name="format">Array format</param>
/// <param name="width">Array width. See general description.</param>
/// <param name="height">Array height. See general description.</param>
/// <param name="depth">Array depth or layer count. See general description.</param>
/// <param name="numChannels">number of channels</param>
/// <param name="flags">Flags may be set to:<para/>
/// – <see cref="CUDAArray3DFlags.Layered"/> to enable creation of layered CUDA mipmapped arrays. If this flag is set,
/// Depth specifies the number of layers, not the depth of a 3D array.<para/>
/// – <see cref="CUDAArray3DFlags.Cubemap"/> to enable creation of mipmapped cubemaps. If this flag is set, Width
/// must be equal to Height, and Depth must be six. If the CUDA_ARRAY3D_LAYERED flag is also set,
/// then Depth must be a multiple of six.<para/>
/// – <see cref="CUDAArray3DFlags.TextureGather"/> to indicate that the CUDA mipmapped array will be used for
/// texture gather. Texture gather can only be performed on 2D CUDA mipmapped arrays.</param>
/// <param name="numMipmapLevels">Number of mipmap levels. This value is clamped to the range [1, 1 + floor(log2(max(width, height, depth)))]</param>
public CudaMipmappedArray(CUArrayFormat format, SizeT width, SizeT height, SizeT depth, CudaMipmappedArrayNumChannels numChannels, CUDAArray3DFlags flags, uint numMipmapLevels)
{
_mipmappedArray = new CUmipmappedArray();
_arrayDescriptor = new CUDAArray3DDescriptor();
_arrayDescriptor.Width = width;
_arrayDescriptor.Height = height;
_arrayDescriptor.Depth = depth;
_arrayDescriptor.NumChannels = (uint)numChannels;
_arrayDescriptor.Flags = flags;
_arrayDescriptor.Format = format;
res = DriverAPINativeMethods.ArrayManagement.cuMipmappedArrayCreate(ref _mipmappedArray, ref _arrayDescriptor, numMipmapLevels);
Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cuMipmappedArrayCreate", res));
if (res != CUResult.Success) throw new CudaException(res);
_isOwner = true;
}
开发者ID:lvaleriu,项目名称:managedCuda,代码行数:52,代码来源:CudaMipmappedArray.cs
示例17: CudaTextureMipmappedArray
/// <summary>
/// Creates a new mipmapped texture from array memory. Allocates a new mipmapped array.
/// </summary>
/// <param name="kernel"></param>
/// <param name="texName"></param>
/// <param name="addressMode0"></param>
/// <param name="addressMode1"></param>
/// <param name="addressMode2"></param>
/// <param name="filterMode"></param>
/// <param name="flags"></param>
/// <param name="descriptor"></param>
/// <param name="numMipmapLevels"></param>
/// <param name="maxAniso"></param>
/// <param name="mipmapFilterMode"></param>
/// <param name="mipmapLevelBias"></param>
/// <param name="minMipmapLevelClamp"></param>
/// <param name="maxMipmapLevelClamp"></param>
public CudaTextureMipmappedArray(CudaKernel kernel, string texName, CUAddressMode addressMode0, CUAddressMode addressMode1, CUAddressMode addressMode2,
CUFilterMode filterMode, CUTexRefSetFlags flags, CUDAArray3DDescriptor descriptor, uint numMipmapLevels,
uint maxAniso, CUFilterMode mipmapFilterMode, float mipmapLevelBias, float minMipmapLevelClamp, float maxMipmapLevelClamp)
{
_maxAniso = maxAniso;
_mipmapFilterMode = mipmapFilterMode;
_mipmapLevelBias = mipmapLevelBias;
_minMipmapLevelClamp = minMipmapLevelClamp;
_maxMipmapLevelClamp = maxMipmapLevelClamp;
_texref = new CUtexref();
res = DriverAPINativeMethods.ModuleManagement.cuModuleGetTexRef(ref _texref, kernel.CUModule, texName);
Debug.WriteLine(String.Format("{0:G}, {1}: {2}, Texture name: {3}", DateTime.Now, "cuModuleGetTexRef", res, texName));
if (res != CUResult.Success) throw new CudaException(res);
res = DriverAPINativeMethods.TextureReferenceManagement.cuTexRefSetAddressMode(_texref, 0, addressMode0);
Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cuTexRefSetAddressMode", res));
if (res != CUResult.Success) throw new CudaException(res);
res = DriverAPINativeMethods.TextureReferenceManagement.cuTexRefSetAddressMode(_texref, 1, addressMode1);
Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cuTexRefSetAddressMode", res));
if (res != CUResult.Success) throw new CudaException(res);
res = DriverAPINativeMethods.TextureReferenceManagement.cuTexRefSetAddressMode(_texref, 2, addressMode2);
Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cuTexRefSetAddressMode", res));
if (res != CUResult.Success) throw new CudaException(res);
res = DriverAPINativeMethods.TextureReferenceManagement.cuTexRefSetFilterMode(_texref, filterMode);
Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cuTexRefSetFilterMode", res));
if (res != CUResult.Success) throw new CudaException(res);
res = DriverAPINativeMethods.TextureReferenceManagement.cuTexRefSetFlags(_texref, flags);
Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cuTexRefSetFlags", res));
if (res != CUResult.Success) throw new CudaException(res);
res = DriverAPINativeMethods.TextureReferenceManagement.cuTexRefSetFormat(_texref, descriptor.Format, (int)descriptor.NumChannels);
Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cuTexRefSetFormat", res));
if (res != CUResult.Success) throw new CudaException(res);
_filtermode = filterMode;
_flags = flags;
_addressMode0 = addressMode0;
_addressMode1 = addressMode1;
_addressMode2 = addressMode2;
_arrayDescriptor = descriptor;
_name = texName;
_module = kernel.CUModule;
_cufunction = kernel.CUFunction;
_array = new CudaMipmappedArray(descriptor, numMipmapLevels);
res = DriverAPINativeMethods.TextureReferenceManagement.cuTexRefSetMipmappedArray(_texref, _array.CUMipmappedArray, CUTexRefSetArrayFlags.OverrideFormat);
Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cuTexRefSetMipmappedArray", res));
if (res != CUResult.Success) throw new CudaException(res);
res = DriverAPINativeMethods.TextureReferenceManagement.cuTexRefSetMaxAnisotropy(_texref, maxAniso);
Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cuTexRefSetMaxAnisotropy", res));
if (res != CUResult.Success) throw new CudaException(res);
res = DriverAPINativeMethods.TextureReferenceManagement.cuTexRefSetMipmapFilterMode(_texref, mipmapFilterMode);
Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cuTexRefSetMipmapFilterMode", res));
if (res != CUResult.Success) throw new CudaException(res);
res = DriverAPINativeMethods.TextureReferenceManagement.cuTexRefSetMipmapLevelBias(_texref, mipmapLevelBias);
Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cuTexRefSetMipmapLevelBias", res));
if (res != CUResult.Success) throw new CudaException(res);
res = DriverAPINativeMethods.TextureReferenceManagement.cuTexRefSetMipmapLevelClamp(_texref, minMipmapLevelClamp, maxMipmapLevelClamp);
Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cuTexRefSetMipmapLevelClamp", res));
if (res != CUResult.Success) throw new CudaException(res);
}
开发者ID:lvaleriu,项目名称:managedCuda,代码行数:79,代码来源:CudaTextureMipmappedArray.cs
示例18: Unregister
/// <summary>
/// Unmaps the memory range whose base address is specified by <c>p</c>, and makes it pageable again.<para/>
/// The base address must be the same one specified to <see cref="Register"/>.
/// </summary>
public void Unregister()
{
if (disposed) throw new ObjectDisposedException(this.ToString());
res = DriverAPINativeMethods.MemoryManagement.cuMemHostUnregister(_intPtr);
Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cuMemHostUnregister", res));
if (res != CUResult.Success) throw new CudaException(res);
_registered = false;
}
开发者ID:lvaleriu,项目名称:managedCuda,代码行数:12,代码来源:CudaRegisteredHostMemoryFixedTypes.cs
示例19: GetErrorMessageFromCUResult
private static string GetErrorMessageFromCUResult(CUResult error)
{
string message = string.Empty;
switch (error)
{
case CUResult.Success:
message = "No error.";
break;
case CUResult.ErrorInvalidValue:
message = "This indicates that one or more of the parameters passed to the API call is not within an acceptable range of values.";
break;
case CUResult.ErrorOutOfMemory:
message = "The API call failed because it was unable to allocate enough memory to perform the requested operation.";
break;
case CUResult.ErrorNotInitialized:
message = "The CUDA driver API is not yet initialized. Call cuInit(Flags) before any other driver API call.";
break;
case CUResult.ErrorDeinitialized:
message = "This indicates that the CUDA driver is in the process of shutting down.";
break;
case CUResult.ErrorProfilerDisabled:
message = "This indicates profiling APIs are called while application is running in visual profiler mode.";
break;
//case CUResult.ErrorProfilerNotInitialized:
// message = "This indicates profiling has not been initialized for this context. Call cuProfilerInitialize() to resolve this.";
// break;
//case CUResult.ErrorProfilerAlreadyStarted:
// message = "This indicates profiler has already been started and probably cuProfilerStart() is incorrectly called.";
// break;
//case CUResult.ErrorProfilerAlreadyStopped:
// message = "This indicates profiler has already been stopped and probably cuProfilerStop() is incorrectly called.";
// break;
case CUResult.ErrorNoDevice:
message = "This indicates that no CUDA-capable devices were detected by the installed CUDA driver.";
break;
case CUResult.ErrorInvalidDevice:
message = "This indicates that the device ordinal supplied by the user does not correspond to a valid CUDA device.";
break;
case CUResult.ErrorInvalidImage:
message = "This indicates that the device kernel image is invalid. This can also indicate an invalid CUDA module.";
break;
case CUResult.ErrorInvalidContext:
message = "This most frequently indicates that there is no context bound to the current thread. This can also be returned if the context passed to an API call is not a valid handle (such as a context that has had cuCtxDestroy() invoked on it). This can also be returned if a user mixes different API versions (i.e. 3010 context with 3020 API calls). See cuCtxGetApiVersion() for more details.";
break;
//CUResult.ErrorContextAlreadyCurrent is marked obsolet since CUDA version 3.2
//case CUResult.ErrorContextAlreadyCurrent:
// message = "This indicated that the context being supplied as a parameter to the API call was already the active context.";
// break;
case CUResult.ErrorMapFailed:
message = "This indicates that a map or register operation has failed.";
break;
case CUResult.ErrorUnmapFailed:
message = "This indicates that an unmap or unregister operation has failed.";
break;
case CUResult.ErrorArrayIsMapped:
message = "This indicates that the specified array is currently mapped and thus cannot be destroyed.";
break;
case CUResult.ErrorAlreadyMapped:
message = "This indicates that the resource is already mapped.";
break;
case CUResult.ErrorNoBinaryForGPU:
message = "This indicates that there is no kernel image available that is suitable for the device. This can occur when a user specifies code generation options for a particular CUDA source file that do not include the corresponding device configuration.";
break;
case CUResult.ErrorAlreadyAcquired:
message = "This indicates that a resource has already been acquired.";
break;
case CUResult.ErrorNotMapped:
message = "This indicates that a resource is not mapped.";
break;
case CUResult.ErrorNotMappedAsArray:
message = "This indicates that a mapped resource is not available for access as an array.";
break;
case CUResult.ErrorNotMappedAsPointer:
message = "This indicates that a mapped resource is not available for access as a pointer.";
break;
case CUResult.ErrorECCUncorrectable:
message = "This indicates that an uncorrectable ECC error was detected during execution.";
break;
case CUResult.ErrorUnsupportedLimit:
message = "This indicates that the CUlimit passed to the API call is not supported by the active device.";
break;
case CUResult.ErrorContextAlreadyInUse:
message = "This indicates that the ::CUcontext passed to the API call can only be bound to a single CPU thread at a time but is already bound to a CPU thread.";
break;
case CUResult.ErrorPeerAccessUnsupported:
message = "This indicates that peer access is not supported across the given devices.";
break;
case CUResult.ErrorInvalidPtx:
message = "This indicates that a PTX JIT compilation failed.";
break;
case CUResult.ErrorInvalidGraphicsContext:
message = "This indicates an error with OpenGL or DirectX context.";
break;
case CUResult.ErrorInvalidSource:
message = "This indicates that the device kernel source is invalid.";
break;
case CUResult.ErrorFileNotFound:
message = "This indicates that the file specified was not found.";
break;
//.........这里部分代码省略.........
开发者ID:lvaleriu,项目名称:managedCuda,代码行数:101,代码来源:CudaException.cs
示例20: CUDAException
public CUDAException(CUResult error, string message, Exception e) : base(message, e)
{
this.error = error;
}
开发者ID:constructor-igor,项目名称:cudafy,代码行数:4,代码来源:CUDAException.cs
注:本文中的CUResult类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论