[PROJ] Call PROJ in OpenMP

José Luis García Pallero jgpallero at gmail.com
Sun Mar 21 13:31:15 PDT 2021


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!
*****************************************


More information about the PROJ mailing list