The following example creates five child processes and uses them simultaneously to compute the second integral homology of each of the \(267\) groups of order \(64\). The final command shows that
\(H_2(G,\mathbb Z)=\mathbb Z_2^{15}\)
for the \(267\)-th group \(G\) in GAP's library of small groups.
gap> Processes:=List([1..5],i->ChildProcess());; gap> fn:=function(i);return GroupHomology(SmallGroup(64,i),2);end;; gap> for p in Processes do > ChildPut(fn,"fn",p); > od; gap> NrSmallGroups(64); 267 gap> L:=ParallelList([1..267],"fn",Processes);; gap> L[267]; [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
The function ParallelList()
is built from HAP's six core functions for parallel computation.
The following commands use core functions to compute the product \(A=M\times N\) of two random matrices by distributing the work over two processors.
gap> M:=RandomMat(2000,2000);; gap> N:=RandomMat(2000,2000);; gap> s:=ChildProcess();; gap> Mtop:=M{[1..1000]};; gap> Mbottom:=M{[1001..2000]};; gap> ChildPut(Mtop,"Mtop",s); gap> ChildPut(N,"N",s); gap> NextAvailableChild([s]);; gap> ChildCommand("Atop:=Mtop*N;;",s);; gap> Abottom:=Mbottom*N;; gap> A:=ChildGet("Atop",s);; gap> Append(A,Abottom);;
generated by GAPDoc2HTML