Mathematica Running a matrix of integrals in parallel

Click For Summary
The discussion revolves around computing a matrix of integrals using Mathematica, specifically the integral of x raised to the power of the product of two indices, i and j, over the interval from 0 to 1. The user seeks to utilize their 16-core processor to handle the computations efficiently. Initially, they consider using the Parallelize function but later discover that ParallelTable is more suitable for their needs. Despite this, the user experiences unexpected issues with the implementation, expressing confusion about Mathematica's internal processing. The consensus is that while ParallelTable is likely the fastest method for parallelization, the user encounters challenges that prevent successful execution.
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
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 5 ·
Replies
5
Views
3K
  • · 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