You are here

How can you tell if OpenMx is using multiple cores?

4 posts / 0 new
Last post
rabil's picture
Offline
Joined: 01/14/2010 - 16:47
How can you tell if OpenMx is using multiple cores?

I'm running OpenMx on 4 different computers running Ubuntu 15.04 and the latest version of OpenMx and current versions of R. On one, when look at the output for htop, it seems clear that all 4 cores are being used by OpenMx. Yet on two of the others, htop seems to indicate that not all 4 cores are being used simultaneously and the same model takes 2 to 3 times longer to run. I've tried using the suggestion to tell OpenMx to use more threads - but this seems to have no effect and I never had to do this on the computer that seems to be using all 4 cores and runs the model much more quickly. I don't think its processing power is greater than the other computers. When I used to install OpenMx, it seemed that it asked you if you wanted parallel processing enabled. But lately it no longer asks.

tbates's picture
Offline
Joined: 07/31/2009 - 14:25
source for multicore on mac (thought *nix always was multi?)

I wonder if one of the machines has a CRAN version, and the (multicore) versions are from

source('http://openmx.psyc.virginia.edu/getOpenMx.R')

FYI, umx supports a method to check core usage effects fairly easily:

library(umx)
umx_check_parallel()
# You are using 0 of 4 available cores (0 means max - 1)
# I will now set cores to 4 (they will be reset after) and run a script that hits multiple cores if possible.
# Check CPU while it's running and see if R is pegging the processor.
# Running threeLatentWithModerator with 32 parameters
threeLatentWithModerator: 01 minute,  58.30 seconds

This will let you also experiment with different core numbers (parameter to function, defaults to -1)

Watch an activity monitor and see if the usage goes to 200 or 400% etc.

umx_check_parallel() will also return the timing, so you can do

umx_check_parallel(8)
umx_check_parallel(4)
AdminRobK's picture
Offline
Joined: 01/24/2014 - 12:15
R running under Linux always

R running under Linux always installs packages by building them from source. For Linux, it should be possible to install with multithreading whether the source tarball came from CRAN or from virginia.edu .

AdminRobK's picture
Offline
Joined: 01/24/2014 - 12:15
It certainly sounds to me

It certainly sounds to me that you're correct about OpenMx not running in parallel on that one system. My guess is that the compiler isn't getting the flags it needs (-fopenmp, at the very least) to compile with multithreading. My guess is that your best bet is to try adding those flags in the appropriate part of R's Makeconf, assuming you're authorized to edit it on that system. Failing that, you could maybe try adding the flags to OpenMx's src/Makevars.in .

Someone who installs OpenMx under Linux more frequently than I do might have better advice.