Author Topic: PJSR Parallel execution  (Read 321 times)

Offline robyx

  • Newcomer
  • Posts: 42
    • View Profile
PJSR Parallel execution
« on: 2019 October 12 15:32:23 »
Hi all again :)

Is there the possibility to create a parallel for or a pull of threads to execute parallel operations? In my specific case I need to compute the gradient of a multivariable function which is done by computing the discrete partial difference of the cost function on each variable. This would be the perfect case to execute each computation in parallel.

Thanks in advance,

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7027
    • View Profile
Re: PJSR Parallel execution
« Reply #1 on: 2019 October 13 13:01:37 »
Hi Robyx,

The JavaScript runtime does not provide resources to implement parallel operations. Most native procedures available in PJSR are implemented as parallel processes. For example, when you run something like this:

let image = new Image;
image.convolve( Matrix.gaussianFilterBySize( 25 ) );

The Image.convolve method is executed using all logical processors available. There are hundreds of native methods implemented this way. However, there is no way to define a parallel process using pure JavaScript code.

For the types of tasks you are performing, you should use our C++ development platform instead of JavaScript. Take a look at our PixInsight Class Library:
Juan Conejero
PixInsight Development Team