Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
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
Project: cocalc-sagemath-dev-slelievre
Views: 418346<Chapter><Heading> Parallel Computation - Core Functions</Heading>123<Table Align="|l|" >4567<Row>8<Item>9<Index> ChildProcess</Index>10<C>ChildProcess()</C>11<C>ChildProcess("computer.ac.wales")</C>12<C>ChildProcess(["-m", "100000M", "-T"])</C>13<C>ChildProcess("computer.ac.wales", ["-m", "100000M", "-T"])</C>14151617<P/>18This 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.1920<P/>21(To configure ssh so that the user can login without a password prompt from "thishost" to "remotehost" either consult "man ssh" or22<Br/>23<Br/>24- open a shell on thishost<Br/>25- cd .ssh<Br/>26- ls<Br/>27-> if id_dsa, id_rsa etc exists,28skip the next two steps!<Br/>29- ssh-keygen -t rsa<Br/>30- ssh-keygen -t dsa<Br/>31- scp *.pub user@remotehost:~/<Br/>32- ssh remotehost -l user<Br/>33- cat id_rsa.pub >> .ssh/authorized_keys<Br/>34- cat id_dsa.pub >> .ssh/authorized_keys<Br/>35- rm id_rsa.pub id_dsa.pub<Br/>36- exit<Br/>37<Br/>38You should now be able to connect from "thishost" to "remotehost"39without a password prompt.)40</Item>41</Row>4243<Row>44<Item>45<Index> ChildClose</Index>46<C>ChildClose(s)</C>4748<P/>49This closes the stream s to a child GAP process.50</Item>51</Row>5253<Row>54<Item>55<Index> ChildCommand</Index>56<C>ChildCommand("cmd;",s)</C>5758<P/>59This runs a GAP command "cmd;" on the child process accessed by the stream s.60Here "cmd;" is a string representing the command.61</Item>62</Row>6364<Row>65<Item>66<Index> NextAvailableChild</Index>67<C>NextAvailableChild(L)</C>6869<P/>70Inputs a list <M>L</M> of child processes and returns a child in <M>L</M>71which is ready for computation (as soon as such a child is available).72</Item>73</Row>7475<Row>76<Item>77<Index> IsAvailableChild</Index>78<C>IsAvailableChild(s)</C>7980<P/>81Inputs a child process <M>s</M> and returns true if s is currently available82for computations, and false otherwise.8384</Item>85</Row>868788<Row>89<Item>90<Index> ChildPut</Index>91<C>ChildPut(A,"B",s)</C>9293<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); )94</Item>95</Row>9697<Row>98<Item>99<Index> ChildGet</Index>100<C>ChildGet("A",s)</C>101102<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); )103</Item>104</Row>105106<Row>107<Item>108<Index> HAPPrintTo</Index>109<C>HAPPrintTo("file",R)</C>110111<P/>112Inputs a name "file" of a new text file and a HAP object R. It writes the object R to "file".113Currently this is only implemented for R equal to a resolution.114</Item>115</Row>116117<Row>118<Item>119<Index> HAPRead</Index>120<C>HAPRead("file",R)</C>121122<P/>123Inputs a name "file" containing a HAP object R124and returns the object.125Currently this is only implemented for R equal to a resolution.126</Item>127</Row>128129130</Table>131</Chapter>132133<Chapter>134<Heading> Parallel Computation - Extra Functions</Heading>135136<Table Align="|l|" >137138139140<Row>141<Item>142<Index> ChildFunction</Index>143<C>ChildFunction("function(arg);",s)</C>144145<P/>146This runs the GAP function "function(arg);"147on a child process accessed by the stream s.148The output from "func;" can be accessed via the stream.149</Item>150</Row>151152<Row>153<Item>154<Index> ChildRead</Index>155<C>ChildRead(s)</C>156157<P/>158This returns, as a string, the output of the last application of <M>ChildFunction("function(arg);",s)</M>.159</Item>160</Row>161162<Row>163<Item>164<Index> ChildReadEval</Index>165<C>ChildReadEval(s)</C>166167<P/>168This returns, as an evaluated string, the output of the last application of <M>ChildFunction("function(arg);",s)</M>.169</Item>170</Row>171172173<Row>174<Item>175<Index> ParallelList</Index>176<C>ParallelList(I,fn,L)</C>177178<P/>179Inputs 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>. (Obviously180the function <M>fn</M> must be defined on all child processes in <M>L</M>.)181</Item>182</Row>183184185</Table>186</Chapter>187188189190191