• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# CudaArray1D类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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);
		}
开发者ID:lvaleriu,项目名称:managedCuda,代码行数:16,代码来源:CudaSurfObject.cs


示例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;
		}
开发者ID:lvaleriu,项目名称:managedCuda,代码行数:14,代码来源:BasicTypes.cs


示例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);
		}
开发者ID:lvaleriu,项目名称:managedCuda,代码行数:10,代码来源:CudaRegisteredHostMemoryFixedTypes.cs


示例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);
		}
开发者ID:lvaleriu,项目名称:managedCuda,代码行数:9,代码来源:CudaRegisteredHostMemoryFixedTypes.cs


示例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);
        }
开发者ID:lvaleriu,项目名称:managedCuda,代码行数:52,代码来源:CudaTextureArray1D.cs



注:本文中的CudaArray1D类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# CudaDeviceVariable类代码示例发布时间:2022-05-24
下一篇:
C# CubeGridEntity类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap