Tag Info

Hot answers tagged

7

It's straightforward for simple cases! Just as @Yves Klett commented: f[a_, b_: 1] := (Pause[.3]; a + b) (* List of arguments to be passed for each job *) jobs = {{0}, {1}, {0, 3}, {2, 2}} Map[f @@ # &, jobs] // AbsoluteTiming (* {1.205, {1,2,3,4}} *) ParallelMap[f @@ # &, jobs] // AbsoluteTiming (* {0.309, {1,2,3,4}} *)


6

No, Listable has nothing to do with parallelization, as done by the Parallel Computing Tools. There is one exception: Compiled functions that have both RuntimeAttribtues -> {Listable} and Parallelization -> True set can run in parallel when threaded over a list. This is specific to compiled functions and is described in the Compile documentation ...


5

Having convinced our SysAdmin to grant me access to one compute node by VPN, I managed to connect to one compute node (b1) using the following parameters in the KernelConfiguration submenu in the Evaluation menu. Note that I added both to MLOpen and to Launch command the extra parameter -Linkhost xxx.xxx.xxx.xxx where xxx.xxx.xxx.xxx is the ...


4

As Yves said replace Print with List output. Here is an example using Sow and Reap along with Block and Mathematica 10 notation for Composition. (It would be better to avoid Print from the beginning but I am trying to make this an easy substitution for you.) myfun[x_, y_: 0] := Block[{ans, myplot, summary, Print = Sow@*Row@*List}, Print["The first ...


3

Aisamu's solution is clean, and is what I'd recommend for a bigger project or if you do this a lot. But for a quick and dirty solution, the following works well: Parallelize[{expr1, expr2, expr4, ...}] expr1, expr2, etc. will be evaluated on separate kernels. Demonstration: Parallelize[{$KernelID, $KernelID, $KernelID}] (* {4, 3, 2} *)


2

As I commented earlier, with a notebook configured as in your question, I obtain your first answer with MMA V10 and your second answer with MMA V9. Evidently, Wolfram Inc identified the V9 behavior as a problem and fixed it in V10. Since the problem occurs for ToExpression run in ParallelTable, perhaps ToExpression[ParallelTable["b" <> ToString[j], ...


1

I just cleaned up your code a little, added a Print command and lowered the maximum value of the iterators: ParallelDo[ a = Table[i + j, {i, 1.0, 100.0}, {j, 1.0, 100.0}]; Do[b = a.a; Print["Kernel ", $KernelID, ", iterator1 ", iterator1, ", iterator2 ", iterator2]; c = If[Tr[b] > 2000, b = a, Break[]], {iterator1, 1, 2} ], ...


1

This isn't a perfect solution either, but it's an improvement on your solution 2: Use ParallelSubmit and WaitNext for parallelization. Documentation is here and here. With this method it is not necessary to collect all results to the main kernel first, and export them only afterwards. You'll be able to collect one result, save it, collect the next, save ...



Only top voted, non community-wiki answers of a minimum length are eligible