Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: How to local files on ParallelKernels

  • To: mathgroup at smc.vnet.net
  • Subject: [mg116794] Re: How to local files on ParallelKernels
  • From: nsonmez <nasufsonmez at gmail.com>
  • Date: Mon, 28 Feb 2011 05:01:10 -0500 (EST)
  • References: <ikan3k$cej$1@smc.vnet.net>

On Feb 26, 5:10 am, Daniel Chisholm <d... at danielchisholm.com> wrote:
> The remote machine will not have any direct access to the files on the local
> machine.  So avoid the route of having the remote machine send it's output
> to a file.
>
> There's no need to copy and paste text from the originating notebook though.
>  Note that the ParallelTable returns a list.  Record that result, then write
> it out to a file, like this:
>
> allresults = ParallelTable[
>   {
>    start = AbsoluteTime[];
>    res = NIntegrate[
>      int = dsigmapdf[theta, 14000^2, a Pi/10, 11], {theta, 0, Pi}];
>    Print[a, " :  ", N[AbsoluteTime[] - start, 4], " seconds . . . ",
>     int];
>    {a Pi/10, res} (* this is the return value of one calc'n*)
>    }
>   , {a, 0, 4}
>   ]
>
> (*now write "allresults" to an output file*)
> (*Probably more convenient to write each result independently, like this:*)
>
> PutAppend[#, "xsection.txt"] & /@ allresults
>
> --
> - Daniel
> Fredericton, NB  Canada



Hi Daniel,

Thank you for your valuable reply. The solution I was looking for is
the one you suggested. You know I already had tried ParallelTable but
some how it didn't work at the time. Then I just noticed in your code
that you don't end this line {a Pi/10, res} with a semicolon. If you
did end it with a semicolon you wouldn't have the results from all
kernels as a table assigned to allresults, but Null. You simply define
the return value of every loop, and Table does the rest. :) Well It
worked, thanx again.

Sincerely,

Nasuf


  • Prev by Date: Re: NIntegrate and speed
  • Next by Date: Re: Filtering data from numerical minimization
  • Previous by thread: Re: How to local files on ParallelKernels
  • Next by thread: Re: How to local files on ParallelKernels