[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.5 Functions for distributed computation


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.5.1 ox_launch, ox_launch_nox, ox_shutdown

ox_launch([host[,dir],command])
ox_launch_nox([host[,dir],command])

:: Initialize OpenXM servers.

ox_shutdown(id)

:: Terminates OpenXM servers.

return

integer

host

string or 0

dir command

string

id

integer

[219] ox_launch();
0
[220] ox_rpc(0,"fctr",x^10-y^10);      
0
[221] ox_pop_local(0);
[[1,1],[x^4+y*x^3+y^2*x^2+y^3*x+y^4,1],
[x^4-y*x^3+y^2*x^2-y^3*x+y^4,1],[x-y,1],[x+y,1]]
[222] ox_shutdown(0);    
0
References

ox_rpc, ox_cmo_rpc, ox_execute_string, ox_pop_cmo, ox_pop_local, ifplot, conplot, plot, polarplot, plotover


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.5.2 ox_launch_generic

ox_launch_generic(host,launch,server,use_unix,use_ssh,use_x,conn_to_serv)

:: Initialize OpenXM servers.

return

integer

host

string or 0

launcher server

string

use_unix use_ssh use_x conn_to_serv

integer

[342] LIB=get_rootdir();
/export/home/noro/ca/Kobe/build/OpenXM/lib/asir
[343] ox_launch_generic(0,LIB+"/ox_launch",LIB+"/ox_asir",0,0,0,0);
1
[344] ox_launch_generic(0,LIB+"/ox_launch",LIB+"/ox_asir",1,0,0,0);
2
[345] ox_launch_generic(0,LIB+"/ox_launch",LIB+"/ox_asir",1,1,0,0);
3
[346] ox_launch_generic(0,LIB+"/ox_launch",LIB+"/ox_asir",1,1,1,0);
4
[347] ox_launch_generic(0,LIB+"/ox_launch",LIB+"/ox_asir",1,1,1,1);
5
[348] ox_launch_generic(0,LIB+"/ox_launch",LIB+"/ox_asir",1,1,0,1);
6
References

ox_launch, ox_launch_nox, ox_shutdown, ox_launch_generic


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.5.3 generate_port, try_bind_listen, try_connect, try_accept, register_server

generate_port([use_unix])

:: Generates a port number.

try_bind_listen(port)

:: Binds and listens on a port.

try_connect(host,port)

:: Connects to a port.

try_accept(socket,port)

:: Accepts a connection request.

register_server(control_socket,control_port,server_socket,server_port)

:: Registers the sockets for which connections are established.

return

integer or string for generate_port(), integer for the others

use_unix

0 or 1

host

string

port control_port server_port

integer or string

socket control_socket server_socket

integer

[340] CPort=generate_port();
39896
[341] SPort=generate_port();
37222
[342] CSocket=try_bind_listen(CPort);
3
[343] SSocket=try_bind_listen(SPort);
5

/*
ox_launch is invoked here :
%  ox_launch "127.1" 0 39716 37043 ox_asir "shio:0"
*/

[344] CSocket=try_accept(CSocket,CPort);
6
[345] SSocket=try_accept(SSocket,SPort);  
3
[346] register_server(CSocket,CPort,SSocket,SPort);
0
References

ox_launch, ox_launch_nox, ox_shutdown, ox_launch_generic, shell, ox_push_cmo, ox_push_local


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.5.4 ‘ox_asir

ox_asir’ provides almost all the functionalities of Asir as an OpenXM server. ‘ox_asir’ is invoked by ox_launch or ox_launch_nox. If X environment is not available or is not necessary, one can use ox_launch_nox.

[5] ox_launch();
0
[5] ox_launch_nox("127.0.0.1","/usr/local/lib/asir",
"/usr/local/lib/asir/ox_asir");
0
[7] RemoteLibDir = "/usr/local/lib/asir/"$
[8] Machines = ["sumire","rokkaku","genkotsu","shinpuku"];
[sumire,rokkaku,genkotsu,shinpuku]
[9] Servers = map(ox_launch,Machines,RemoteLibDir,
RemoteLibDir+"ox_asir");
[0,1,2,3]
References

ox_launch, ox_launch_nox, ox_shutdown


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.5.5 ox_rpc, ox_cmo_rpc, ox_execute_string

ox_rpc(number,"func",arg0,...)
ox_cmo_rpc(number,"func",arg0,...)
ox_execute_string(number,"command",...)

:: Calls a function on an OpenXM server

return

0

number

integer (process identifier)

func

function name

command

string

arg0 ...

arbitrary (arguments)

[234] ox_cmo_rpc(0,"dp_ht",dp_ptod((x+y)^10,[x,y]));
0
[235] ox_pop_cmo(0);
(1)*<<10,0>>
[236] ox_execute_string(0,"12345 % 678;");
0
[237] ox_pop_cmo(0);
141
References

ox_pop_cmo, ox_pop_local


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.5.6 ox_reset,ox_intr,register_handler

ox_reset(number)

:: Resets an OpenXM server

ox_intr(number)

:: Sends SIGINT to an OpenXM server

register_handler(func)

:: Registers a function callable on a keyboard interrupt.

return

1

number

integer(process identifier)

func

functor or 0

[10] ox_launch();
0
[11] ox_rpc(0,"fctr",x^100-y^100);
0
[12] ox_reset(0); /* usr1 : return to toplevel by SIGUSR1 */
1                 /* is displayed on the xterm.           */
[340] Procs=[ox_launch(),ox_launch()];
[0,1]
[341] def reset() { extern Procs; map(ox_reset,Procs);}
[342] map(ox_rpc,Procs,"fctr",x^100-y^100);
[0,0]
[343] register_handler(reset);
1
[344] interrupt ?(q/t/c/d/u/w/?) u
Abort this computation? (y or n) y
Calling the registered exception handler...done.
return to toplevel
References

ox_rpc, ox_cmo_rpc, ox_execute_string


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.5.7 ox_push_cmo, ox_push_local

ox_push_cmo(number,obj)
ox_push_local(number,obj)

:: Sends obj to a process whose identifier is number.

return

0

number

integer(process identifier)

obj

object

References

ox_rpc, ox_cmo_rpc, ox_execute_string, ox_pop_cmo, ox_pop_local


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.5.8 ox_pop_cmo, ox_pop_local

ox_pop_local(number)

:: Receives data from a process whose identifier is number.

return

received data

number

integer(process identifier)

[341] ox_cmo_rpc(0,"fctr",x^2-1);
0
[342] ox_pop_cmo(0);
[[1,1],[x-1,1],[x+1,1]]
[343] ox_cmo_rpc(0,"newvect",3);
0
[344] ox_pop_cmo(0);
error([41,cannot convert to CMO object])
[345] ox_pop_local(0);
[ 0 0 0 ]
References

ox_rpc, ox_cmo_rpc, ox_execute_string, ox_push_cmd, ox_sync, ox_select, ox_get


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.5.9 ox_push_cmd, ox_sync

ox_push_cmd(number,command)

:: Sends a command command to a process whose identifier is number.

ox_sync(number)

:: Sends OX_SYNC_BALL to a process whose identifier is number.

return

0

number

integer(process identifier)

command

integer(command identifier)

[3] ox_rpc(0,"fctr",x^100-y^100);
0
[4] ox_push_cmd(0,258);
0
[5] ox_select([0]);
[0]
[6] ox_get(0);
[[1,1],[x^2+y^2,1],[x^4-y*x^3+y^2*x^2-y^3*x+y^4,1],...]
References

ox_rpc, ox_cmo_rpc, ox_execute_string, ox_reset,ox_intr,register_handler


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.5.10 ox_get

ox_get(number)

:: Receives data form a process whose identifier is number.

return
number

integer(process identifier)

[11] ox_push_cmo(0,123);
0
[12] ox_push_cmd(0,262); /* 262=OX_popCMO */
0
[13] ox_get(0);
123
References

ox_pop_cmo, ox_pop_local, ox_push_cmd, ox_sync


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.5.11 ox_pops

ox_pops(number[,nitem])

:: Removes data form the stack of a process whose identifier is number.

return

0

number

integer(process identifier)

nitem

non-negative integer

[69] for(I=1;I<=10;I++)ox_push_cmo(0,I);
[70] ox_pops(0,4);  
0
[71] ox_pop_cmo(0);
6
References

ox_pop_cmo, ox_pop_local


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.5.12 ox_select

ox_select(nlist[,timeout])

:: Returns the list of process identifiers on which data is available.

return

list

nlist

list of integers (process identifier)

timeout

number

ox_launch();
0
[220] ox_launch();
1
[221] ox_launch();
2
[222] ox_rpc(2,"fctr",x^500-y^500);
0
[223] ox_rpc(1,"fctr",x^100-y^100);
0
[224] ox_rpc(0,"fctr",x^10-y^10);  
0
[225] P=[0,1,2];
[0,1,2]
[226] map(ox_push_cmd,P,258);
[0,0,0]
[227] ox_select(P);
[0]
[228] ox_get(0);   
[[1,1],[x^4+y*x^3+y^2*x^2+y^3*x+y^4,1],
[x^4-y*x^3+y^2*x^2-y^3*x+y^4,1],[x-y,1],[x+y,1]]
References

ox_pop_cmo, ox_pop_local, ox_push_cmd, ox_sync, ox_get


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.5.13 ox_flush

ox_flush(id)

:: Flushes the sending buffer.

return

1

id

process identifier

[340] ox_launch_nox();
0
[341] cputime(1);
0
7e-05sec + gc : 4.8e-05sec(0.000119sec)
[342] for(I=0;I<10000;I++)ox_push_cmo(0,I);
0.232sec + gc : 0.006821sec(0.6878sec)
[343] ctrl("ox_batch",1);
1
4.5e-05sec(3.302e-05sec)
[344] for(I=0;I<10000;I++)ox_push_cmo(0,I); ox_flush(0);
0.08063sec + gc : 0.06388sec(0.4408sec)
[345] 1
9.6e-05sec(0.01317sec)
References

ox_pop_cmo, ox_pop_local, ctrl


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.5.14 ox_get_serverinfo

ox_get_serverinfo([id])

:: Gets server’s mathcap and proess id.

return

list

id

process identifier

[343] ox_get_serverinfo(0);
[[199909080,Ox_system=ox_sm1.plain,Version=2.991118,HOSTTYPE=FreeBSD],
[262,263,264,265,266,268,269,272,273,275,276],
[[514],[2130706434,1,2,4,5,17,19,20,22,23,24,25,26,30,31,60,61,27,
33,40,16,34]]]
[344] ox_get_serverinfo(); 
[[0,[[199909080,Ox_system=ox_sm1.plain,Version=2.991118,
HOSTTYPE=FreeBSD],
[262,263,264,265,266,268,269,272,273,275,276],
[[514],[2130706434,1,2,4,5,17,19,20,22,23,24,25,26,30,31,60,61,27,33,
40,16,34]]]],
[1,[[199901160,ox_asir],
[276,275,258,262,263,266,267,268,274,269,272,265,264,273,300,270,271],
[[514,2144202544],
[1,2,3,4,5,2130706433,2130706434,17,19,20,21,22,24,25,26,31,27,33,60],
[0,1]]]]]
References

Mathcap.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.5.15 ifplot, conplot, plot, polarplot, plotover

ifplot(func [,geometry] [,xrange] [,yrange] [,id] [,name])

:: Displays real zeros of a bi-variate function.

conplot(func [,geometry] [,xrange] [,yrange] [,zrange] [,id] [,name])

:: Displays real contour lines of a bi-variate function.

plot(func [,geometry] [,xrange] [,id] [,name])

:: Displays the graph of a univariate function.

polarplot(func [,geometry] [,thetarange] [,id] [,name])

:: Displays the graph of a curve given in polar form.

plotover(func,id,number)

Plots on the existing window real zeros of a bivariate function.

return

integer

func

polynomial

geometry xrange yrange zrange

list

id number

integer

name

string

References

ox_launch, ox_launch_nox, ox_shutdown, ox_reset,ox_intr,register_handler


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.5.16 open_canvas, clear_canvas, draw_obj, draw_string

open_canvas(id[,geometry])

:: Opens a canvas, which is a window for drawing objects.

clear_canvas(id,index)

:: Clears a canvas.

draw_obj(id,index,pointorsegment [,color])

:: Draws a point or a line segment on a canvas.

draw_string(id,index,[x,y],string [,color])

:: Draws a character string on a canvas.

return

0

id index color x y

integer

pointorsegment

list

string

character string

[182] Id=ox_launch_nox(0,"ox_plot");
0
[183] open_canvas(Id);
0
[184] Ind=ox_pop_cmo(Id);
0
[185] draw_obj(Id,Ind,[100,100]);
0
[186] draw_obj(Id,Ind,[200,200],0xffff);
0
[187] draw_obj(Id,Ind,[10,10,50,50],0xff00ff);
0
[187] draw_string(Id,Ind,[100,50],"hello",0xffff00);
0
[189] clear_canvas(Id,Ind);
0
References

ox_launch, ox_launch_nox, ox_shutdown, ox_reset,ox_intr,register_handler, ox_pop_cmo, ox_pop_local.


[ << ] [ < ] [ Up ] [ > ] [ >> ]

This document was generated on November 5, 2024 using texi2html 5.0.