<Chapter><Heading> Parallel Computation - Core Functions</Heading>

<Section><Heading> &nbsp;</Heading>

<ManSection>

<Func Name="ChildProcess" Arg=""/>

<Func Name="ChildProcess" Arg="arg"/>
<Description>

<P/>
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:<Br/>
1) <M>arg</M>="computer.ac.wales" the address of a remote computer for which ssh has been configured to require no password from the user;<Br/> 
(2) <M>arg</M>=["-m", "100000M", "-T"] a list of GAP command line options;<Br/>
(3) <M>arg</M>="computer.ac.wales", ["-m", "100000M", "-T"]  the address of a computer followed by a list of command line options.

<P/>
(To configure ssh so that the user can login without a password prompt from "thishost" to "remotehost" either consult "man ssh" or
<Br/>
<Br/>
- open a shell on thishost<Br/>
- cd .ssh<Br/>
- ls<Br/>
-> if id_dsa, id_rsa etc exists,
skip the next two steps!<Br/>
- ssh-keygen -t rsa<Br/>
- ssh-keygen -t dsa<Br/>
- scp *.pub userremotehost:~/<Br/>
- ssh remotehost -l user<Br/>
- cat id_rsa.pub >> .ssh/authorized_keys<Br/>
- cat id_dsa.pub >> .ssh/authorized_keys<Br/>
- rm id_rsa.pub id_dsa.pub<Br/>
- exit<Br/>
<Br/>
You should now be able to connect from "thishost" to "remotehost"
without a password prompt.)
<P/><B>Examples:</B> <URL><Link>../www/SideLinks/About/aboutBogomolov.html</Link><LinkText>1</LinkText></URL>&nbsp;,
<URL><Link>../www/SideLinks/About/aboutParallel.html</Link><LinkText>2</LinkText></URL>&nbsp; 

</Description>

























































































































</ManSection>

<ManSection>

<Func Name="ChildClose" Arg="s"/>
<Description>

<P/>
This closes the stream s to a child GAP process.
<P/><B>Examples:</B> <URL><Link>../www/SideLinks/About/aboutBogomolov.html</Link><LinkText>1</LinkText></URL>&nbsp; 

</Description>

























































































































</ManSection>

<ManSection>

<Func Name="ChildCommand" Arg="str,s"/>
<Description>

<P/>
This runs a GAP command <M>str</M>="cmd;" on the child process accessed by the stream s.
Here "cmd;" is a string representing the command. 
<P/><B>Examples:</B> <URL><Link>../www/SideLinks/About/aboutBogomolov.html</Link><LinkText>1</LinkText></URL>&nbsp;,
<URL><Link>../www/SideLinks/About/aboutParallel.html</Link><LinkText>2</LinkText></URL>&nbsp; 

</Description>

























































































































</ManSection>

<ManSection>

<Func Name="NextAvailableChild" Arg="L"/>
<Description>

<P/>
Inputs a list <M>L</M> of child processes and returns a child in <M>L</M>
which is ready for computation (as soon as such a child is available).
<P/><B>Examples:</B> <URL><Link>../www/SideLinks/About/aboutBogomolov.html</Link><LinkText>1</LinkText></URL>&nbsp;,
<URL><Link>../www/SideLinks/About/aboutParallel.html</Link><LinkText>2</LinkText></URL>&nbsp; 

</Description>

























































































































</ManSection>

<ManSection>

<Func Name="IsAvailableChild" Arg="s"/>
<Description>

<P/>
Inputs a child process  <M>s</M> and returns true if s is currently available
for computations, and false otherwise.

<P/><B>Examples:</B> <URL><Link>../www/SideLinks/About/aboutParallel.html</Link><LinkText>1</LinkText></URL>&nbsp; 

</Description>

























































































































</ManSection>

<ManSection>

<Func Name="ChildPut" Arg="A,str,s"/>
<Description>

<P/> This copies a GAP object A on the parent process to an object B=<M>str</M> on the child process s. (The copying relies on the function PrintObj(A); )
<P/><B>Examples:</B> <URL><Link>../www/SideLinks/About/aboutBogomolov.html</Link><LinkText>1</LinkText></URL>&nbsp;,
<URL><Link>../www/SideLinks/About/aboutParallel.html</Link><LinkText>2</LinkText></URL>&nbsp; 

</Description>

























































































































</ManSection>

<ManSection>

<Func Name="ChildGet" Arg="str,s"/>
<Description>

<P/> This functions copies a GAP object A="str" on the child process s and returns it on the parent process. (The copying relies on the function PrintObj(A); )
<P/><B>Examples:</B> <URL><Link>../www/SideLinks/About/aboutBogomolov.html</Link><LinkText>1</LinkText></URL>&nbsp;,
<URL><Link>../www/SideLinks/About/aboutParallel.html</Link><LinkText>2</LinkText></URL>&nbsp; 

</Description>

























































































































</ManSection>

<ManSection>

<Func Name="HAPPrintTo" Arg="str,R"/>
<Description>

<P/>
Inputs a  string <M>str</M>="file" giving the address of a new text file and a HAP object R. It writes the object R to  "file".
 Currently this is only implemented for R equal to a resolution.
<P/><B>Examples:</B> <URL><Link>../www/SideLinks/About/aboutParallel.html</Link><LinkText>1</LinkText></URL>&nbsp; 

</Description>

























































































































</ManSection>

<ManSection>

<Func Name="HAPRead" Arg="str,R"/>
<Description>

<P/>
Inputs an address   <M>str</M>="file" of a file containing a HAP object R 
and returns the object. 
 Currently this is only implemented for R equal to a resolution.
<P/><B>Examples:</B> <URL><Link>../www/SideLinks/About/aboutParallel.html</Link><LinkText>1</LinkText></URL>&nbsp; 

</Description>

























































































































</ManSection>

</Section>
</Chapter>

<Chapter>
<Heading> Parallel Computation - Extra Functions</Heading>

<Section><Heading> &nbsp;</Heading>

<ManSection>

<Func Name="ChildFunction" Arg="str,s"/>
<Description>

<P/>
This runs the GAP function <M>str</M>="function(arg);"
on a child process accessed by the stream s.
The  output from "func;" can be accessed via the stream.
<P/><B>Examples:</B> 
</Description>

























































































































</ManSection>

<ManSection>

<Func Name="ChildRead" Arg="s"/>
<Description>

<P/>
This returns, as a string, the output of the last application of <M>ChildFunction("function(arg);",s)</M>.
<P/><B>Examples:</B> 
</Description>

























































































































</ManSection> 

<ManSection>

<Func Name="ChildReadEval" Arg="s"/>
<Description>

<P/>
This returns, as an evaluated string, the output of the last application of <M>ChildFunction("function(arg);",s)</M>.
<P/><B>Examples:</B> 
</Description>

























































































































</ManSection>

<ManSection>

<Func Name="ParallelList" Arg="I,fn,L"/>
<Description>

<P/>
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 
the function <M>fn</M> must be defined on all child processes in <M>L</M>.)
<P/><B>Examples:</B> <URL><Link>../www/SideLinks/About/aboutBogomolov.html</Link><LinkText>1</LinkText></URL>&nbsp;,
<URL><Link>../www/SideLinks/About/aboutParallel.html</Link><LinkText>2</LinkText></URL>&nbsp; 

</Description>

























































































































</ManSection>

</Section>
</Chapter>

