Thread-safe reproject with ThreadFunctors#288
Merged
Conversation
asinghvi17
reviewed
Apr 10, 2025
Member
|
Lol - I had a very similar approach, including an equivalent of the ApplyToN wrapper, but using TaskLocalValues.jl. But if we never reuse the value in a task then we don't need that package. My struct was a bit different: struct KnownInputDimTransformation{Z, M, T}
transf::T
end
function KnownInputDimTransformation{Z, M}(transf::T) where {Z, M, T}
KnownInputDimTransformation{Z, M, T}(transf)
end
function (t::KnownInputDimTransformation{Z, M, T})(p) where {Z, M, T}
if Z
return t.transf(GI.x(p), GI.y(p), GI.z(p))
else
return t.transf(GI.x(p), GI.y(p))
end
endcurrently does not handle Z and M but could be trivially extended to handle those and add default values if we want. |
Member
|
Boom julia> @be GO.reproject($mpolys, $trans)
Benchmark: 13 samples with 1 evaluation
min 7.543 ms (75012 allocs: 3.300 MiB)
median 7.617 ms (75012 allocs: 3.300 MiB)
mean 7.975 ms (75012 allocs: 3.300 MiB, 2.72% gc time)
max 11.873 ms (75012 allocs: 3.300 MiB, 35.34% gc time)
julia> @be GO.reproject($mpolys, $trans; threaded = true)
Benchmark: 45 samples with 1 evaluation
min 1.934 ms (75275 allocs: 3.496 MiB)
median 1.970 ms (75275 allocs: 3.496 MiB)
mean 2.229 ms (75275 allocs: 3.496 MiB, 5.59% gc time)
max 6.006 ms (75275 allocs: 3.496 MiB, 65.74% gc time) |
with a custom applicator. Maybe we need a formalized interface for applicators.
rafaqz
commented
Apr 10, 2025
asinghvi17
reviewed
Apr 11, 2025
6a09651 to
080d3b6
Compare
This was referenced Apr 16, 2025
Merged
asinghvi17
referenced
this pull request
Apr 17, 2025
* using GOCore * Fix errors found in docs * Set the current module in the Literate source This way, docstrings are resolved respective to where the page is. * add TGGeometry to docs project * Update docs/src/api.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Havent run this yet, but should be close to working.
@asinghvi17 turns out it needs 2 layers of functors to deal with
is3dDiscussed in #287
Changelog:
applypipeline to get rid of closures in favour ofApplicators, which are able to runapplyon arrays, geoms and featurecollections.TaskFunctorsstruct that allows one to use individual functors per task. This allows thread safety for reentrant C APIs.reproject, in the Proj backend, to use this functionality