Bioperl: Working pvm app in perl

Mr P.A. Van Heusden pvanheus@hgmp.mrc.ac.uk
Fri, 10 Sep 1999 15:18:38 +0100 (BST)


  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.
  Send mail to mime@docserver.cac.washington.edu for more info.

---559023410-851401618-936973118=:2002
Content-Type: TEXT/PLAIN; charset=US-ASCII

Hi

I didn't quite know who to send this to, but since this came up at the
BioPerl conference, I thought I'd announce it here.

As a number of people know, the common wisdom about pvm and perl has been
that pvm doesn't work in perl. Well, I've just managed to get a working
master/slave pvm add working using the Parallel::Pvm and pvm-3.4.1.

There was a minor bug in Parallel::Pvm, which I've attached a patch for.
Patch by going to the Parallel::Pvm directory and using the command

patch -p1 -N < patchfile

Attached to this message are two files:

master.pl is a server, which spawns a number of pvm tasks, and sends its 
TID to them so that they can communicate with it.

slave.pl is a client which is started by master.pl, and simply generates
pseudo-random numbers and sends them to the master.

To run these things, install the Parallel::Pvm module, look at the 'use
lib' lines in the scripts to see what to change them to, put the two
scripts in your path, and run master.pl.

The framework implemented in these scripts is a rather simplistic one
which doesn't deal with issues such as hosts dissapearing midway through a
job (which should be dealt with, particularly if you want to run under a
dynamic load balancing system - such as Condor-PVM).

But being able to write pvm jobs in perl is still quite cool, IMO.

Cheers,
Peter
--
Peter van Heusden : pvanheus@hgmp.mrc.ac.uk : PGP key available
'The demand to give up illusions about the existing state of affairs is the 
demand to give up a state of affairs which needs illusions.' - Karl Marx

---559023410-851401618-936973118=:2002
Content-Type: TEXT/PLAIN; charset=US-ASCII; name="master.pl"
Content-Transfer-Encoding: BASE64
Content-ID: <Pine.GSO.3.94.990910151838.2002C@rhenium>
Content-Description: master.pl

IyEvdXNyL2xvY2FsL2Jpbi9wZXJsDQoNCnVzZSBzdHJpY3Q7DQoNCnVzZSBs
aWIgcXcoL2hvbWUvcmFkb24vRVNUL3B2YW5oZXVzL3BlcmwvbGliL3NpdGVf
cGVybC81LjAwNSAvaG9tZS9yYWRvbi9F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g0Kc3ViIHN0b3BfY2hpbGRyZW5fYW5k
X2V4aXQgew0KICBteSAkc2lnID0gc2hpZnQ7DQoNCiAgaWYgKCRzaWcgZXEg
J0lOVCcpIHsNCiAgICBzdG9wX2NoaWxkcmVuKEB0aWRzKTsNCiAgICBQYXJh
bGxlbDo6UHZtOjpleGl0Ow0KICAgIGV4aXQgMDsNCiAgfQ0KfQ0K
---559023410-851401618-936973118=:2002
Content-Type: TEXT/PLAIN; charset=US-ASCII; name="slave.pl"
Content-Transfer-Encoding: BASE64
Content-ID: <Pine.GSO.3.94.990910151838.2002D@rhenium>
Content-Description: slave.pl

