version 1.1, 2003/12/12 07:57:20 |
version 1.3, 2005/02/09 07:56:52 |
|
|
/* $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 MAX(a,b) ((a)>(b)?(a):(b)) |
#define MIN(a,b) ((a)>(b)?(b):(a)) |
#define MIN(a,b) ((a)>(b)?(b):(a)) |
|
|
|
|
]$ |
]$ |
|
|
def spawn102(Hosts,N) |
def spawn102(Hosts,N) |
"spawn102(hostlist,nserver|debug=1) |
"spawn102(hostlist,nserver|debug=1)\n\ |
hostlist : [\"iyokan-0\",\"iyokan-1\",...] |
hostlist : [\"iyokan-0\",\"iyokan-1\",...]\n\ |
nserver : number of servers to be used in hostlist |
nserver : number of servers to be used in hostlist\n\ |
If debug is specified, the debug windows will appear." |
If debug is specified, the debug windows will appear." |
{ |
{ |
Debug = getopt(debug); |
Debug = getopt(debug); |
Line 40 If debug is specified, the debug windows will appear." |
|
Line 40 If debug is specified, the debug windows will appear." |
|
return Procs; |
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) |
def urandompoly(N,D) |
"urandompoly(N,D) |
"urandompoly(N,D)\n\ |
generate a univariate random polynomial of degree N, |
generate a univariate random polynomial of degree N,\n\ |
with D bit random coefficients." |
with D bit random coefficients." |
{ |
{ |
for(I=0,R=0;I<=N;I++)R+= lrandom(D)*x^I; return R; |
for(I=0,R=0;I<=N;I++)R+= lrandom(D)*x^I; return R; |
Line 55 def urandompoly(N,D) |
|
Line 83 def urandompoly(N,D) |
|
*/ |
*/ |
|
|
def d_mul(F1,F2) |
def d_mul(F1,F2) |
"d_mul(F1,F2|proc=ProcList) |
"d_mul(F1,F2|proc=ProcList)\n\ |
computes the product of F1 and F2. |
computes the product of F1 and F2.\n\ |
If ProcList is specified, the product is computed in parallel." |
If ProcList is specified, the product is computed in parallel." |
{ |
{ |
Procs = getopt(proc); |
Procs = getopt(proc); |