如何将我现有的 .cpp 代码与 cuda 一起使用 [英] how to use my existing .cpp code with cuda

查看:23
本文介绍了如何将我现有的 .cpp 代码与 cuda 一起使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 c++ 中编写代码并想将它与 cuda 一起使用.有人可以帮帮我吗?我应该提供我的代码吗?实际上我试过这样做,但我需要一些起始代码来继续我的代码.我知道如何为 windows(visual studio)做简单的方形程序(使用 cuda 和 c++).为我的程序做这些事情就足够了吗?

I hv code in c++ and wanted to use it along with cuda.Can anyone please help me? Should I provide my code?? Actually I tried doing so but I need some starting code to proceed for my code.I know how to do simple square program (using cuda and c++)for windows(visual studio) .Is it sufficient to do the things for my program?

推荐答案

以下都是不错的起点.CUDA by Example 是一个很好的教程,可以让你快速启动和运行.大规模并行处理器编程包括更多背景知识,例如有关 GPU 架构历史的章节,通常更深入.

The following are both good places to start. CUDA by Example is a good tutorial that gets you up and running pretty fast. Programming Massively Parallel Processors includes more background, e.g. chapters on the history of GPU architecture, and generally more depth.

CUDA 示例:通用 GPU 简介编程

大规模并行处理器编程:实践方法

这两篇文章都在谈论 CUDA 3.x,因此您可能会想了解一下 CUDA 4.x 中的新功能.

These both talk about CUDA 3.x so you'll want to look at the new features in CUDA 4.x at some point.

Thrust 如果您的问题很好地映射到它,绝对值得一看(见上面的评论).它是一个类似 STL 的容器、迭代器和算法库,在 CUDA 之上实现数据并行算法.

Thrust is definitely worth a look if your problem maps onto it well (see comment above). It's an STL-like library of containers, iterators and algorithms that implements data-parallel algorithms on top of CUDA.

这里有两个关于开始使用 CUDA 和 Visual C++ 2010 的教程:

Here are two tutorials on getting started with CUDA and Visual C++ 2010:

http://www.ademiller.com/blogs/tech/2011/03/using-cuda-and-thrust-with-visual-studio-2010/

http://blog.cuvilib.com/2011/02/24/how-to-run-cuda-in-visual-studio-2010/

NVIDIA 论坛上也有一个帖子:

There's also a post on the NVIDIA forum:

http://forums.nvidia.com/index.php?showtopic=184539

非常笼统地询问我如何开始...在 Stack Overflow 上通常不是最好的方法.通常,您会得到的最佳答复是去读一本书或手册".在这里提出具体问题要好得多.请不要创建重复的问题,这没有帮助.

Asking very general how do I get started on ... on Stack Overflow generally isn't the best approach. Typically the best reply you'll get is "go read a book or the manual". It's much better to ask specific questions here. Please don't create duplicate questions, it isn't helpful.

这篇关于如何将我现有的 .cpp 代码与 cuda 一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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