Compute translation_classes_data if not given#117
Conversation
2fde1ff to
aa51f8d
Compare
|
Thx! |
sumpy/fmm.py
Outdated
| with cl.CommandQueue(self.tree_indep.cl_context) as queue: | ||
| translation_classes_data = SumpyTranslationClassesData(queue, | ||
| self.traversal) |
There was a problem hiding this comment.
Why does this work? Doesn't the queue get destroyed when it exits the context manager leaving SumpyTranslationClassesData holding an invalid reference?
There was a problem hiding this comment.
Yes, the queue completes and gets destroyed, but the data itself doesn't get destroyed. i.e. the data has queue=None. When a new queue needs this data, they are accessed with .with_queue(queue)
There was a problem hiding this comment.
Lines 244 to 249 in a2c830a
Hm, but the constructor doesn't do any work. The actual work is being done when calling some of those memoized methods below, which should be after the context manager exits.
There was a problem hiding this comment.
The tests don't seem to crash and burn, so this is probably just some misunderstanding on my side. Hm..
There was a problem hiding this comment.
Hmm, you are right. I guess since the constructor keeps a reference to the queue, it doesn't get destroyed.
There was a problem hiding this comment.
I'll try to come up with a way to make PyOpenCL warn if a reference to the queue continues to be held past __exit__.
There was a problem hiding this comment.
That would be really cool!
There was a problem hiding this comment.
I changed the implementation to build the data objects eagerly instead of lazily.
There was a problem hiding this comment.
Can't speak for the eager vs lazy, but the queue stuff makes sense to me now 👍
|
LGTM, thanks! |
Adds a
_disable_translation_classeshidden option so that we can check the non translation classes kernel.