Search
Question: how to specify the number of cores used by IHW
1
8 months ago by
csoneson20
Switzerland
csoneson20 wrote:

Hi,

when I run IHW on our server it uses lots of computational resources (at least 20 cores). I can't seem to find any way to modify this in the call to ihw(). Is there a way to reduce the number of cores used by IHW?

Thanks!

Example code (from the IHW package) and session info:

library(IHW)
X <- runif(20000, min=0, max=2.5)
H <- rbinom(20000,1,0.1)
Z <- rnorm(20000, H*X)
pvalue <- 1-pnorm(Z)
ihw_fdr <- ihw(pvalue, X, .1)

R version 3.4.0 (2017-04-21)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 14.04.5 LTS

Matrix products: default
BLAS: /usr/local/R/R-3.4.0/lib/libRblas.so
LAPACK: /usr/local/R/R-3.4.0/lib/libRlapack.so

locale:
[1] LC_CTYPE=en_CA.UTF-8       LC_NUMERIC=C
[3] LC_TIME=en_CA.UTF-8        LC_COLLATE=en_CA.UTF-8
[5] LC_MONETARY=en_CA.UTF-8    LC_MESSAGES=en_CA.UTF-8
[7] LC_PAPER=en_CA.UTF-8       LC_NAME=C
[11] LC_MEASUREMENT=en_CA.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] IHW_1.4.0

loaded via a namespace (and not attached):
[1] compiler_3.4.0      parallel_3.4.0      slam_0.1-40
[4] fdrtool_1.2.15      BiocGenerics_0.22.0 lpsymphony_1.4.1

modified 8 months ago by vladislav.kim10 • written 8 months ago by csoneson20
1
8 months ago by
Germany

Hi Charlotte,

I assume this problem arises because of the lpsymphony package, on which IHW depends. On Linux machines SYMPHONY is built with '--enable-openmp' flag by default.

I think it is possible to set the number of threads by export OMP_NUM_THREADS=2 (if you want only 2 threads).

Otherwise a quick fix would be to manually change line 62 of the configure script in the lpsymphony package from OMP_FLAG="--enable-openmp" to OMP_FLAG="--disable-openmp" and re-install the package from source. Then the OpenMP multithread functionality is disabled. Apologies for the inconvenience and let me know if this has worked.

thanks for your reply. I tried both your suggestions (I set OMP_FLAG="--disable-openmp" on line 96 in the configure file, my line 62 is about gcc), reinstalled lpsymphony and IHW from source, started new sessions, but unfortunately IHW still uses all the available cores on the machine. I'll try to dig a bit deeper and see if I can figure out what is going wrong.

Thanks

Charlotte