-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Segmentation fault in multithreading setup #50
Comments
@aksarkar I tried your first example with the latest version of Segfaults are difficult to debug. |
Okay I was able to generate a segfault with the following code: library(Matrix)
library(fastTopics)
set.seed(1)
X <- simulate_count_data(80,100,k = 3,sparse = TRUE)$X
X <- X[,colSums(X > 0) > 0]
fit0 <- fit_poisson_nmf(X,k = 3,numiter = 10,method = "em",
init.method = "random")
fit_scd <- fit_poisson_nmf(X,fit0 = fit0,numiter = 10,method = "scd",
control = list(extrapolate = TRUE,nc = 2,
nc.blas = 1),
verbose = "detailed") If I set Also, then rerunning this code in the same session with At this stage, I'm not sure how to debug this — it could be an issue caused by a recent update to one of the Rcpp packages, for example. |
@aksarkar If you get any more potentially useful information about this bug, please post here. |
@pcarbo RcppCore/RcppParallel#110 appears to be relevant |
Interesting discussion, but what I find odd is that the segfault only occurred for me when the input matrix was sparse. |
If I build fastTopics with I also get much faster performance with multiple threads in |
My understanding is that |
If RcppParallel does not use TBB, then it uses TinyThreads instead (https://github.com/RcppCore/RcppParallel/blob/5aa08f8b546d2fa99372d02d7b6a50344fb09ff3/inst/include/RcppParallel.h#L46). TinyThreads uses OS threads and relies on OS scheduling. Another thing I noticed is that almost all of the compute time is spent in apparently serial code running on one core. I think addressing that will address the lack of performance gain I observed. |
The following example leads to a segfault
when run like this
The same occurs for any other choice of
method
. Interestingly, the following example does not:The text was updated successfully, but these errors were encountered: