Very cool, David!

Does it work with windows?  CUDA is great but I'm
stuck at the moment with computers running windows
rather than unix and (unfortunately) CUDA doesn't
speak gcc for windows platforms.

Part of my push to get PDL fully ported to windows
is to allow for direct CUDA support.

Cheers,
Chris

On 11/30/2010 2:30 AM, David Mertens wrote:
Hey folks -

I have succeeded in transferring data from Perl to my video card, calling a
kernel to operate on that data, and transferring the data back to Perl.
Herein I describe how I got it working. Comments, suggestions, advice for
moving forward, and general enthusiasm would be greatly appreciated.

The first question I asked myself was this: Could I simply use Inline::C and
specify nvcc as my compiler? Answer: No. ExtUtils::MakeMaker sends a whole
boatload of compiler flags to gcc that makes nvcc choke. However, there is a
way to send special compiler flags to the compiler backend, using the
-Xcompiler=flag1,flag2,... option for nvcc.

Thence came the next question: Could I use a perl script for Inline::C's
compiler and linker? Answer: Yes. So, I wrote a little perl script that
takes all of the command-line options and checks if they are valid nvcc
options or flags. If so, it passes them along to nvcc unmodified, and if not
it collects them and packages them into a -Xcompiler=... or -Xlinker=...
argument. It then calls nvcc with the revised set of flags and options.

And after a bit of fiddling, it actually worked. I've posted my code on
github at this address: https://github.com/run4flat/perl_nvcc

My plans are to create CPAN distributions ExtUtils::nvcc (which would
install perl_nvcc) and Inline::CUDA (which would be derived from Inline::C).
If I still have energy, I may work with Module::Build to include some sort
of CUDA support. Eventually, I'd like to start working on the CUDA-Perl
bindings, which I'll take elsewhere, probably to the PDL list. Does these
sound like a good ideas? Is anybody else interested?

David





No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 9.0.872 / Virus Database: 271.1.1/3288 - Release Date: 11/29/10 
14:34:00


Reply via email to