Comments (7)
Very sorry for the delay in replying here! I am finally getting close to caught up on things.
All in all, sounds like a very good idea!
My main question is: Is there a role for Function
s which are not Threadable
? My understanding from before was that you would make something a Function
specifically so that it could be used in a multi-threaded way. What are the exceptions to this assumption?
If there are no exceptions, we could make Function
itself extend Threadable
(and AbstractFunction
implement the Threadable
API as you suggest) so that individual function implementations do not need to worry about it.
As an aside: adding an AbstractThreadable
which provides a default getIndependentInstance()
implementation would be quite easy: use reflection to copy all @Parameter
field references. This would be sufficient as long as a deep copy of any parameter is not needed...
If there are potential exceptions to the "functions are threadable" rule, then I guess it's OK to have ThreadableFunction
and ThreadableInPlaceFunction
, since it provides flexibility (at the expense of names getting longer again).
For your example of Map
as a Function
which is not Threadable
... is there some other reason that Map
needs to be a Function
at all, then? (I'm tired and not looking at the code right now, so apologies if this is obvious.) Because if there is no other value to Map
being a Function
, we could just stop implementing that interface and also clarify things the same way (i.e., not "nest the multi-threading too much" as you say).
from imagej-ops.
@ctrueden I like the idea of making it easier for developers by making Function
s extend Threadable
.
Not so sure about the default implementation of getIndependentInstance()
... do we really want to copy all @Parameter
-annotated fields? I thought that the point was more that internal state is copied into a new instance, but that the parameters are then filled in in the individual threads?
from imagej-ops.
FYI, I'll make a first effort at adding the Threadable
interface either tonight or tomorrow.
from imagej-ops.
@dietzc: Looking at the code now, I see that Map
does not extend Function
anyway, so you can't accidentally "over-parallelize"... can you?
from imagej-ops.
@ctrueden: Yes, this is what I meant! Actually one never can take a mapper, as it is not threadable at all. Like this we can avoid lot of nested multi-threading (which is nice). About the function: you are right. we can do this. I tried to think of a function which is not Threadable, but I can't think of one. So I think it's ok to let Function extend Threadable.
Thank you for taking care of this!
Christian
from imagej-ops.
This issue is resolved as soon as PR #13 is reviewed and merged!
from imagej-ops.
We merged it today, and released OPS 0.1.0!
from imagej-ops.
Related Issues (20)
- Median not returning mean of two middle values for even number of values HOT 8
- Add stats.mode op to compute modal value
- Confusing behavior for histogram HOT 2
- Quesrtion: Sobel filter HOT 3
- SobelRAI derivativeComputer array error prone if dimension mismatch HOT 5
- AbstractPadAndFFTFilter overrides OutOfBoundsFactory parameter of PadAndConvolveFFTF HOT 7
- Ops filter gauss does not respect the image dimensions HOT 1
- JOML version from parent pom conflicts with current scenery/sciview
- Repeated computation of co-occurrence matrix in haralick features
- Yen threshold differs from IJ1 HOT 4
- Fractal Dimension creates thousands of zombie threads that crash ImageJ HOT 4
- filter/addPoissonNoise hangs up with large pixel values
- Size inconsistencies for Polygon2Ds HOT 2
- Improve OpSearchResult to give limited type information in stringified op HOT 2
- OpListings ignore preallocated outputs
- DefaultGaussRAI.compute() reports cryptic IAE for sigma dimension mismatch HOT 1
- ClassCastException from ConstantToIIOutputII
- OpSearcher reduces OpListings too eagerly HOT 3
- CreateOutputFFTMethods requires a image creator that can take an ImgFactory HOT 1
- FrangiVesselness: Auto-fill the spacing field
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from imagej-ops.