glmmTMB, OpenMP and Ubuntu
[keeping r-sig-mixed-models in Cc]
Don't know exactly how TMB::openmp() works ... ?
The way I would check if it's running is to see what happens to CPU
load when you run your model ...
On 9/7/20 5:02 PM, mega-x at gmx.net wrote:
Dear Ben, thank you for your quick response. I am still not sure if OpenMP is actually running. The command TMB::openmp() detects all 8 cores on my Linux Server. However, it also detects all 4 cores of my personal Windows machine that definitely does not support OpenMP.
The wording in the vignette sounded like you actively have to do something
with your R installation. Your comment suggest that OpenMP is already part
of the OS? I am still very confused here.
I am detecting a very slight improvement by switching from 1 to 8 cores on
my Linux system (using the code of the vignette). I will do some more
testing today including running the same model on a 96 cores cluster.
Cheers,
Xaver
-----Original Message-----
From: R-sig-mixed-models <r-sig-mixed-models-bounces at r-project.org> On
Behalf Of Ben Bolker
Sent: Montag, 7. September 2020 20:48
To: r-sig-mixed-models at r-project.org
Subject: Re: [R-sig-ME] glmmTMB, OpenMP and Ubuntu
Try running TMB::openmp() . If you already have R installed with OpenMP
support, that should tell you how many cores OpenMP is configured to run
with.
In general R automatically gets built with OpenMP support if a given
OS/compiler combination supports it; I don't know much about how to
troubleshoot that if it *doesn't* happen automatically, but there seems to
be a little information here
https://cran.r-project.org/web/packages/ProFit/vignettes/ProFit-OpenCL-OpenM
P.html
After it's installed, you could try running some fairly big models with
glmmTMB(..., control=glmmTMBControl(parallel=xx)) where xx is either 1 or >1
(NULL, the default, automatically sets the max number of OpenMP threads to
the number of available cores on my machine). Use
system.time() to check the elapsed time (if you want to be more systematic
and your examples are fast enough to run several times, you can use one of
the available R benchmarking package). I would also suggest using 'top' or
some system monitoring GUI to check the CPU load while your job is running
... the expectation is that the CPU % listed for your R process will reflect
the number of OpenMP threads being used.
If you encounter anything particularly interesting you could report it at
https://github.com/glmmTMB/glmmTMB/issues/620 ...
On 9/7/20 5:56 AM, mega-x at gmx.net wrote:
Dear all, I am currently fitting a complex model with glmmTMB that involves random effects and covariance structures (spatiotemporal autocorrelation). I
would
like to try the experimental parallel optimization feature <https://cran.r-project.org/web/packages/glmmTMB/vignettes/parallel.html> to reduce computation time. To do this I've setup a virtual machine
running
Ubuntu 20.04 on 16+ cores. However, I found no information in how to setup OpenMP, R and glmmTMB. Is there a step by step guide that I can follow? The Vignette states the following: "If your OS supports OpenMP parallelization and R was installed using OpenMP, glmmTMB will automatically pick up the OpenMP flags from R's Makevars and compile the C++ model with OpenMP support." I was not able to find any information on how to install R using OpenMP. Best, Xaver [[alternative HTML version deleted]]
_______________________________________________ R-sig-mixed-models at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
_______________________________________________ R-sig-mixed-models at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models