callx()

Description:

Compute cellset file dfx with parallel processing and return a sequence composed of result sets of the multiple subtasks.

Syntax:

callx(dfx,;h,s;x)

Note: 

When parameter h and s are absent, the function executes script dfx using multiple threads on the local machine; split parameter to distribute to the multiple threads if it is a sequence; and copy it to the multiple threads if it is a single value; the length of the parameter sequence is the number of subtasks. Perform multiprocess computing if there are multiple processes on the machine. The actual number of parallel tasks is the preferred task number for the current machine; the extra tasks will wait in queue for any available process.

When parameter h is present, the function distributes the computational task among the node process list h and executes script dfx to inherit the task space.

When the number of subtasks is equivalent to the length of node list h, the function allocates subtasks evenly among the nodes while ignoring parameter x, the reduce action; when the number of subtasks is greater than the length of node list h, the function sorts h according to the computing ability of each node, gives the appropriate number of subtasks to the top node, and then reassests the computing ability of the rest of the nodes for distribution; the process continues until the number of subtasks is less than a certan threshold value and nodes will be started to compute. A node will ask for more jobs only after it finishes its current ones; the computation loops like this until it is completed.

Parameter s is a sequence of integer sequences. Each integer sequence is a sequence of task numbers the corresponding node will perform. The task distribution needs to check whether or not a node can perform certain tasks; won’t perform the check if s is absent.

Parameter x is the reduce action. The function returns a sequence consitting of the result sets of the subtasks if x is absent. When x is present, the function calculates reduce using ~, the result of each subtask, and ~~, the current reduce result and puts the result of x into ~~ to go on calculating reduce and returns the final result of ~~ as the result sequence of all node subtasks.

Parameters:

dfx

The cellset file, for which an absolute or a relative path can be set. The relative path is the Search Path under the Tool->Option-> [Environment] menu.

x

Reduce action; can be omitted

The parameter for passing value to dfx. It is usually in the form of a sequence. The number of parameters to be passed to dfx is the number of the sequences. The parallel algorithm will divide a computational task into multiple subtasks according to the length of the parameter sequence and pass each member of the sequence to the corresponding subtask as the parameter value of dfx. If a parameter is single-value, then it will be copied to every subtask.

h

The server sequence in which each server is represented by a string in the form of "address:port number", like "192. 168. 0. 86: 4001". By default, the servers will not be specified, and the computation will be distributed to multiple threads in the current process.

s

A sequence made up of integer sequences

Options:

  @a  Distribute subtasks among nodes randomly without considering equal loads. If a node happens to be invalid or returns an error, replace it with another.

Example:

test.dfx is the deployment file for the remote node server. The node machines are respectively the [”192.168.0.204”,” 192.168.0.205”,” 192.168.0.206”], and the port number is 8081. The file contents are shown below:

1)  Single Parameter

 

A

B

1

=connect("demo").query("select * from SCORES where SUBJECT=?",arg1)

2

return A1

return A1.(SCORE)

 

 

A

 

 

 

1

=callx("test.dfx",["English","Math","PE"];["192.168.0.204:8081","192.168.0.205:8081"])

Allocate three subtasks to servers on the two machines running in parallel.

2

=callx("test.dfx",["English","Math","PE"];["192.168.0.204:8081","192.168.0.205:8281","192.168.0.206:8081"])

Tasks will be allocated strictly in order as there are same number of servers 

3

=callx("test.dfx",["English","Math","PE"];)

Run parallelly and locally. The file is stored under the search path in Tools->Options->[Environment] menu.

4

=callx("test.dfx",["English","Math","PE"];["192.168.0.204:8081","192.168.0.205:8081"],[[1],[2,3])

Distribute subtasks to specified nodes: Node 192.168.0.204:8081 gets the subtask 1 and Node 192.168.0.205:8081 gets subtasks 2 and 3

5

=callx("test.dfx":~~|~,["English","Math","PE"])

Perform parallel processing on the local machine to calculate the aggregate expression is ~~|~ and return the sequence of node results

 

2)  Multiple Parameters

 

A

 

1

=connect("demo")

 

 

2

=A1.query("select * from EMPLOYEE where EID in (?)and GENDER=?",arg1,arg2)

 

 

3

=A1.close()

 

 

4

return A2

 

 

 

 

A

 

1

=callx("test.dfx",[[1,20,6,14,5]],"F";"192.168.0.204:8081")

Pass two parameters, which are string type and sequence type respectively, to one node machine.

2

=callx("test.dfx",[[1,20,6,14,5],[22,33,44]],"F";["192.168.0.204:8081","192.168.0.205:8081"])

Send multiple parameters to multiple node machines. For a parameter that has the same value, it can be passed in the form of single value.

3

=callx("test.dfx",[[1,20,6,14,5],[22,33,44]],["F","M"];["192.168.0.204:8081","192.168.0.205:8081"])

When multiple node machines receive the same parameter with different values, the parmeter should be passed in the form of a sequence.