Parallel::Pvm and Inline C

Discussion in 'Perl Misc' started by ilp, Apr 8, 2007.

  1. ilp

    ilp Guest

    Has anyone gotten inline C to work with Parallel::pvm. It seems to
    choke on the "use Inline C;" statement. Thank.
    ilp, Apr 8, 2007
    #1
    1. Advertising

  2. ilp

    Sisyphus Guest

    "ilp" <> wrote in message
    news:...
    > Has anyone gotten inline C to work with Parallel::pvm. It seems to
    > choke on the "use Inline C;" statement. Thank.
    >


    Not sure that anyone has tried :)

    In general, there's no problem combining perl extensions with Inline::C. A
    simple demo script might help. (Make it as minimal as possible - and also
    provide a copy'n'paste of the error messages produced.)

    Cheers,
    Rob
    Sisyphus, Apr 8, 2007
    #2
    1. Advertising

  3. ilp

    ilp Guest

    On Apr 8, 10:48 am, "Sisyphus" <> wrote:
    > "ilp" <> wrote in message
    >
    > news:...
    >
    > > Has anyone gotten inline C to work with Parallel::pvm. It seems to
    > > choke on the "use Inline C;" statement. Thank.

    >
    > Not sure that anyone has tried :)
    >
    > In general, there's no problem combining perl extensions with Inline::C. A
    > simple demo script might help. (Make it as minimal as possible - and also
    > provide a copy'n'paste of the error messages produced.)
    >
    > Cheers,
    > Rob


    Welp, I'd have to butcher a rather long module, but here's the jist of
    it:
    Assume that pvm is running and has a few hosts added.
    mod1.pl:

    use Parallel::pvm;

    my ($ntask,$tids) = Parallel::pvm::spawn( "/foo/bar.pl", 1);

    1;
    ------
    bar.pl:

    use Inline CPP => DATA =>
    LIBS => '-lalib;

    print "Hello Parallel World!";

    1;
    ----

    output:

    Terminated
    ilp, Apr 9, 2007
    #3
  4. ilp

    ilp Guest

    On Apr 9, 12:35 am, "ilp" <> wrote:
    > On Apr 8, 10:48 am, "Sisyphus" <> wrote:
    >
    > > "ilp" <> wrote in message

    >
    > >news:...

    >
    > > > Has anyone gotten inline C to work with Parallel::pvm. It seems to
    > > > choke on the "use Inline C;" statement. Thank.

    >
    > > Not sure that anyone has tried :)

    >
    > > In general, there's no problem combining perl extensions with Inline::C. A
    > > simple demo script might help. (Make it as minimal as possible - and also
    > > provide a copy'n'paste of the error messages produced.)

    >
    > > Cheers,
    > > Rob

    >
    > Welp, I'd have to butcher a rather long module, but here's the jist of
    > it:
    > Assume that pvm is running and has a few hosts added.
    > mod1.pl:
    >
    > use Parallel::pvm;
    >
    > my ($ntask,$tids) = Parallel::pvm::spawn( "/foo/bar.pl", 1);
    >
    > 1;
    > ------
    > bar.pl:
    >
    > use Inline CPP => DATA =>
    > LIBS => '-lalib;
    >
    > print "Hello Parallel World!";
    >
    > 1;
    > ----
    >
    > output:
    >
    > Terminated



    Sorry, 'bar.pl' would actually be:

    bar.pl:

    use Inline C => DATA =>
    LIBS => '-lalib;

    print "Hello Parallel World!";

    1;

    __DATA__
    __C__


    __END__
    __C__
    ilp, Apr 9, 2007
    #4
  5. ilp

    Sisyphus Guest

    "ilp" <> wrote in message
    news:...
    ..
    ..
    >
    > Sorry, 'bar.pl' would actually be:
    >
    > bar.pl:
    >
    > use Inline C => DATA =>
    > LIBS => '-lalib;
    >
    > print "Hello Parallel World!";
    >
    > 1;
    >
    > __DATA__
    > __C__
    >
    >
    > __END__
    > __C__
    >


    You might get some hint of what's going wrong if you run verbosely - by
    starting that script with:


    use Inline C => DATA =>
    BUILD_NOISY => 1,
    LIBS => '-lalib';

    Do you really need the "LIBS => '-lalib'" entry to produce the error ? I
    wouldn't expect a line as inoccuous as that to have any effect on whether an
    error occurs or not - though, admittedly, I don't know what Parallel::pvm
    does, and if it's doing something a bit weird then I guess anything is
    possible :)

    Cheers,
    Rob
    Sisyphus, Apr 9, 2007
    #5
  6. ilp

    jon Guest

    Tried those things. No dice. The C compilation phase completes
    without error. This is really annoying. I guess I've sorta reached
    that grey area where Perl is no longer the best language choice. --jn
    jon, Apr 10, 2007
    #6
  7. ilp

    Sisyphus Guest

    "jon" <> wrote in message
    news:...
    > Tried those things. No dice. The C compilation phase completes
    > without error. This is really annoying. I guess I've sorta reached
    > that grey area where Perl is no longer the best language choice. --jn
    >


    Perhaps so. But if it's just Inline that's creating the problem, then
    there's always the solution of dispensing with Inline, and using a normal
    perl extension (module) - one that offers the same functions as the Inline
    script, but it does it without using Inline. Take your Inline::C/CPP
    functions and rewrite them as an XS file that can be used with a
    Makefile.PL, .pm file to build the perl extension in the usual way (ie 'perl
    Makefile.PL', 'make', 'make test', 'make install'), without any dependence
    on Inline. It's quite easy using InlineX::C2XS/InlineX::CPP2XS (both of
    which can also write the Makefile.PL for you).

    Cheers,
    Rob
    Sisyphus, Apr 10, 2007
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Janus Torsen

    PVM and Java

    Janus Torsen, Dec 30, 2003, in forum: Java
    Replies:
    0
    Views:
    488
    Janus Torsen
    Dec 30, 2003
  2. targeting the PVM

    , Oct 13, 2003, in forum: Python
    Replies:
    1
    Views:
    303
    Terry Reedy
    Oct 13, 2003
  3. abhinav
    Replies:
    1
    Views:
    437
    Armin Steinhoff
    Feb 19, 2006
  4. reinsn

    Other languages for PVM

    reinsn, Mar 16, 2006, in forum: Python
    Replies:
    3
    Views:
    282
    Ravi Teja
    Mar 16, 2006
  5. Casey Hawthorne

    PyPy with a smaller PVM for the full Python?

    Casey Hawthorne, Sep 11, 2006, in forum: Python
    Replies:
    2
    Views:
    308
    John Roth
    Sep 11, 2006
Loading...

Share This Page