Quellcodebibliothek Statistik Leitseite products/sources/formale Sprachen/GAP/pkg/hap/www/SideLinks/About/   (Algebra von RWTH Aachen Version 4.15.1©)  Datei vom 19.6.2025 mit Größe 12 kB image not shown  

Quelle  aboutParallel.html   Sprache: HTML

 
 products/sources/formale Sprachen/GAP/pkg/hap/www/SideLinks/About/aboutParallel.html


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta http-equiv="content-type"
 content="text/html; charset=ISO-8859-1">
  <title>AboutHap</title>
</head>
<body
 style="color: rgb(0, 0, 153); background-color: rgb(204, 255, 255);"
 link="#000066" vlink="#000066" alink="#000066">
<br>
<table
 style="text-align: left; margin-left: auto; margin-right: auto; color: rgb(0, 0, 102);"
 border="0" cellpadding="20" cellspacing="10">
  <tbody>
    <tr align="center">
      <th style="vertical-align: top;">
      <table style="width: 100%; text-align: left;" cellpadding="2"
 cellspacing="2">
        <tbody>
          <tr>
            <td style="vertical-align: top;"><a href="aboutTDA.html"><small
 style="color: rgb(0, 0, 102);">Previous</small></a><br>
            </td>
            <td
 style="text-align: center; vertical-align: top; color: rgb(0, 0, 102);"><big><span
 style="font-weight: bold;">About HAP: Parallel Computation<br>
            </span></big></td>
            <td style="text-align: right; vertical-align: top;"><a
 href="aboutAbelianCategories.html"><small
 style="color: rgb(0, 0, 102);">next</small></a><br>
            </td>
          </tr>
        </tbody>
      </table>
      <big><span style="font-weight: bold;"></span></big><br>
      </th>
    </tr>
    <tr>
      <td
 style="vertical-align: top; background-color: rgb(255, 255, 255); text-align: left;">Homological
computations
can require much time and memory.  In principle,
many of the computations can be distributed in fairly obvious ways over
several processors on one or more PCs.
HAP contains a few basic functions for achieving this. <br>
      </td>
    </tr>
    <tr>
      <td
 style="vertical-align: top; background-color: rgb(255, 255, 255);">The
following commands compute the third integral homology groups of the
fourteen groups of order 16 using two child processes. The first child
is on the
local machine and the second child is on a remote machine for which ssh
has been configured to require no password. This is an example of
"trivial parallelism". On a multiprocessor
machine distinct child processes would normally automatically
be assigned to different processors.<br>
      </td>
    </tr>
    <tr>
      <td
 style="background-color: rgb(255, 255, 204); vertical-align: top;">gap>
s:=ChildProcess();;<br>
gap> t:=ChildProcess("alberti.vlan.nuigalway.ie");;<br>
      <br>
gap>
ChildCommand("Odd:=List([1,3,5,7,9,11,13],i->GroupHomology(SmallGroup(16,i),3));",s);<br>
gap>
ChildCommand("Even:=List([2,4,6,8,10,12,14],i->GroupHomology(SmallGroup(16,i),3));",t);<br>
gap> ODD:=ChildGet("Odd",s);;<br>
gap> EVEN:=ChildGet("Even",t);;<br>
      <br>
gap> for i in [1..7] do<br>
gap> Print("Group ",2*i-1," has third homology ",ODD[i],"\n");<br>
gap> Print("Group ",2*i," has third homology ",EVEN[i],"\n");<br>
gap> od;<br>
      <br>
Group 1 has third homology [ 16 ]<br>
Group 2 has third homology [ 4, 4, 4 ]<br>
Group 3 has third homology [ 2, 2, 4, 4 ]<br>
Group 4 has third homology [ 2, 4, 4 ]<br>
Group 5 has third homology [ 2, 2, 8 ]<br>
Group 6 has third homology [ 2, 8 ]<br>
Group 7 has third homology [ 2, 2, 8 ]<br>
Group 8 has third homology [ 2, 8 ]<br>
Group 9 has third homology [ 16 ]<br>
Group 10 has third homology [ 2, 2, 2, 2, 2, 2, 4 ]<br>
Group 11 has third homology [ 2, 2, 2, 2, 2, 2, 4 ]<br>
Group 12 has third homology [ 2, 2, 2, 8 ]<br>
Group 13 has third homology [ 2, 2, 2, 8 ]<br>
Group 14 has third homology [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]<br>
      </td>
    </tr>
    <tr>
      <td
 style="vertical-align: top; background-color: rgb(255, 255, 255);">A
weakness with the above parallel computation is that the naive
distribution of tasks over the two child processes might result in one
process being finished long before the other.  The command
NextAvailableChild() can be used to overcome this problem.
Alternatively, the function ParallelList() can be used.<br>
      <br>
The following commands, on a two-processor IBM laptop, show that
parallel computation can halve the time to compute the second homology
of the groups of order 128.<br>
      </td>
    </tr>
    <tr>
      <td
 style="vertical-align: top; background-color: rgb(255, 255, 204);">gap>
s:=ChildProcess();;<br>
gap> t:=ChildProcess();;<br>
gap> fn:=function(i);return
GroupHomology(SmallGroup(128,i),2);end;<br>
gap> ChildPut( fn, "fn", s);<br>
gap> ChildPut( fn, "fn", t);<br>
      <br>
gap> Exec("date");<br>
Sat Oct  6 23:52:55 IST 2007<br>
gap> Lparallel:=ParallelList([1..2328],"fn",[s,t]);;<br>
gap> Exec("date");<br>
Sun Oct  7 00:00:37 IST 2007<br>
gap> L:=List([1..2328], fn);;<br>
gap> Exec("date");<br>
Sun Oct  7 00:14:07 IST 2007<br>
      </td>
    </tr>
    <tr>
      <td
 style="vertical-align: top; background-color: rgb(255, 255, 255);">The
