如何使用T = float替换已弃用的tex2D(纹理,T,2,cudaReadModeElementType,float,float)? [英] How to replace the deprecated tex2D(texture<T, 2, cudaReadModeElementType>, float, float) [with T=float]?

查看:120
本文介绍了如何使用T = float替换已弃用的tex2D(纹理,T,2,cudaReadModeElementType,float,float)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在cuda 11.3程序中,我正在使用

In a cuda 11.3 program, I'm using

tex2D(texture<T, 2, cudaReadModeElementType>, float, float)

在texture_fetch_functions.h(198)中已声明弃用.用什么代替它?以及如何使用它?

which was declared deprecated in texture_fetch_functions.h(198). What replaces it ? and how do I use it ?

警告:函数"tex2D(texture< T,2,cudaReadModeElementType> ;,float,float)[with T = float]"2> C:\ Program Files \ NVIDIA GPU计算工具包\ CUDA \ v11.3 \ include \ texture_fetch_functions.h(198):这是宣布已弃用

warning : function "tex2D(texture<T, 2, cudaReadModeElementType>, float, float) [with T=float]" 2>C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.3\include\texture_fetch_functions.h(198): here was declared deprecated

推荐答案

纹理历史上有两种使用模型:纹理参考和

Textures have historically come in 2 usage models: texture references and texture objects. Texture references were the "original" mechanism supplied with CUDA and texture objects were introduced with the Kepler generation of GPUs.

纹理参考用法在CUDA 11.3中已被弃用.使用纹理引用几乎可以执行的任何操作都可以通过纹理对象进行一些重构.

Texture reference usage is being deprecated in CUDA 11.3. Nearly anything you can do with texture references can be done with texture objects, with some refactoring.

The replacement API for the one you indicate is documented here. There are many questions here on the cuda tag discussing both texture reference usage and texture object usage, and this introductory blog covers the benefits of refactoring to use texture objects.

此处是对纹理对象使用 tex2D().

这篇关于如何使用T = float替换已弃用的tex2D(纹理,T,2,cudaReadModeElementType,float,float)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