Python – 修复cupy.cuda.compile_with_cache deprecated错误
1 修复cupy.cuda.compile_with_cache deprecated错误
最近在跑https://github.com/alex04072000/FuSta,以下的代码
@cupy.memoize(for_each_device=True)
def cupy_launch(strFunction, strKernel):
return cupy.cuda.compile_with_cache(strKernel).get_function(strFunction)
出现了cupy.cuda.compile_with_cache deprecated的问题,这是由于在项目中安装了cupy的高版本,导致不兼容原有的函数。
上述代码可以进行如下修改:
@cupy.memoize(for_each_device=True)
def cupy_launch(strFunction, strKernel):
module = cupy.RawModule(code=strKernel)
return module.get_function(strFunction)
即可解决。
参考链接
本文作者:StubbornHuang
版权声明:本文为站长原创文章,如果转载请注明原文链接!
原文标题:Python – 修复cupy.cuda.compile_with_cache deprecated错误
原文链接:https://www.stubbornhuang.com/3125/
发布于:2025年02月27日 15:59:44
修改于:2025年02月27日 16:00:30
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。
评论
52