Skip to content

Try to fix reproject tests #291

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ jobs:
- ubuntu-latest
arch:
- x64
include:
- os: windows-latest
version: '1'
arch: x64
- os: macos-latest
version: '1'
arch: arm64
steps:
- uses: actions/checkout@v2
- uses: julia-actions/cache@v1
Expand Down
14 changes: 9 additions & 5 deletions ext/GeometryOpsProjExt/reproject.jl
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,16 @@ function reproject(geom, transform::Proj.Transformation;
if istrue(threaded)
tasks_per_thread = 2
ntasks = Threads.nthreads() * tasks_per_thread
# Clone the transformation once for each task.
# Currently, these transformations live in the same context, but we will soon
# assign them to per-task contexts.
proj_transforms = [Proj.Transformation(Proj.proj_clone(transform.pj)) for _ in 1:ntasks]

# Construct one context per planned task
contexts = [Proj.proj_context_clone(context) for _ in 1:ntasks]
# Clone the transformation for each context
proj_transforms = [Proj.Transformation(Proj.proj_clone(transform.pj)) for context in contexts]
# Assign the context to the transformation
Proj.proj_assign_context.(getproperty.(proj_transforms, :pj), contexts)
# Assign the context to the transformation. We use `foreach` here
# to avoid generating output where we don't have to.
foreach(Proj.proj_assign_context, getproperty.(proj_transforms, :pj), contexts)

results = if _is3d(geom)
functors = TaskFunctors(WithXYZ.(proj_transforms))
Expand All @@ -67,7 +71,7 @@ function reproject(geom, transform::Proj.Transformation;
apply(functors, GI.PointTrait(), geom; kw1...)
end
# Destroy the temporary threading contexts that we created
Proj.proj_destroy.(contexts)
foreach(Proj.proj_context_destroy, contexts)
# Return the results
return results
else
Expand Down
Loading