RcppML icon indicating copy to clipboard operation
RcppML copied to clipboard

nmf() and mclapply

Open sup27606 opened this issue 11 months ago • 2 comments

Dear developer, Thank you for this great package and fast NMF implementation.

I am reporting an issue that I am facing while running the nmf() function in conjunction with mclapply.

When I try to run nmf() within mclapply, all cores go 100% indefinitely and never finishes. I wonder if there's a conflict between nmf's internal parallelization and that from mclapply. I invoke setRcppMLthreads(1) within mclapply before running nmf().

Also, this behavior appeared recently when I updated the RcppML package. In a previous version of the package (one where output of the nmf() used to be a class object instead of a list), there were no issues with running within mclapply.

I am running this on a single node of a linux cluster (Intel Xeon cpu with 28 cores). Here's a sample code:

nmf_obj_list = mclapply(rep(10, 28), function(k) { setRcppMLthreads(1) temp = RcppML::nmf(nmf_input, k, maxit = 1e6, verbose = F) temp }, mc.cores = 28)

nmf_input is a matrix of dimensions 9622 x 200. RcppML version is 0.5.6.

Thanks in advance for your advice.

sup27606 avatar Jan 07 '25 20:01 sup27606