User avatar
diereinegier
Posts: 166
Joined: Sun Dec 30, 2012 5:45 pm
Location: Bonn, Germany
Contact: Website

Parallelization

Sun Nov 24, 2013 11:48 am

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?
Download my repositories at https://github.com/GeorgBisseling

User avatar
madler
Posts: 7
Joined: Thu Nov 28, 2013 3:58 am

Re: Parallelization

Thu Nov 28, 2013 4:30 am

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

User avatar
drxenocide
Posts: 10
Joined: Mon May 19, 2014 11:52 am
Location: College Park, MD, USA

Re: Parallelization

Tue May 20, 2014 6:13 pm

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."
"I don't mean to discourage people from trying Linux, but telling you that your experience with Linux will be frustration-free and rosy would be like selling you Mario Brothers with Dark Souls: Prepare to Die Edition actually in the case."

szhorvat
Posts: 28
Joined: Wed Jun 04, 2014 2:07 am

Re: Parallelization

Wed Jun 04, 2014 2:29 am

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.

szhorvat
Posts: 28
Joined: Wed Jun 04, 2014 2:07 am

Re: Parallelization

Wed Jun 04, 2014 2:37 am

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.

Return to “Mathematica”