В Mon, 30 Dec 2024 19:16:11 -0800 Ivo Welch <ivo.we...@gmail.com> пишет:
> useless.function <- function( ) { > y <- rnorm(3); x <- rnorm(3) > summary( lm( y ~ x )) ## useless > NULL > } > > run30 <- function(i) { > message("run30=", i) > useless.function() > } > > run30( 0 ) > message("many mc") > simsl <- mclapply( 1:30, run30 ) Thank you for telling us which code you're running that eventually hangs mclapply()! I see that your example involves running lm(), which in turn involves BLAS and LAPACK operations. It could be that when you first run lm() in the parent process, it starts threads that take locks. Later, when mclapply() starts child processes, those threads don't exist there (they stay in the parent process), but the locks remain taken, with no-one to release them - a deadlock. Ironically, using a parallel "socket cluster" (but not "fork cluster") would have avoided the problem by starting a fresh process from scratch, without any inherited locks. It may also be possible to disable the use of parallel threads in your BLAS/LAPACK, but the exact procedure depends on the BLAS. What's your sessionInfo()? If you don't get a good answer here, try r-sig-...@r-project.org. -- Best regards, Ivan ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide https://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.