The script, gridserver.sh (Linux) and batch file, gridserver.bat (Windows) start or stop an instance of the Grid Server on a local computer. These scripts are run from the operating system command interpreter.
The syntax of the gridserver script/batch file is one of
gridserver [options] startmultiple [port [count]]
gridserver [options] start [port [cpu_index]]
gridserver [options] stop [port [cpu_index]]
where one of the following modes can be specified
start
|
Causes a single Node to start on the indicated port
|
startmultiple
|
Causes count Nodes to be started on a single computer beginning at the indicated port.
|
stop
|
Halts the Node associated with port. If Node was from a startmultiple then all Nodes are halted.
|
|
|
If no mode is specified then startmultiple is assumed and the modes take the following optional parameters
cpu_index
|
The index. Should be set zero to allow AutoDiscovery with broadcast.
|
port
|
The port associated with the Node. If not specified then use port from the -p option or from the configuration file.
|
count
|
The number of Nodes to start. If not specified the use the -n option or the value from the configuration file.
|
|
|
Options may be one or more of:
-a address
|
UDP broadcast address (e.g 192.168.255.255) for AutoDiscovery. Use 255 to indicate the portion of the subnet to use. This example will broadcast to all computers on the 192.168.*.* address.
|
-b port
|
UDP broadcast port (e.g. 4400). Set to 0 to disable AutoDiscovery.
|
-d
|
Enable debug messages to the log file
|
-f file
|
Path and filename of log file (e.g. logs/grid.log)The path can be relative to Grid Computing Toolbox directory
|
-m path
|
The full path to commandline Maple binary
|
-n num
|
Number of Nodes to create
|
-p port
|
TCP/IP base port for the Nodes
|
|
|
Any option not specified will be taken from the configuration file conf/grid.properties
The startmultiple mode starts the specified count of Grid Servers on the same machine. Count should generally not exceed the number of CPUs on the machine as then several instances of Maple will likely use the same CPU instead of being distributed over multi-CPUs. However one reason to set count higher than the number of CPUs is during initial testing of grid code using a single machine. This might be done when a network of Grid Servers is not available. To perform testing using a single machine the following command could be used at the operating system prompt:
gridserver.sh -a 127.0.0.255 -b 4401 startmultiple 2000 5 (Linux)
gridserver.bat -a 127.0.0.255 -b 4401 startmultiple 2000 5 (Windows)
This would start 5 instances of the Grid Server on the local machine each instance using a port from 2000 to 2004.
Jobs would be submitted using the Launch library function after issuing a Setup using localhost (127.0.0.1) and port 2000 as the parameters.
|
Example Code Accessing the Running Servers
|
|
Example for the Server running on port 2000 on the local computer.
>
|
Setup("hpc", host="localhost", port=2000);
|
A String representing Maple code to execute on the remote nodes is Launched.
>
|
code := "printf(\"Hello from node %a\\n\", Grid:-MyNode());";
result := Launch(code, numnodes=2);
|
Node 0: Hello from node 0
Node 1: Hello from node 1
| (1.1.2.1.2) |
|
The start command would be used where AutoDiscovery is not practical (e.g. Grid Servers are not on a common Internet subnet). In this case each server would be started using an operating system command similar to:
gridserver.sh -b 0 start 2000 (Linux)
gridserver.bat -b 0 start 2000 (Windows)
The same port must be used for each computer where the Grid Server is started as well as on the client machine from which the grid code is to be sent from. Access to the Grid Servers started with the start option must be done from either the Launcher script or PBS script shown below. This is because these scripts will receive a file listing the nodes to use in the grid computations.
The stop parameter would be used to terminate the running Grid Server on the local machine.
gridserver.sh stop 2000 (Linux)
gridserver.bat stop 2000 (Windows)
If the server was started with the startmultiple parameter then all instances of the Grid Server on that machine are stopped. For servers started with the start parameter then each instance would require a matching stop call to halt that instance of the Grid Server.