Right. As you can see from the example I posted, you have to keep a
separation between host compiler code and nvcc code, which you then
link together. There are a few things to keep in mind.
1) NVCC cannot see any boost::python. I'm in the process of filing a
bug against boost::python, which contains some non-standard C++ that
will never be compilable by NVCC. Consequently, you'll need to do all
the manipulation of Python objects (access, construction) in host code
compiled with the host compiler.
2) The host compiler cannot see any GPU code. So all your calls to
Thrust, etc. should be done from the device module. You can include
your own code and link against your own libraries with the appropriate
3) As far as templates go, I've used two main strategies. As you
mentioned, one is to write a wrapper which instantiates the template,
and call that wrapper from the host code. The other is to use
explicit template instantiation in the device module, and use an
extern template instantiation in the host module. Both have worked
for me in the past.
On Wed, May 23, 2012 at 2:20 AM, Apostolis Glenis <apostglen46(a)gmail.com> wrote:
Really cool stuff.I guess I can have my thrust code in
a different file and
just compile the file at runtime,correct?
One more thing is templates.If I have a function that requires template
argument,i have to write a wrapper function for initialization at runtime?
2012/5/23 Bryan Catanzaro <bcatanzaro(a)acm.org>
Thanks and Done!
On Tue, May 22, 2012 at 4:29 PM, Andreas Kloeckner
> On Tue, 22 May 2012 15:43:12 -0700, Bryan Catanzaro <bcatanzaro(a)acm.org>
>> Sure, here's an example of how to call thrust::sort on a PyCUDA
> Cool, like it! I've stolen this and put it here:
> Bryan, can you please fill in a license there?