You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the neural network framework I'm writing, explicitly freeing MemObjects isn't really practical.
I've tried storing the MemObject in an MVar and attaching a finalizer to that, but these finalizers aren't guaranteed to run promptly, and often didn't run at all, which would eventually result in running out of gpu resources (I'm actually not sure if this is a ghc bug -- what's the point of having finalizers at all if they can legally be thrown away?).
Foreign.ForeignPtr C finalizers (FinalizerPtr) areguaranteed to run promptly, but unfortunately I can't use these since the Ptr inside of MemObject isn't exposed. I've hacked it at the moment by making a local version of hopencl exporting ClMem, CMem and the MemObject constructor. But it would be nice to have some kind of official support.
Also, maybe we would consider using FinalizerPtr for the other types? Promptly released resources are always good, if less critical for things like CommandQueues and Contexts that are less frequently created and destroyed.
The text was updated successfully, but these errors were encountered:
In the neural network framework I'm writing, explicitly freeing MemObjects isn't really practical.
I've tried storing the MemObject in an MVar and attaching a finalizer to that, but these finalizers aren't guaranteed to run promptly, and often didn't run at all, which would eventually result in running out of gpu resources (I'm actually not sure if this is a ghc bug -- what's the point of having finalizers at all if they can legally be thrown away?).
Foreign.ForeignPtr C finalizers (FinalizerPtr) are guaranteed to run promptly, but unfortunately I can't use these since the Ptr inside of MemObject isn't exposed. I've hacked it at the moment by making a local version of hopencl exporting ClMem, CMem and the MemObject constructor. But it would be nice to have some kind of official support.
Also, maybe we would consider using FinalizerPtr for the other types? Promptly released resources are always good, if less critical for things like CommandQueues and Contexts that are less frequently created and destroyed.
The text was updated successfully, but these errors were encountered: