Page 1 of 1

Parallelization

Posted: Sun Nov 24, 2013 11:48 am
by diereinegier
Is there any chance to parallelize computations over a cluster of Pis from within mathematica?

I see that parallelization on the same machine is built into Mathematica (to a certain extent) and can be extended by buying a bigger license.

But parallelization across machines requires "GridMathematica" which is not part of the base product and of course not part of the Pi edition.

Did anybody make distributed computing work using bare Mathematica?

Re: Parallelization

Posted: Thu Nov 28, 2013 4:30 am
by madler
It looks like there is something there. If someone tries it, please let us know how that goes.

http://reference.wolfram.com/language/r ... ation.html

Re: Parallelization

Posted: Tue May 20, 2014 6:13 pm
by drxenocide
From the link you gave it says:

"To add kernels through Lightweight Grid, first install gridMathematica with Lightweight Grid on the computers you want to use."

It seems ot me that the Mathematica on the RPi is stripped down (no offline manual - no parallel processing) and I get the feeling that Wolfram looks at the Pi lincenses as trial versions - to get people to say - "You know, Mathematica is pretty cool, it might be worth it to pay Wolfram to install this on a real computer."

Re: Parallelization

Posted: Wed Jun 04, 2014 2:29 am
by szhorvat
I do not have multiple Raspberry Pis to test, but based on my experience with the desktop version of Mathematica I am fairly confident that this is possible. I typed up half an answer here, but after a browser crash and a malfunction of this forum's save draft feature I lost it. So here's a shortened version:

1. Decide which machines are going to be the slaves and which is the master. Use the same username on all of them for convenience (not a necessity). Set up passwordless authentication on all the slaves. Now it must be possible to execute any command on a machine named slave1 by typing

ssh slave1 command

on the master.

2. On the master start Mathematica and do:

Code: Select all

Block[{$ContextPath}, Needs["SubKernels`RemoteKernels`"]]

math = FileNameJoin[{$InstallationDirectory, "bin", "wolfram"}]

piKernel[host_String]:=
  SubKernels`RemoteKernels`RemoteMachine[
    host,
    "ssh -f `1` \"" <> math <> " -mathlink -linkmode Connect `4` -linkname '`2`' -subkernel -noinit > /dev/null 2>&1 &\"",
    1]

hosts = {"slave1", "slave2", ...}; (* hostnames of all slaves *)

$ConfiguredKernels = Join[$ConfiguredKernels, piKernel @@@ hosts]
Keep in mind that this is untested and I may have missed some details. If it works, it should be possible to simply LaunchKernels[], then use e.g. ParallelTable.

Hope this helps.

Re: Parallelization

Posted: Wed Jun 04, 2014 2:37 am
by szhorvat
drxenocide wrote:From the link you gave it says:

"To add kernels through Lightweight Grid, first install gridMathematica with Lightweight Grid on the computers you want to use."

It seems ot me that the Mathematica on the RPi is stripped down (no offline manual - no parallel processing) and I get the feeling that Wolfram looks at the Pi lincenses as trial versions - to get people to say - "You know, Mathematica is pretty cool, it might be worth it to pay Wolfram to install this on a real computer."
So far everything I tried worked fine, and Mathematica looks to be just as full featured (including parallelization) on the RPi as it is on the desktop. The Lightweight Grid is just a convenience feature, and is by no means necessary for parallelization. It is not included with a standard Mathematica license on the desktop either.

Regarding the lack of offline documentation: documentation is what makes Mathematica take up more than 3 GB on the desktop. It was a very reasonable decision to omit it on the RPi, especially considering the lagginess of the front end. You'd end up reading it online anyway.