Go up to 2 Examples Go forward to 2.2 Distributed Factorization of Integers |
![]() |
The below excerpt from a Mathematica notebook shows the use of the system, by a simple example:
In[1]:=<< dist.m Distributed Mathematica V1.0.0 (c) 2000 Cleopatra Pau (RISC-Linz) See http://www.risc.uni-linz.ac.at/software/distmath In[2]:=InitializeD[{{deneb,solaris},{milkyway,octane}}] Connecting deneb... Connecting milkyway... Out[2]=okay In[3]:=t1=StartD["Integrate[x^n,x]"] Out[3]=0 In[4]:=t2=StartD["Integrate[x^n,n]"] Out[4]=1 In[5]:=WaitD[t1]+WaitD[t2] x^(1 + n) x^n Out[5]=--------- + ------ 1 + n Log[x] In[6]:=TerminateD[] Out[6]=okay
In this example, we first load the package dist.m
, which prints
a copyright message. Then the distributed session is initialized, by
the call of InitializeD
with a list argument that tells the
system to connect to the local kernel other two kernels, one on the
machine deneb
of type solaris
, the other on the machine
milkyway
of type octane. After the connection is
established successfully, we create two tasks, by using the StartD function. The first task evaluates Integrate[xn,
x], and it gets the id 0, while the second task evaluates Integrate[xn, n], and it gets the id 1. The next input calls WaitD, once for each task. For each call, the execution of the
current kernel is blocked, until it gets the corresponding
result. After we get the result, we close the distributed system, by
the call of TerminateD.