Parallel-Pvm

 view release on metacpan or  search on metacpan

Pvm.pm  view on Meta::CPAN

package Parallel::Pvm;

use strict;
use Carp;
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK $AUTOLOAD);

require Exporter;
require DynaLoader;
require AutoLoader;

@ISA = qw(Exporter DynaLoader);
# Items to export into callers namespace by default. Note: do not export
# names by default without a very good reason. Use EXPORT_OK instead.
# Do not simply export all your public functions/methods/constants.
@EXPORT = qw
  (
   PVM_BYTE PVM_CPLX PVM_DCPLX PVM_DOUBLE PVM_FLOAT PVM_INT
   PVM_LONG PVM_SHORT PVM_STR PVM_UINT PVM_ULONG PVM_USHORT
   PvmAllowDirect PvmAlready PvmAutoErr PvmBadMsg PvmBadParam
   PvmBadVersion PvmCantStart PvmDSysErr PvmDataDefault
   PvmDataFoo PvmDataInPlace PvmDataRaw PvmDebugMask PvmDontRoute
   PvmDupEntry PvmDupGroup PvmDupHost PvmFragSize PvmHostAdd
   PvmHostCompl PvmHostDelete PvmHostFail PvmMismatch PvmMppFront
   PvmNoBuf PvmNoData PvmNoEntry PvmNoFile PvmNoGroup PvmNoHost
   PvmNoInst PvmNoMem PvmNoParent PvmNoSuchBuf PvmNoTask
   PvmNotImpl PvmNotInGroup PvmNullGroup PvmOk PvmOutOfRes
   PvmOutputCode PvmOutputTid PvmOverflow PvmPollConstant
   PvmPollSleep PvmPollTime PvmPollType PvmResvTids PvmRoute
   PvmRouteDirect PvmSelfOutputCode PvmSelfOutputTid
   PvmSelfTraceCode PvmSelfTraceTid PvmShowTids PvmSysErr
   PvmTaskArch PvmTaskChild PvmTaskDebug PvmTaskDefault
   PvmTaskExit PvmTaskHost PvmTaskSelf PvmTaskTrace PvmTraceCode
   PvmTraceTid PvmMboxDefault PvmMboxPersistent PvmMboxMultiInstance 
   PvmMboxOverWritable PvmMboxFirstAvail PvmMboxReadAndDelete
);

# Theese are the badd ones:
#     send pack unpack exit recv kill 
@EXPORT_OK = qw
  (

   spawn initsend psend mcast sendsig probe nrecv trecv precv parent
   mytid halt catchout tasks config addhosts delhosts bufinfo freebuf
   getrbuf getsbuf mkbuf setrbuf setsbuf mstat pstat tidtohost getopt
   setopt reg_hoster reg_tasker reg_rm perror notify recv_notify
   hostsync recvf recvf_old

   joingroup lvgroup bcast freezegroup barrier getinst gettid gsize

   siblings

   getcontext newcontext setcontext freecontext

   putinfo recvinfo delinfo getmboxinfo

   code2symbol code2text
  );

$VERSION = '1.4.0-pre1';

sub AUTOLOAD 
{
    # This AUTOLOAD is used to 'autoload' constants from the constant()
    # XS function.  If a constant is not found then control is passed
    # to the AUTOLOAD in AutoLoader.

    my $constname;
    ($constname = $AUTOLOAD) =~ s/.*:://;
    croak "& not defined" if $constname eq 'constant';
    my $val = constant($constname, @_ ? $_[0] : 0);
    if ($! != 0) 
    {
	if ($! =~ /Invalid/) 
        {
	    $AutoLoader::AUTOLOAD = $AUTOLOAD;
	    goto &AutoLoader::AUTOLOAD;
	}
	else 
        {
		croak "Your vendor has not defined Parallel::Pvm macro $constname";
	}
    }
    no strict 'refs';
    *$AUTOLOAD = sub { $val };
    goto &$AUTOLOAD;
}

bootstrap Parallel::Pvm $VERSION;

# Preloaded methods go here.


# Autoload methods go after =cut, and are processed by the autosplit program.

1;
__END__
# Below is the stub of documentation for your module. You better edit it!

=head1 NAME

Parallel::Pvm - Perl extension for the Parallel Virtual Machine (PVM) Message Passing System

