CUDA是否支持递归? [英] Does CUDA support recursion?

查看:482
本文介绍了CUDA是否支持递归?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

CUDA是否支持递归?

Does CUDA support recursion?

推荐答案

它支持计算能力2.0和CUDA 3.1的NVIDIA硬件:

It does on NVIDIA hardware supporting compute capability 2.0 and CUDA 3.1:


新增的语言功能已添加到CUDA C
/ C ++ include

支持函数
指针和递归使得更容易
将许多现有算法移植到
Fermi GPU

Support for function pointers and recursion make it easier to port many existing algorithms to Fermi GPUs

http://developer.nvidia.com /object/cuda_3_1_downloads.html

函数指针
http://developer.download.nvidia.com/compute/cuda/sdk/website/CUDA_Advanced_Topics.html# Function pointers

递归:
我在NVIDIA网站上找不到代码示例, href =http://forums.nvidia.com/index.php?showtopic=174076 =noreferrer>论坛有人张贴此讯息:

__device__ int fact(int f)
{
  if (f == 0)
    return 1;
  else
    return f * fact(f - 1);
}

这篇关于CUDA是否支持递归?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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