Running a matrix of integrals in parallel

Click For Summary

Discussion Overview

The discussion revolves around the parallel computation of a matrix of integrals using Mathematica. Participants explore methods to efficiently utilize multiple cores for this task, specifically focusing on the functions ParallelTable and Parallelize.

Discussion Character

  • Technical explanation
  • Debate/contested

Main Points Raised

  • One participant proposes using ParallelTable to compute a matrix of integrals, suggesting it would effectively utilize all 16 cores.
  • Another participant agrees that ParallelTable should be the fastest option but mentions that Parallelize[Table[]] might yield similar results, expressing uncertainty about Mathematica's internal processing.
  • A later reply indicates that the suggested approach did not work as expected, highlighting a lack of understanding regarding Mathematica's internal workings.

Areas of Agreement / Disagreement

Participants generally agree that ParallelTable is a suitable method for parallelizing the computation, but there is uncertainty about its efficiency compared to other methods, and at least one participant reports a failure in implementation.

Contextual Notes

There are unresolved questions about the efficiency of different parallelization methods and the internal mechanics of Mathematica's functions, which may affect performance.

member 428835
Hi PF!

I am trying to computer a matrix of integrals. Think of it something like this:

Code:
Table[Integrate[x^(i*j), {x, 0, 1}], {i, 0, 5}, {j, 0, 5}]

I have 16 cores, and would like to have each core handle a specified amount of integrals. Anyone know how to do this?

Thanks so much!
 
Physics news on Phys.org
DrClaude said:
Thanks! I checked it out and evidently the function ParallelTable is appropriate here. Looks like this:

Code:
ParallelTable[Integrate[x^(i*j), {x, 0, 1}], {i, 0, 5}, {j, 0, 5}]

To your knowledge, is this the most efficient way to parallelize? Seems to use all 16 cores too.
 
I don't program much in Mathematica, but I have used other people's programs. Using ParallelTable in your case should be the fastest option, but it is possible that Parallelize[Table[]] would result in the same (I have stopped trying to figure out how Mathematica deals with things internally; it is quite opaque).
 
DrClaude said:
I don't program much in Mathematica, but I have used other people's programs. Using ParallelTable in your case should be the fastest option, but it is possible that Parallelize[Table[]] would result in the same (I have stopped trying to figure out how Mathematica deals with things internally; it is quite opaque).
This actually didn't work, shockingly. Agreed, I don't know what is going on under the Mathematica hood.
 

Similar threads

  • · Replies 13 ·
Replies
13
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
Replies
3
Views
3K