Pvm.pm  view on Meta::CPAN


	# Parallel::Pvm::recv($tid,-1);
	$bufid = Parallel::Pvm::recv($tid) ;

	$bufid = Parallel::Pvm::recv($tid,$tag);

=item B<Parallel::Pvm::recvf>

Redefines the comparison function used to accept messages.  Eg.

	Parallel::Pvm::recvf(\&new_foo);

=item B<Parallel::Pvm::recv_notify>

Receives the notification message initiated by B<Parallel::Pvm::notify>.  This 
should be preceded by a B<Parallel::Pvm::probe>.  Eg.

	# for PvmTaskExit and PvmHostDelete notification
	if ( Parallel::Pvm::probe(-1,$notify_tag) ){
		$message = Parallel::Pvm::recv_notify(PvmTaskExit) ;
	}

	# for PvmHostAdd notification
	@htid_list = Parallel::Pvm::recv_notify(PvmHostAdd);

=item B<Parallel::Pvm::recvf_old>

Resets the comparison function for accepting messages to the 
previous method before a call to B<Parallel::Pvm::recf>.  

=item B<Parallel::Pvm::reg_hoster>

Registers this task as responsible for adding new PVM hosts.  Eg.

	$info = Parallel::Pvm::reg_hoster ;

=item B<Parallel::Pvm::reg_rm>

Registers this task as a PVM resource manager.  Eg.

	$info = Parallel::Pvm::reg_rm ;

=item B<Parallel::Pvm::reg_tasker>

Registers this task as responsible for starting new PVM tasks.  Eg.

	$info = Parallel::Pvm::reg_tasker ;

=item B<Parallel::Pvm::send>

Send the data in the active message buffer.  Eg.  

	# Parallel::Pvm::send(-1,-1);
	$info = Parallel::Pvm::send ;

	# Parallel::Pvm::send($tid,-1);
	$info = Parallel::Pvm::send($tid);

	$info = Parallel::Pvm::send($tid,$tag);

=item B<Parallel::Pvm::sendsig>

Sends a signal to another PVM process.  Eg.

	use POSIX qw(:signal_h);
	...

	$info = Parallel::Pvm::sendsig($tid,SIGKILL);

=item B<Parallel::Pvm::setopt>

Sets various libpvm options.  Eg.

	$oldval=Parallel::Pvm::setopt(PvmOutputTid,$val);

	$oldval=Parallel::Pvm::setopt(PvmRoute,PvmRouteDirect);

=item B<Parallel::Pvm::setrbuf> 

Switches the active receive buffer and saves the previous buffer.  Eg.

	$oldbuf = Parallel::Pvm::setrbuf($bufid);

=item B<Parallel::Pvm::setsbuf>

Switches the active send buffer.  Eg.

	$oldbuf = Parallel::Pvm::setsbuf($bufid);

=item B<Parallel::Pvm::spawn>

Starts new PVM processes.  Eg.

	# Parallel::Pvm::spawn("compute.pl",4,PvmTaskDefault,"");
	($ntask,@tid_list) = Parallel::Pvm::spawn("compute.pl",4);

	($ntask,@tid_list) = Parallel::Pvm::spawn("compute.pl",4,PvmTaskHost,"onyx");

	($ntask,@tid_list) = Parallel::Pvm::spawn("compute.pl",4,PvmTaskHost,"onyx",argv);

=item B<Parallel::Pvm::tasks>

Returns information about the tasks running on the virtual machine. Eg.

	# Parallel::Pvm::tasks(0); Returns all tasks
	($info,@task_list) = Parallel::Pvm::tasks ;

	# Returns only for task $tid 
	($info,@task_list) = Parallel::Pvm::tasks($tid) ;
	

=item B<Parallel::Pvm::tidtohost>

Returns the host ID on which the specified task is running.  Eg.

	$dtid = Parallel::Pvm::tidtohost($tid);

=item B<Parallel::Pvm::trecv>

Receive with timeout.  Eg.

	# Parallel::Pvm::trecv(-1,-1,1,0); time out after 1 sec
	$bufid = Parallel::Pvm::trecv ;

	# time out after 2*1000000 + 5000 usec 	
	$bufid = Parallel::Pvm::trecv($tid,$tag,2,5000);




( run in 0.793 second using v1.01-cache-2.11-cpan-71847e10f99 )