[PROJ] Call PROJ in OpenMP

Thomas Knudsen knudsen.thomas at gmail.com
Mon Mar 22 03:32:22 PDT 2021


I'm not totally sure about this, but I *think* you need to instantiate a
separate PJ object for each parallel process.

Otherwise, as far as I can see, any push/pop operations (and potentially
others as well)
may get mixed up between non-synchronous parallel operations.

For simple operations things may work - but don't count on it.


Den søn. 21. mar. 2021 kl. 21.31 skrev José Luis García Pallero <
jgpallero at gmail.com>:

> Hello:
>
> Until now I though (I can't say the reason...) that the function
> proj_trans_generic() worked in parallel, but inspecting the source
> code in 4D_api.cpp that the transformations are done individually
> inside a for loop by calling the function proj_trans(). So the
> question is: which is the correct way to perform a transformation in
> parallel using an OpenMP environment? For example a code such
>
> #pragma omp parallel for default(none) private(i,coord2) shared(n,P,coord1)
> for(i=0;i<n;i++)
> {
>     coord2 = proj_trans(P,PJ_FWD,coord1);
> }
>
> I see in the documentation that for multithreading a context must be
> created as
>
> C = proj_context_create();
>
> ans then the variable C must be used in the projection creation as
>
> P = proj_create(C,parameters);
>
> But it is at this point when i don't understand the use of the
> transformation in OpenMP. Means the creation of the context C that the
> proj_trans() function can be used safely in an OpenMP piece of code
> such as the for loop presented before? Can anyone share an example of
> PROJ in OpenMP?
>
> Thanks
> --
> *****************************************
> José Luis García Pallero
> jgpallero at gmail.com
> (o<
> / / \
> V_/_
> Use Debian GNU/Linux and enjoy!
> *****************************************
> _______________________________________________
> PROJ mailing list
> PROJ at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/proj
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/proj/attachments/20210322/583600d3/attachment.html>


More information about the PROJ mailing list