English 中文(简体)
撰写CUDA kernel,以取代CPU这一同等功能
原标题:Writing a CUDA kernel to replace an equivalent CPU-only function

我拥有一些<代码>cpp的文档。 Smoothed Particle Hydrodynamics, which is a particle methods for model fluid flow.

这些微粒技术中最耗时的成分之一是在模拟的每一个时间段找到最接近的邻居(K-nearest邻居或牧场搜索)。

Right now I just want to accelerate the neighbor search routine using GPU s and CUDA, replacing my current CPU based neighbour search routine. Only neighbour search will run on the GPU s while the rest of the simulation proceeds on the CPU.

My question is, how should I go about compiling the entire code? To be more specific, suppose I write the neighbour search kernel function in a file nsearch.cu.

然后,请让我<>姓名>。 我之前的<代码>.cpp文档,作为.cu文档,并用nvcc对整套文件(连同nsearch.cu)进行再编? 至少简单的例子:nvcc cannot。 汇编《世界人权宣言》的编码,并附有延伸<条码>。 汇编但<代码>nvcc hello.cpp 页: 1

简言之,本《宣言》的结构应当是什么,我应如何编纂?

我正在使用Ubuntulav 10.10, CUDA 4.0, NVIDIA G Sk 570。 (竞争能力2.0)和gcc 我的工作汇编者

最佳回答

你们需要撰写论文。 收集并编集“nvcc-c-o nsearch.o”,然后将Nsearch.o与主要应用联系起来。 必须有一只 n子,出口一只 wrap子。

in nsearch.h : 
void kern();

in nsearch.cu:
void __global__ kern__() {
}
void kern() {
  kern__<<<...>>>();
}
问题回答

这是对你的问题的更广泛回应,因为我一直通过与你非常相似的思想过程——把我关于水动力学的法典移至万国邮联,而其他一切都留给万国邮联。 虽然我认为你应该开始哪儿,但我也认为,你应该开始规划把你所有其他法典移至万国邮联。 我发现,虽然万国邮联在为我的模拟进行所需的矩阵分解时非常好,但万国邮联和万国邮联记忆之间的记忆边界如此缓慢,像万国邮联模拟时间的80-90%这样的东西正在花在奇达梅西弗·托霍斯特/坎达梅西·霍斯特·托多奇。





相关问题
Undefined reference

I m getting this linker error. I know a way around it, but it s bugging me because another part of the project s linking fine and it s designed almost identically. First, I have namespace LCD. Then I ...

C++ Equivalent of Tidy

Is there an equivalent to tidy for HTML code for C++? I have searched on the internet, but I find nothing but C++ wrappers for tidy, etc... I think the keyword tidy is what has me hung up. I am ...

Template Classes in C++ ... a required skill set?

I m new to C++ and am wondering how much time I should invest in learning how to implement template classes. Are they widely used in industry, or is this something I should move through quickly?

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

typedef ing STL wstring

Why is it when i do the following i get errors when relating to with wchar_t? namespace Foo { typedef std::wstring String; } Now i declare all my strings as Foo::String through out the program, ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

Window iconification status via Xlib

Is it possible to check with the means of pure X11/Xlib only whether the given window is iconified/minimized, and, if it is, how?

热门标签