Pvm

 view release on metacpan or  search on metacpan

Pvm.xs  view on Meta::CPAN

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)

Pvm.xs  view on Meta::CPAN

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)));

Pvm.xs  view on Meta::CPAN

        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))));

Pvm.xs  view on Meta::CPAN

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 */

Pvm.xs  view on Meta::CPAN

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); */

Pvm.xs  view on Meta::CPAN


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);

Pvm.xs  view on Meta::CPAN

	*/

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);

Pvm.xs  view on Meta::CPAN

	    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

Pvm.xs  view on Meta::CPAN

	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)));



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