本文整理汇总了C#中CudaArray1D类的典型用法代码示例。如果您正苦于以下问题:C# CudaArray1D类的具体用法?C# CudaArray1D怎么用?C# CudaArray1D使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CudaArray1D类属于命名空间,在下文中一共展示了CudaArray1D类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
示例2: CudaResourceDesc
/// <summary>
///
/// </summary>
/// <param name="var"></param>
public CudaResourceDesc(CudaArray1D var)
{
resType = CUResourceType.Array;
flags = 0;
res = new CudaResourceDescUnion();
res.hMipmappedArray = new CUmipmappedArray();
res.linear = new CudaResourceDescLinear();
res.pitch2D = new CudaResourceDescPitch2D();
res.hArray = var.CUArray;
}
示例3: AsyncCopyFromArray1D
/// <summary>
/// Asynchron copy 1D Array to host
/// </summary>
/// <param name="array"></param>
/// <param name="stream"></param>
/// <param name="offset"></param>
public void AsyncCopyFromArray1D(CudaArray1D array, CUstream stream, SizeT offset)
{
AsyncCopyFromArray1D(array.CUArray, stream, offset);
}
示例4: SynchronCopyFromArray1D
/// <summary>
/// Synchron copy 1D Array to host
/// </summary>
/// <param name="array"></param>
/// <param name="offset"></param>
public void SynchronCopyFromArray1D(CudaArray1D array, SizeT offset)
{
SynchronCopyFromArray1D(array.CUArray, offset);
}
示例5: 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);
}