CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

| Download

GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it

Views: 418346
1
<Chapter><Heading> Parallel Computation - Core Functions</Heading>
2
3
4
<Table Align="|l|" >
5
6
7
8
<Row>
9
<Item>
10
<Index> ChildProcess</Index>
11
<C>ChildProcess()</C>
12
<C>ChildProcess("computer.ac.wales")</C>
13
<C>ChildProcess(["-m", "100000M", "-T"])</C>
14
<C>ChildProcess("computer.ac.wales", ["-m", "100000M", "-T"])</C>
15
16
17
18
<P/>
19
This starts a GAP session as a child process and returns a stream to the child process. If no argument is given then the child process is created on the local machine; otherwise the argument should be: 1) the address of a remote computer for which ssh has been configured to require no password from the user; (2) or a list of GAP command line options; (3) or the address of a computer followed by a list of command line options.
20
21
<P/>
22
(To configure ssh so that the user can login without a password prompt from "thishost" to "remotehost" either consult "man ssh" or
23
<Br/>
24
<Br/>
25
- open a shell on thishost<Br/>
26
- cd .ssh<Br/>
27
- ls<Br/>
28
-> if id_dsa, id_rsa etc exists,
29
skip the next two steps!<Br/>
30
- ssh-keygen -t rsa<Br/>
31
- ssh-keygen -t dsa<Br/>
32
- scp *.pub user@remotehost:~/<Br/>
33
- ssh remotehost -l user<Br/>
34
- cat id_rsa.pub >> .ssh/authorized_keys<Br/>
35
- cat id_dsa.pub >> .ssh/authorized_keys<Br/>
36
- rm id_rsa.pub id_dsa.pub<Br/>
37
- exit<Br/>
38
<Br/>
39
You should now be able to connect from "thishost" to "remotehost"
40
without a password prompt.)
41
</Item>
42
</Row>
43
44
<Row>
45
<Item>
46
<Index> ChildClose</Index>
47
<C>ChildClose(s)</C>
48
49
<P/>
50
This closes the stream s to a child GAP process.
51
</Item>
52
</Row>
53
54
<Row>
55
<Item>
56
<Index> ChildCommand</Index>
57
<C>ChildCommand("cmd;",s)</C>
58
59
<P/>
60
This runs a GAP command "cmd;" on the child process accessed by the stream s.
61
Here "cmd;" is a string representing the command.
62
</Item>
63
</Row>
64
65
<Row>
66
<Item>
67
<Index> NextAvailableChild</Index>
68
<C>NextAvailableChild(L)</C>
69
70
<P/>
71
Inputs a list <M>L</M> of child processes and returns a child in <M>L</M>
72
which is ready for computation (as soon as such a child is available).
73
</Item>
74
</Row>
75
76
<Row>
77
<Item>
78
<Index> IsAvailableChild</Index>
79
<C>IsAvailableChild(s)</C>
80
81
<P/>
82
Inputs a child process <M>s</M> and returns true if s is currently available
83
for computations, and false otherwise.
84
85
</Item>
86
</Row>
87
88
89
<Row>
90
<Item>
91
<Index> ChildPut</Index>
92
<C>ChildPut(A,"B",s)</C>
93
94
<P/> This copies a GAP object A on the parent process to an object B on the child process s. (The copying relies on the function PrintObj(A); )
95
</Item>
96
</Row>
97
98
<Row>
99
<Item>
100
<Index> ChildGet</Index>
101
<C>ChildGet("A",s)</C>
102
103
<P/> This functions copies a GAP object A on the child process s and returns it on the parent process. (The copying relies on the function PrintObj(A); )
104
</Item>
105
</Row>
106
107
<Row>
108
<Item>
109
<Index> HAPPrintTo</Index>
110
<C>HAPPrintTo("file",R)</C>
111
112
<P/>
113
Inputs a name "file" of a new text file and a HAP object R. It writes the object R to "file".
114
Currently this is only implemented for R equal to a resolution.
115
</Item>
116
</Row>
117
118
<Row>
119
<Item>
120
<Index> HAPRead</Index>
121
<C>HAPRead("file",R)</C>
122
123
<P/>
124
Inputs a name "file" containing a HAP object R
125
and returns the object.
126
Currently this is only implemented for R equal to a resolution.
127
</Item>
128
</Row>
129
130
131
</Table>
132
</Chapter>
133
134
<Chapter>
135
<Heading> Parallel Computation - Extra Functions</Heading>
136
137
<Table Align="|l|" >
138
139
140
141
<Row>
142
<Item>
143
<Index> ChildFunction</Index>
144
<C>ChildFunction("function(arg);",s)</C>
145
146
<P/>
147
This runs the GAP function "function(arg);"
148
on a child process accessed by the stream s.
149
The output from "func;" can be accessed via the stream.
150
</Item>
151
</Row>
152
153
<Row>
154
<Item>
155
<Index> ChildRead</Index>
156
<C>ChildRead(s)</C>
157
158
<P/>
159
This returns, as a string, the output of the last application of <M>ChildFunction("function(arg);",s)</M>.
160
</Item>
161
</Row>
162
163
<Row>
164
<Item>
165
<Index> ChildReadEval</Index>
166
<C>ChildReadEval(s)</C>
167
168
<P/>
169
This returns, as an evaluated string, the output of the last application of <M>ChildFunction("function(arg);",s)</M>.
170
</Item>
171
</Row>
172
173
174
<Row>
175
<Item>
176
<Index> ParallelList</Index>
177
<C>ParallelList(I,fn,L)</C>
178
179
<P/>
180
Inputs a list <M>I</M>, a function <M>fn</M> such that <M>fn(x)</M> is defined for all <M>x</M> in <M>I</M>, and a list of children <M>L</M>. It uses the children in <M>L</M> to compute <M>List(I,x->fn(x))</M>. (Obviously
181
the function <M>fn</M> must be defined on all child processes in <M>L</M>.)
182
</Item>
183
</Row>
184
185
186
</Table>
187
</Chapter>
188
189
190
191