February 2013 Archives

CUDA::Minimal, back where it should be (but why did it break?)

I just posted an entry about how CUDA::Minimal was behaving weirdly. I hadn't dug around to figure out what was going on, and I went so far as to modify the way the code was compiled and linked to get it to work! My previous post raised concerns about how I would continue with the newly-chosen path.

Well, I decided that I should really figure out what was giving trouble. After many hours (and staying up later than I ought), I figured it out. I highly suspect that these problems are due to interactions with C macros defined by nVidia, but I'm not sure. I'm going to post them here, and possibly also the the perl-xs mailing list, in hopes that they might help somebody solve problems.

There were two big changes. First, all XS code that uses ExtUtils::nvcc has to include this in their boot sections:

BOOT:
#undef PERL_VERSION
#define PERL_VERSION 0

Why? Because this generated C code that came later in the BOOT section was causing segfaults:

#if (PERL_REVISION == 5 && PERL_VERSION >= 9)
  if (PL_unitcheckav)
       call_list(PL_scopestack_ix, PL_unitcheckav);

Second, in order to get the address of the pointer value part of a scalar, I use sv_2pvbyte_nolen. I originally used SvPVX (having verified that he slot existed), but that started to return nil in this new compilation setup. I also tried using SvPVbyte_nolen, but that also returned nil. The perlapi docs for sv_2pvbyte_nolen state this function is "Usually accessed via the SvPVbyte_nolen macro," but I can't figure out if there's anything bad with using sv_2pvbyte_nolen.

You might ask why I don't file these on perlbug. Like I said, I'm not sure if these are bugs with Perl, or with the Perl-nvcc interactions. If it's the latter, I'm not so worried about them, and I'd rather at least begin by finding and documenting these troubles. I'll try to fix them if they really start giving trouble. If you have any ideas for what is going on or want me to try something to figure it out, feel free to respond here, or file a bug report on CUDA::Minimal.

And with that, I'm going to get my play-perl points. :-)

CUDA::Minimal takes two steps backwards, one step forward

Edit: I got my original approach to work, see my follow-up.

A week ago I wrote about how I though play-perl was great. I put up a bunch of ideas and waited to see what others would encourage me to do. Two of my ideas got two votes each (some others got single votes), one of which involved revising CUDA::Minimal sot it works again. (CUDA is a means for executing massively parallelized code on your video card.) Well, it compiles now, but it doesn't quite work the way I had hoped and I am facing some basic architectural redesign issues. Herein I describe the old way things worked, and why that won't work anymore. Can anybody offer some ideas for how I might move forward?

I <3 play-perl

play-perl was only just announced, but I've already fallen in love with it. There seems to be some confusion about how it works, so I thought I would lend my interpretation. Note that I did not write it nor am I affiliated with it, but I think it's awesome and want to get people using it!

If you're like me, you have a lot of ideas floating around in your head for open source projects. Mine tend to be oriented towards computational science, but it could be anything. And, if you're like me, a big part of your open source experience centers on making ot…

$3M says Perl5 needs a new major version number

Yesterday, Ovid started his discussion about moving the major version of Perl 5 to Perl 7. You know what else happened that day? Continuum Analytics won $3M from DARPA to undertake a huge renovation to NumPy. Three. Million. Dollars. Not for Python. For an extension for Python. Continuum plans to add all kinds of capabilities, but bear in mind that PDL already possesses at least one of those, namely built-in support for missing data. From the technical standpoint, we were already ahead, and…

About David Mertens

user-pic This is my blog about numerical computing with Perl.