Pvm
view release on metacpan or search on metacpan
return PvmTraceCode;
#else
goto not_there;
#endif
if (strEQ(name, "PvmTraceTid"))
#ifdef PvmTraceTid
return PvmTraceTid;
#else
goto not_there;
#endif
break;
case 'Q':
break;
case 'R':
break;
case 'S':
break;
case 'T':
break;
case 'U':
break;
case 'V':
break;
case 'W':
break;
case 'X':
break;
case 'Y':
break;
case 'Z':
break;
}
errno = EINVAL;
return 0;
not_there:
errno = ENOENT;
return 0;
}
MODULE = Pvm PACKAGE = Pvm
double
constant(name,arg)
char * name
int arg
void
spawn(task,ntask,flag=PvmTaskDefault,where="")
char * task
int ntask
int flag
char * where
PROTOTYPE: $$;$$
PREINIT:
int tids[MAXPROCS];
int info;
int i;
PPCODE:
info = pvm_spawn(task,0,flag,where,ntask,tids);
XPUSHs(sv_2mortal(newSViv(info)));
if ( i > 0 ){
for (i=0;i<info;i++){
XPUSHs(sv_2mortal(newSViv(tids[i])));
}
} /* else empty list is returned */
int
initsend(flag=PvmDataDefault)
int flag;
PROTOTYPE: ;$
CODE:
RETVAL = pvm_initsend(flag);
OUTPUT:
RETVAL
int
send(tid,tag)
int tid
int tag
PROTOTYPE: $$
CODE:
RETVAL = pvm_send(tid,tag);
OUTPUT:
RETVAL
int
psend(tid,tag,...)
int tid
int tag
PROTOTYPE: $$;@
PREINIT:
int i;
char *str, *po;
CODE:
for(i=2;i<items;i++){
po = (char *)SvPV(ST(i),na);
if ( i == 2 ) {
str = buffer_string(po,1);
} else{
str = buffer_string(po,0);
}
}
if ( items == 2 ){
str = (char *)calloc(1,sizeof(char));
str[0] = '\0';
}
RETVAL = pvm_psend(tid,tag,str,string_byte_cnt(str),PVM_BYTE);
OUTPUT:
RETVAL
int
mcast(...)
PROTOTYPE: @
PREINIT:
int i;
int tag_num;
int proc_num;
int tids[MAXPROCS];
RETVAL = pvm_sendsig(tid,sig);
OUTPUT:
RETVAL
int
probe(tid=-1,tag=-1)
int tid
int tag
PROTOTYPE: ;$$
CODE:
RETVAL = pvm_probe(tid,tag);
OUTPUT:
RETVAL
int
recv(tid=-1,tag=-1)
int tid
int tag
PROTOTYPE: ;$$
CODE:
RETVAL = pvm_recv(tid,tag);
OUTPUT:
RETVAL
int
nrecv(tid=-1,tag=-1)
int tid
int tag
PROTOTYPE: ;$$
CODE:
RETVAL = pvm_nrecv(tid,tag);
OUTPUT:
RETVAL
int
trecv(tid=-1,tag=-1,sec=1,usec=0)
int tid
int tag
int sec
int usec
PROTOTYPE: ;$$$$
PREINIT:
struct timeval tmout;
CODE:
tmout.tv_sec = sec;
tmout.tv_usec = usec;
RETVAL = pvm_trecv(tid,tag,&tmout);
OUTPUT:
RETVAL
void
precv(tid=-1,tag=-1)
int tid
int tag
PROTOTYPE: ;$$
PREINIT:
int info, src, stag, scnt;
char str[MAXSTR];
char *po;
int type;
PPCODE:
info = pvm_precv(tid,tag,str,MAXSTR,PVM_BYTE,&src,&stag,&scnt);
XPUSHs(sv_2mortal(newSViv(info)));
XPUSHs(sv_2mortal(newSViv(src)));
XPUSHs(sv_2mortal(newSViv(stag)));
po = strtok(str,"\v");
while ( po != NULL ){
type = string_type(po);
switch(type){
case STRING:
XPUSHs(sv_2mortal(newSVpv(po,0)));
break;
case INTEGER:
XPUSHs(sv_2mortal(newSViv(atoi(po))));
break;
case DOUBLE:
XPUSHs(sv_2mortal(newSVnv(atof(po))));
break;
}
po = strtok(NULL,"\v");
}
int
parent()
PROTOTYPE:
CODE:
RETVAL = pvm_parent();
OUTPUT:
RETVAL
int
mytid()
PROTOTYPE:
CODE:
RETVAL = pvm_mytid();
OUTPUT:
RETVAL
int
pack(...)
PROTOTYPE: @
PREINIT:
int i;
char *str, *po;
CODE:
for (i=0;i<items;i++){
po = (char *)SvPV(ST(i),na);
if ( i == 0 ) {
str = buffer_string(po,1);
} else{
str = buffer_string(po,0);
}
}
if ( items <= 0 ){
str = (char *)calloc(1,sizeof(char));
str[0] ='\0';
}
RETVAL = pvm_pkstr(str);
OUTPUT:
RETVAL
void
unpack()
PROTOTYPE:
PREINIT:
char str[MAXSTR], *po;
int type;
PPCODE:
pvm_upkstr(str);
po = strtok(str,"\v");
while ( po != NULL ){
type = string_type(po);
switch(type){
case STRING:
XPUSHs(sv_2mortal(newSVpv(po,0)));
break;
case INTEGER:
XPUSHs(sv_2mortal(newSViv(atoi(po))));
break;
case DOUBLE:
XPUSHs(sv_2mortal(newSVnv(atof(po))));
break;
}
po = strtok(NULL,"\v");
}
int
exit()
PROTOTYPE:
CODE:
RETVAL = pvm_exit();
OUTPUT:
RETVAL
int
halt()
PROTOTYPE:
CODE:
RETVAL = pvm_halt();
OUTPUT:
RETVAL
int
catchout(io=stdout)
FILE * io
PROTOTYPE: ;$
CODE:
RETVAL = pvm_catchout(io);
OUTPUT:
RETVAL
void
tasks(where=0)
int where
PROTOTYPE: ;$
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)));
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;
ti_flag = taskp[i].ti_flag;
/* set up hash entry */
hv_tmp = newHV();
/* sv_2mortal((SV *)hv_tmp); */
hv_store(hv_tmp,"ti_a_out",8,newSVpv(ti_a_out,0),0);
hv_store(hv_tmp,"ti_tid",6,newSViv(ti_tid),0);
hv_store(hv_tmp,"ti_ptid",7,newSViv(ti_ptid),0);
hv_store(hv_tmp,"ti_pid",6,newSViv(ti_pid),0);
hv_store(hv_tmp,"ti_host",7,newSViv(ti_host),0);
hv_store(hv_tmp,"ti_flag",7,newSViv(ti_flag),0);
/* create reference and stick in on the stack */
XPUSHs(sv_2mortal(newRV((SV *)hv_tmp)));
}
void
config()
PROTOTYPE:
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);
XPUSHs(sv_2mortal(newSViv(info)));
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);
hi_speed = hostp[i].hi_speed;
/* set up hash entry */
hv_tmp = newHV();
/* sv_2mortal((SV *)hv_tmp); */
hv_store(hv_tmp,"hi_tid",6,newSViv(hi_tid),0);
hv_store(hv_tmp,"hi_name",7,newSVpv(hi_name,0),0);
hv_store(hv_tmp,"hi_arch",7,newSVpv(hi_arch,0),0);
hv_store(hv_tmp,"hi_speed",8,newSViv(hi_speed),0);
/* create reference and stick in on the stack */
XPUSHs(sv_2mortal(newRV((SV *)hv_tmp)));
}
void
addhosts(...)
PROTOTYPE: @
PREINIT:
int i;
int info;
char *po;
char *hosts[MAXHOSTS];
int infos[MAXHOSTS];
PPCODE:
if ( items < 1 )
croak("Usage: Pvm::pvm_addhosts(host_list)");
for (i=0;i<items;i++){
hosts[i] = (char *)SvPV(ST(i),na);
/*
hosts[i] = (char *)calloc(strlen(po)+1,sizeof(char));
strcpy(hosts[i],po);
*/
}
info = pvm_addhosts(hosts,items,infos);
XPUSHs(sv_2mortal(newSViv(info)));
for (i=0;i<items;i++){
XPUSHs(sv_2mortal(newSViv(infos[i])));
}
/*
for (i=0;i<items;i++){
free(hosts[i]);
}
*/
void
delhosts(...)
PROTOTYPE: @
PREINIT:
char *po;
char *hosts[MAXHOSTS];
int infos[MAXHOSTS];
int info, i, nhost;
PPCODE:
if ( items < 1 )
croak("Usage: Pvm::pvm_delhosts(host_list)");
for (i=0;i<items;i++){
hosts[i] = (char *)SvPV(ST(i),na);
/*
hosts[i] = (char *)calloc(strlen(po)+1,sizeof(char));
strcpy(hosts[i],po);
*/
}
info = pvm_delhosts(hosts,items,infos);
XPUSHs(sv_2mortal(newSViv(info)));
for (i=0;i<items;i++){
XPUSHs(sv_2mortal(newSViv(infos[i])));
}
/*
for (i=0;i<items;i++){
free(hosts[i]);
}
*/
void
bufinfo(bufid)
int bufid
PROTOTYPE: $
PREINIT:
int bytes, tag, tid, info;
PPCODE:
info = pvm_bufinfo(bufid,&bytes,&tag,&tid);
XPUSHs(sv_2mortal(newSViv(info)));
XPUSHs(sv_2mortal(newSViv(bytes)));
XPUSHs(sv_2mortal(newSViv(tag)));
XPUSHs(sv_2mortal(newSViv(tid)));
int
freebuf(bufid)
int bufid
PROTOTYPE: $
CODE:
RETVAL = pvm_freebuf(bufid);
OUTPUT:
RETVAL
int
getrbuf()
PROTOTYPE:
CODE:
RETVAL = pvm_getrbuf();
OUTPUT:
RETVAL
int
getsbuf()
PROTOTYPE:
CODE:
RETVAL = pvm_getsbuf();
OUTPUT:
RETVAL
int
mkbuf(encode=PvmDataDefault)
int encode
PROTOTYPE: $
CODE:
RETVAL = pvm_mkbuf(encode);
OUTPUT:
RETVAL
int
setrbuf(bufid)
int bufid
PROTOTYPE: $
CODE:
RETVAL = pvm_setrbuf(bufid);
OUTPUT:
RETVAL
int
setsbuf(bufid)
int bufid
PROTOTYPE: $
CODE:
RETVAL = pvm_setsbuf(bufid);
OUTPUT:
RETVAL
int
struct pvmhostinfo *hip;
CODE:
RETVAL = pvm_reg_rm(&hip);
OUTPUT:
RETVAL
int
perror(msg)
char * msg
PROTOTYPE: $
CODE:
RETVAL = pvm_perror(msg);
OUTPUT:
RETVAL
int
notify(what,tag,...)
int what
int tag
PROTOTYPE: $$;@
PREINIT:
int i, tids[MAXPROCS];
CODE:
switch(what){
case PvmTaskExit:
case PvmHostDelete:
if ( items < 3 )
croak("Usage: Pvm::pvm_notify(what,tag,tid_list");
for (i=2;i<items;i++){
tids[i-2] = SvIV(ST(i));
}
RETVAL = pvm_notify(what,tag,items-2,tids);
break;
case PvmHostAdd:
RETVAL = pvm_notify(what,tag,0,tids);
break;
}
OUTPUT:
RETVAL
int
recv_notify()
PROTOTYPE:
PREINIT:
int id;
CODE:
pvm_recv(-1,-1);
pvm_upkint(&id,1,1);
RETVAL = id;
OUTPUT:
RETVAL
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((SV *)hv_tmp)));
sec = delta.tv_sec;
usec = delta.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((SV *)hv_tmp)));
void
recvf(fn)
SV * fn
PROTOTYPE: $
CODE:
if ( recvf_callback == (SV *)NULL ){
recvf_callback = newSVsv(fn);
}else{
sv_setsv(recvf_callback,fn);
}
olmatch = pvm_recvf(recvf_foo);
void
recvf_old()
PROTOTYPE:
CODE:
if ( olmatch != NULL ){
pvm_recvf(olmatch);
}
( run in 0.575 second using v1.01-cache-2.11-cpan-5511b514fd6 )