PixInsight Forum (historical)
Software Development => PCL and PJSR Development => Topic started by: robyx 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,
Robyx
-
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:
https://gitlab.com/pixinsight/PCL
https://pixinsight.com/developer/pcl/doc/html/