=================================================================== RCS file: /home/cvs/OpenXM_contrib2/asir2000/lib/dmul102,v retrieving revision 1.1 retrieving revision 1.3 diff -u -p -r1.1 -r1.3 --- OpenXM_contrib2/asir2000/lib/dmul102 2003/12/12 07:57:20 1.1 +++ OpenXM_contrib2/asir2000/lib/dmul102 2005/02/09 07:56:52 1.3 @@ -1,4 +1,4 @@ -/* $OpenXM$ */ +/* $OpenXM: OpenXM_contrib2/asir2000/lib/dmul102,v 1.2 2003/12/12 09:17:31 noro Exp $ */ #define MAX(a,b) ((a)>(b)?(a):(b)) #define MIN(a,b) ((a)>(b)?(b):(a)) @@ -12,9 +12,9 @@ Hosts = [ ]$ def spawn102(Hosts,N) -"spawn102(hostlist,nserver|debug=1) -hostlist : [\"iyokan-0\",\"iyokan-1\",...] -nserver : number of servers to be used in hostlist +"spawn102(hostlist,nserver|debug=1)\n\ +hostlist : [\"iyokan-0\",\"iyokan-1\",...]\n\ +nserver : number of servers to be used in hostlist\n\ If debug is specified, the debug windows will appear." { Debug = getopt(debug); @@ -40,9 +40,37 @@ If debug is specified, the debug windows will appear." return Procs; } +def spawn102_local(N) +"spawn102_local(nserver|debug=1)\n\ +nserver : number of servers to be used in hostlist\n\ +If debug is specified, the debug windows will appear." +{ + Debug = getopt(debug); + if ( type(Debug) == -1 ) + Debug = 0; + else if ( Debug ) + Debug = 1; + Procs = newvect(N); + for ( I = 0; I < N; I++ ) { + if ( Debug ) + Procs[I] = ox_launch(); + else + Procs[I] = ox_launch_nox(); + ox_set_rank_102(Procs[I],N,I); + sleep(1000); + } + for ( I = 0; I < N; I++ ) + for ( J = I+1; J < N; J++ ) { + P = generate_port(1); + ox_tcp_accept_102(Procs[I],P,J); + ox_tcp_connect_102(Procs[J],0,P,I); + } + return Procs; +} + def urandompoly(N,D) -"urandompoly(N,D) - generate a univariate random polynomial of degree N, +"urandompoly(N,D)\n\ + generate a univariate random polynomial of degree N,\n\ with D bit random coefficients." { for(I=0,R=0;I<=N;I++)R+= lrandom(D)*x^I; return R; @@ -55,8 +83,8 @@ def urandompoly(N,D) */ def d_mul(F1,F2) -"d_mul(F1,F2|proc=ProcList) - computes the product of F1 and F2. +"d_mul(F1,F2|proc=ProcList)\n\ + computes the product of F1 and F2.\n\ If ProcList is specified, the product is computed in parallel." { Procs = getopt(proc);