Tag Info

New answers tagged

6

You can use ParallelTable and generate the SparseArray form the table. f[i_, j_] := i + j; imax = 50; AbsoluteTiming[ M = SparseArray[{}, {imax, imax}]; SetSharedVariable[M]; ParallelDo[If[j < i, M[[i, j]] = f[i, j]], {i, 1, imax}, {j, 1, imax}] ] (*{8.259472, Null}*) AbsoluteTiming[ M2 = SparseArray[Flatten[ParallelTable[{{i, j} -> f[i, j]}, {i, ...


6

With eqn[{k_, r_, H0_, P0_}] := {H'[t] == r (1 - H[t]/k) - d H[t] P[t], P'[t] == -s P[t] + e H[t] P[t], H[0] == H0, P[0] == P0} d = 0.01; s = 0.3; e = 0.02; I would define one simulation as sim := Module[ {k = RandomVariate[NormalDistribution[150, 20]], r = RandomVariate[NormalDistribution[0.4, 0.003]], H0 = RandomVariate[UniformDistribution[{50, ...


1

The answer to my question is based on the answer to How to configure parallel remote kernels in Mathematica?. The solution is: Install Cygwin on the B machine to have ssh. For a password-less access we need to copy the public keys of A to the autorized_keys file in B. In A open Mathematica, go to Preferences->Parallel->Remote Kernels and hit Enable ...


2

The reasons for the change in the behavior of ParallelTable are subtle. The main source of the problem is that in funcB, the argument k_ is not protected with ?NumericQ like this: funcB[t_?NumericQ, k_?NumericQ] := (* a solution *) funcB[t, k] = Exp[NIntegrate[funcA[et, k], {et, tini, t}]] But more on that later. The problem does not appear in the ...


2

You can use Mathematica's parallel tools, which already implement inter-kernel communication. What I show below is not the typical way to use parallelization. I try to follow your requirements more closely. I do strongly recommend you read through the parallelization docs and learn the basics before you use this though. When using the parallelization ...


0

The standard way is to use in the main notebook the DistributeDefinitions[{list of yoyr variables}]command. It will automatically share all mentioned mathematica names and it's content to all kernels. This in turn will make it available in all notebooks related to those kernels. But why do you use some notebooks for parallelization? Any tasks could be run ...



Top 50 recent answers are included