Parallel calculations in Mathematica

In summary, the speaker is looking for ways to optimize time expenditure on a calculation by computing parts in parallel. The parts in question are lists of complex values that come in chunks and are needed for another time consuming computation. The speaker is seeking advice on how to direct evaluations to specific kernels for efficient processing.
  • #1
Inve
8
0
Hello PF.
I wanted to optimize time expenditure on some calculation that I'm doing. A natural way to do this can be by computing parts in parallel.

Now when I say "parts" I don't mean that some computations are wholly independent of other computations. My situation is that I have a bunch of solutions given from NDSolve from which I sample some data (I get a list of complex values).
This list of complex values is something I need for another time consuming computation - but that is all I need from the NDSolve solutions.

Now these lists of complex values comes available in chunks and so I should be able to start the other computation with these values at hand and further wait for the next batch of complex values to continue.

I am here wondering how I can direct evaluations to specific kernels. So that when a chunk of values are obtained on one kernel, this is distributed to the other (second) kernel which starts when this input is given. The second kernel then waits for another chunk of data, and so on..

Someone got any ideas on this matter? Or maybe a better way to do it? (I was considering just 'parallelize' but I don't know if the second calculation will be done "properly", etc).

Thanks in advance :)
 
Physics news on Phys.org
  • #2
The lists of complex values and the other time consuming computation are not parallel, they are serial. You say that the lists of complex values come in chunks and that you can start the other time consuming computation on a chunk. So your parallel element is your chunks. The easiest way to parallelize then would be to do a Table of chunks and run Parallelize across that.
 

1. What is the purpose of using parallel calculations in Mathematica?

Parallel calculations in Mathematica allow for faster execution of complex tasks by distributing the workload among multiple processors or computing cores. This can greatly reduce the time needed to complete computations and improve overall efficiency.

2. How can I set up parallel calculations in Mathematica?

To set up parallel calculations in Mathematica, you will need to first ensure that you have a multi-core processor or access to a computing cluster. Then, you can use the Parallel Computing Toolkit to initialize and configure the parallel environment, and use the Parallelize function to distribute the computations across multiple processors.

3. Are all Mathematica functions compatible with parallel calculations?

No, not all Mathematica functions are compatible with parallel calculations. Some functions, such as those that are inherently sequential or involve user interface elements, cannot be parallelized. It is important to check the documentation for each function to determine if it can be used in parallel.

4. Can I monitor the progress of parallel calculations in Mathematica?

Yes, you can use the ParallelSubmit and WaitAll functions to monitor the progress of parallel calculations in Mathematica. These functions allow you to track the status and results of individual parallel tasks, and ensure that all tasks are completed before proceeding with the next step in your computation.

5. Are there any limitations to using parallel calculations in Mathematica?

Yes, there are some limitations to using parallel calculations in Mathematica. These include the need for a multi-core processor or access to a computing cluster, as well as the potential for increased memory usage and the potential for race conditions or other errors if not properly implemented. It is important to carefully consider the trade-offs and potential challenges before implementing parallel calculations in Mathematica.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
261
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
18
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
14
Views
8K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
9
Views
1K
Back
Top