Parallel-Pvm

 view release on metacpan or  search on metacpan

Pvm.xs  view on Meta::CPAN

  char *  task
  int     ntask
  int     flag
  char *  where
  SV *    argvRef
  PREINIT:
  int tids[MAXPROCS];
  int info;
  int i;
  char ** argv = (char **)0;
  PPCODE:
 
  if (argvRef)
  {
    int   argc;
    AV *  av;
    SV ** a;
 
    if (!SvROK(argvRef))
      croak("Parallel::Pvm::spawn - non-reference passed for argv");
 

Pvm.xs  view on Meta::CPAN

void
precv(tid=-1,tag=-1,buflen=MAXSTR)
  int   tid
  int   tag
  int   buflen
  PREINIT:
  int info, src, stag, scnt;
  char *buf;
  char *po;
  int type;
  PPCODE:
  New(2401, buf, buflen, char);

  info = pvm_precv(tid,tag,buf,buflen,PVM_BYTE,&src,&stag,&scnt);
  XPUSHs(sv_2mortal(newSViv(info)));
  XPUSHs(sv_2mortal(newSViv(src)));
  XPUSHs(sv_2mortal(newSViv(stag)));
  po = strtok(buf,"\v");
  while ( po != NULL )
  {
	/* Change: Everything is a string 

Pvm.xs  view on Meta::CPAN

  OUTPUT:
  RETVAL


void
unpack(buflen=MAXSTR)
  int   buflen
  PREINIT:
  char *buf, *po;
  int type;
  PPCODE:
  New(2401, buf, buflen, char);
  if (pvm_upkstr(buf) != 0) {
    if (PL_dowarn) {
      warn("pvm_upkstr failed");
      Safefree(buf);
      XSRETURN_UNDEF;
    }
  }
  po = strtok(buf,"\v");
  while ( po != NULL )

Pvm.xs  view on Meta::CPAN


void
tasks(where=0)
  int  where
  PREINIT:
  int ntask,i,info;
  struct pvmtaskinfo *taskp;
  int ti_tid,ti_ptid,ti_host,ti_flag,ti_pid;
  char ti_a_out[256];
  HV *hv_tmp;
  PPCODE:
  info = pvm_tasks(where,&ntask,&taskp);
  XPUSHs(sv_2mortal(newSViv(info)));
  if (info >= 0) /* ntask may be undefined if there was an error */
    for(i=0;i<ntask;i++)
    {
      strcpy(ti_a_out,taskp[i].ti_a_out);
      ti_tid = taskp[i].ti_tid;
      ti_ptid = taskp[i].ti_ptid;
      ti_pid = taskp[i].ti_pid;
      ti_host = taskp[i].ti_host;

Pvm.xs  view on Meta::CPAN


void
config()
  PREINIT:
  int nhosts, narch, info;
  struct pvmhostinfo *hostp;
  char hi_name[256], hi_arch[256];
  int hi_tid, hi_speed;
  int i;
  HV *hv_tmp;
  PPCODE:
  info = pvm_config(&nhosts,&narch,&hostp);
  if (info == PvmOk)
    XPUSHs(sv_2mortal(newSViv(info)));
  else
    XPUSHs(sv_2mortal(newSViv(nhosts)));
  for (i=0;i<nhosts;i++)
  {
    hi_tid = hostp[i].hi_tid;
    strcpy(hi_name,hostp[i].hi_name);
    strcpy(hi_arch,hostp[i].hi_arch);

Pvm.xs  view on Meta::CPAN



void
addhosts(...)
  PREINIT:
  int i;
  int info;
  char *po;
  char *hosts[MAXHOSTS]; 
  int infos[MAXHOSTS];
  PPCODE:
  if ( items < 1 )
    croak("Usage: Parallel::Pvm::pvm_addhosts(host_list)");
  for (i=0;i<items;i++)
  {
    hosts[i] = (char *)SvPV(ST(i), PL_na);
  }
  info = pvm_addhosts(hosts,items,infos);
  XPUSHs(sv_2mortal(newSViv(info)));  
  for (i=0;i<items;i++)
  {

Pvm.xs  view on Meta::CPAN

  }


void
delhosts(...)
  PREINIT:
  char *po;
  char *hosts[MAXHOSTS]; 
  int infos[MAXHOSTS];
  int info, i, nhost;
  PPCODE:
  if ( items < 1 )
    croak("Usage: Parallel::Pvm::pvm_delhosts(host_list)");
  for (i=0;i<items;i++)
  {
    hosts[i] = (char *)SvPV(ST(i), PL_na);
  }
  info = pvm_delhosts(hosts,items,infos);
  XPUSHs(sv_2mortal(newSViv(info)));  
  for (i=0;i<items;i++)
  {
    XPUSHs(sv_2mortal(newSViv(infos[i])));
  }

void
bufinfo(bufid)
  int  bufid
  PREINIT:
  int bytes, tag, tid, info;
  PPCODE:
  if (info = pvm_bufinfo(bufid,&bytes,&tag,&tid)) {
    if (PL_dowarn) {
      warn("pvm_bufinfo failed");
      XSRETURN_EMPTY;
    }
  }
  XPUSHs(sv_2mortal(newSViv(info)));
  XPUSHs(sv_2mortal(newSViv(bytes)));
  XPUSHs(sv_2mortal(newSViv(tag)));
  XPUSHs(sv_2mortal(newSViv(tid)));

Pvm.xs  view on Meta::CPAN

  OUTPUT:
  RETVAL


int
recv_notify(what)
  int what
  PREINIT:
  int id,i,cnt;
  int tids[MAXPROCS];
  PPCODE:
  pvm_recv(-1,-1);
  switch (what )
  {
    case PvmTaskExit:
    case PvmHostDelete:
      pvm_upkint(&id,1,1);
      XPUSHs( sv_2mortal(newSViv(id)) );
      break;
    case PvmHostAdd:
      pvm_upkint( &cnt, 1, 1 );

Pvm.xs  view on Meta::CPAN



void
hostsync(hst)
  int	hst
  PREINIT:
  struct timeval rclk, delta;
  int info;
  int sec, usec;
  HV *hv_tmp;
  PPCODE:
  info = pvm_hostsync(hst,&rclk,&delta);
  XPUSHs(sv_2mortal(newSViv(info)));
  sec = rclk.tv_sec;
  usec = rclk.tv_usec;
  /* set up hash entry */
  hv_tmp = newHV();
  hv_store(hv_tmp,"tv_sec",6,newSViv(sec),0);
  hv_store(hv_tmp,"hi_usec",7,newSViv(usec),0);
  /* create reference and stick in on the stack */
  XPUSHs(sv_2mortal(newRV_noinc((SV *)hv_tmp)));

Pvm.xs  view on Meta::CPAN

     PROTOTYPE:
     CODE:
     pvmendtask();

void
siblings()
	PREINIT:
	int *tids;
	int ntids;
	int n;
	PPCODE:
	ntids = pvm_siblings(&tids);
	XPUSHs(sv_2mortal(newSViv(ntids)));
	for (n = 0; n < ntids; n++)
		{
		XPUSHs(sv_2mortal(newSViv(tids[n])));
		}

int
getcontext()
	CODE:

Pvm.xs  view on Meta::CPAN

	PREINIT:
	int n,m;
	
	int info;
	struct pvmmboxinfo *classes;
	
	char mi_name[256];

	HV * hv_tmp;
	AV * arr_tmp;
	PPCODE:
	info = pvm_getmboxinfo(pattern,&nclasses,&classes);
	if (info == PvmOk)
		XPUSHs(newSViv(nclasses));
	else
		XPUSHs(newSViv(info));
	for (n=0;n<nclasses;n++)
		{
		strcpy(mi_name,classes[n].mi_name);
		hv_tmp = (HV *)sv_2mortal((SV *)newHV());
		



( run in 0.626 second using v1.01-cache-2.11-cpan-5511b514fd6 )