RcppParallel compatability with checkUserInterrupt and Rcout #43
Unanswered
andrewmarx
asked this question in
Q&A
Replies: 1 comment 1 reply
-
Hi! (Converted this to a discussion. Have no experience with it so far, but sounds like a good idea 😉) Both To prevent R from crashing, RcppThread ensures that communication with R only happens from the main thread. In short, this is what happens:
The caveat is that the functions are useless if never called from the main thread. If I recall correctly, RcppParallel's functions always do some chunk of the work in the main thread, so this should be fine. You'll find out quickly by running a simple multithreaded example. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I was wondering if RcppThread's
checkUserInterrupt()
andRcout
are considered safe to use in RcppParallel's threads? Apparently there is one user doing this (RcppCore/RcppParallel#65), but I'd like to confirm they aren't just getting lucky. It's pretty essential functionality for me; even with multithreading, a lot of people using my package will want to have runs that take weeks or months, so I need to be able to give them progress updates and the ability to quit early.On a side note, have you considered enabling Github's new Discussions feature for this repo? It would be a better place for questions like mine.
Beta Was this translation helpful? Give feedback.
All reactions