IyEvdXNyL2xvY2FsL2Jpbi9wZXJsDQoNCnVzZSBzdHJpY3Q7DQoNCnVzZSBs
aWIgcXcoL2hvbWUvcmFkb24vRVNUL3B2YW5oZXVzL3BlcmwvbGliL3NpdGVf
cGVybC81LjAwNSAvaG9tZS9yYWRvbi9FU1QvcHZhbmhldXMvcGVybC9saWIv
c2l0ZV9wZXJsLzUuMDA1L3N1bjQtc29sYXJpcyk7DQp1c2UgUGFyYWxsZWw6
OlB2bTsNCg0KbXkgJENISUxEX01FU1NBR0UgPSA1MDA7DQpteSAkU0VSVkVS
X01FU1NBR0UgPSA1MDE7DQoNCm15ICRzbGF2ZV90aWQgPSBQYXJhbGxlbDo6
UHZtOjpteXRpZDsNClBhcmFsbGVsOjpQdm06OmNhdGNob3V0Ow0KDQpteSAk
YnVmaWQ7IG15ICRzZXJ2ZXJfdGlkID0gLTE7DQpwcmludCAiTXkgdGlkIGlz
OiAkc2xhdmVfdGlkLCByZWFkeSB0byByZWNlaXZlIG1lc3NhZ2VzXG4iOw0K
d2hpbGUgKCgkYnVmaWQgPSBQYXJhbGxlbDo6UHZtOjpyZWN2KC0xLCAkU0VS
VkVSX01FU1NBR0UpKSA+PSAwKSB7DQogIG15ICh1bmRlZiwgdW5kZWYsIHVu
ZGVmLCAkdGlkKSA9IFBhcmFsbGVsOjpQdm06OmJ1ZmluZm8oJGJ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ZvKCRidWZpZCk7DQogIHByaW50ICJFcnJvciByZWNl
aXZpbmcgbWVzc2FnZSBmcm9tIHBhcmVudCAoJHRpZCk6ICRpbmZvLlxuIjsN
CiAgcHJpbnQgIkV4aXRpbmdcbiI7DQogIGV4aXQgMTsNCn0NCg==
---559023410-851401618-936973118=:2002
Content-Type: TEXT/PLAIN; charset=US-ASCII; name=patch
Content-Transfer-Encoding: BASE64
Content-ID: <Pine.GSO.3.94.990910151838.2002E@rhenium>
Content-Description: patch to Parallel::Pvm

KioqIFBhcmFsbGVsLVB2bS0xLjEvUHZtLnhzCVR1ZSBPY3QgMTUgMDQ6MTU6
MzMgMTk5Ng0KLS0tIFBhcmFsbGVsLVB2bS0xLjEubmV3L1B2bS54cwlGcmkg
U2VwIDEwIDEzOjU5OjQ5IDE5OTkNCioqKioqKioqKioqKioqKg0KKioqIDcz
Miw3MzggKioqKg0KICAJU2FmZWZyZWUoIGFyZ3YgKTsgLyogbm8gaGFybSBk
b25lIGlmIGFyZ3YgaXMgTlVMTCAqLw0KICAgDQogIAlYUFVTSHMoc3ZfMm1v
cnRhbChuZXdTVml2KGluZm8pKSk7DQohIAlmb3IgKGk9MDtpPGluZm87aSsr
KXsNCiAgCSAgIFhQVVNIcyhzdl8ybW9ydGFsKG5ld1NWaXYodGlkc1tpXSkp
KTsNCiAgCX0NCiAgDQotLS0gNzMyLDczOCAtLS0tDQogIAlTYWZlZnJlZSgg
YXJndiApOyAvKiBubyBoYXJtIGRvbmUgaWYgYXJndiBpcyBOVUxMICovDQog
ICANCiAgCVhQVVNIcyhzdl8ybW9ydGFsKG5ld1NWaXYoaW5mbykpKTsNCiEg
CWZvciAoaT0wO2k8bnRhc2s7aSsrKXsNCiAgCSAgIFhQVVNIcyhzdl8ybW9y
dGFsKG5ld1NWaXYodGlkc1tpXSkpKTsNCiAgCX0NCiAgDQo=
---559023410-851401618-936973118=:2002--

=========== Bioperl Project Mailing List Message Footer =======
Project URL: http://bio.perl.org/
For info about how to (un)subscribe, where messages are archived, etc:
http://www.techfak.uni-bielefeld.de/bcd/Perl/Bio/vsns-bcd-perl.html
====================================================================