pfnet-research / menoh

Menoh: fast DNN inference library with multiple programming language support
MIT License
279 stars 34 forks source link

Feature Request: function for interrupting menoh_model_run() #160

Open msakai opened 6 years ago

msakai commented 6 years ago

Because menoh_model_run() can take long time, it is desirable to have a function for canceling the computation from other threads.

In Ruby binding, I'm trying to release the GVL (giant VM lock, aka GIL or global interpreter lock) while executing menoh_model_run() in this PR. But doing so requires to pass a function to cancel the execution safely. If I don't pass proper function, the program will not respond for Control+C or other shutdown events. (see https://github.com/ruby/ruby/blob/v2_5_3/thread.c#L1367-L1451 for detail)

I don't know the cases of other languages with GVL (e.g CPython). But other such language may suffer the same issue.