following commands illustrate a naive parallel computation of the
product A=M*N of two random matrices M and N. The computation involves
just one child and takes 64% of the time needed for the standard
sequential
calculation of M*N. <br>
      </td>
    </tr>
    <tr>
      <td
 style="vertical-align: top; background-color: rgb(255, 255, 204);">gap>
M:=RandomMat(2000,2000);;                    
#Two
random matrices.<br>
gap> N:=RandomMat(2000,2000);;<br>
      <br>
gap> s:=ChildProcess();;<br>
      <br>
gap> Exec("date");<br>
Tue Nov 27 05:17:55 GMT 2007<br>
gap>
Mtop:=M{[1..1000]};;                                  
#Splitting
the first matrix in two<br>
gap> Mbottom:=M{[1001..2000]};;<br>
      <br>
gap>
ChildPut(Mtop,"Mtop",s);                             
#Transferring
data to the child.<br>
gap> ChildPut(N,"N",s);<br>
gap> NextAvailableChild([s]);;<br>
      <br>
gap>
ChildCommand("Atop:=Mtop*N;;",s);;      
#Matrix multiplication on child.<br>
gap>
Abottom:=Mbottom*N;;                              
#Matrix
multiplication on parent.<br>
gap> A:=ChildGet("Atop",s);;<br>
gap>
Append(A,Abottom);;                                    
#A
is the product M*N.<br>
gap> Exec("date");<br>
Tue Nov 27 05:18:47 GMT 2007<br>
      </td>
    </tr>
    <tr>
      <td
 style="vertical-align: top; background-color: rgb(255, 255, 255);">The
parallel multiplication took 52 seconds on a two-processor IBM laptop,
compared to 81 seconds below for multiplication on a single processor.
This is a speedup factor of 0.64 .<br>
      </td>
    </tr>
    <tr>
      <td
 style="vertical-align: top; background-color: rgb(255, 255, 204);">gap>
Exec("date");M*N;;Exec("date");<br>
Tue Nov 27 05:13:56 GMT 2007<br>
Tue Nov 27 05:15:17 GMT 2007<br>
      </td>
    </tr>
    <tr>
      <td
 style="vertical-align: top; background-color: rgb(255, 255, 255);">The
following commands show how two processors could be used to compute H<sub>8</sub>(G,Z)
for
the group G=SmallGroup(512,1201). The commands begin with the
definition of the function <br>
      <br>
      <div style="text-align: center;">ParallelResolution(G,N,n,t). <br>
      </div>
      <br>
Unfortunately, this example is too naive: the loads on the two
processors is extremely unbalanced.<br>
      </td>
    </tr>
    <tr>
      <td
 style="vertical-align: top; background-color: rgb(255, 255, 204);">#################################################<br>
ParallelResolution:=function(G,N,n,t)<br>
local<br>
        R,S,T,nat,iso;<br>
      <br>
       
nat:=NaturalHomomorphismByNormalSubgroup(G,N);<br>
       
iso:=IsomorphismPermGroup(N);           
#HAPPrintTo()
and HAPRead() will only work with<br>
       
ChildPut(n,"n",t);                                      
#permutation
or matrix groups.<br>
        ChildPut(Image(iso),"N",t);<br>
       
ChildCommand("R:=ResolutionFiniteGroup(N,n);",t);<br>
       
ChildCommand("HAPPrintTo(\"/tmp/test\",R);",t);<br>
      <br>
       
S:=ResolutionFiniteGroup(Image(nat),n);<br>
       <br>
        while not
IsAvailableChild(t)
do              
#This
should ensure that the next command is<br>
       
od;                                                             
#not
processed too soon!<br>
      <br>
        R:=HAPRead("/tmp/test");<br>
        R!.group:=N;<br>
       
R!.elts:=List(R!.elts,x->PreImagesRepresentative(iso,x));<br>
      <br>
        T:=ResolutionFiniteExtension(<br>
                                                          
GeneratorsOfGroup(G),<br>
                                                          
List(GeneratorsOfGroup(G),x->Image(nat,x)),<br>
                                                          
S,n,false,R);<br>
        return T;<br>
end;<br>
#################################################<br>
      <br>
      <br>
G:=SmallGroup(512,1201);;<br>
phi:=NaturalHomomorphismByNormalSubgroup(G,Centre(G));;<br>
t:=ChildProcess();;<br>
T:=ParallelResolution(G,Centre(G),9,t);;<br>
C:=TensorWithIntegers(T);;<br>
      <br>
Homology(C,8);<br>
[ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 4, 4, 8 ]<br>
      </td>
    </tr>
    <tr>
      <td style="vertical-align: top;">
      <table
 style="margin-left: auto; margin-right: auto; width: 100%; text-align: left;"
 border="0" cellpadding="2" cellspacing="2">
        <tbody>
          <tr>
            <td style="vertical-align: top;"><a
 style="color: rgb(0, 0, 102);" href="aboutTDA.html">Previous
Page</a><br>
            </td>
            <td style="text-align: center; vertical-align: top;"><a
 href="aboutContents.html"><span style="color: rgb(0, 0, 102);">Contents</span></a><br>
            </td>
            <td style="text-align: right; vertical-align: top;"><a
 href="aboutAbelianCategories.html"><span style="color: rgb(0, 0, 102);">Next
page</span><br>
            </a> </td>
          </tr>
        </tbody>
      </table>
      <a href="aboutTopology.html"><br>
      </a> </td>
    </tr>
  </tbody>
</table>
<br>
<br>
</body>
</html>

Messung V0.5
C=96 H=98 G=96

¤ Dauer der Verarbeitung: 0.11 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.