Number of cores/threads during DIABLO analysis

I have tried increasing the number of CPUs used during our DIABLO analysis but the most threads used is 11. We can’t seem to increase it even though our computer has 48 threads available. We’re hoping to decrease the computational time, but we seem to have hit a limit on what the program allows. Any suggestions?

Hi @wanani,

Thanks for using mixOmics and sharing your experience!

I’m assuming you are referring to the tune.block.splsda function is that correct? How many components are you tuning over and how many repeats and folds?

Best,

Al

Al,

Yes, the tune.block.splsda function is currently where most of the computing time sits. We tune 10 components (the optimized ncomp is 8), 4 folds, and 10 repeats. Our hope was that we could quickly play with the design matrix, etc to optimize everything, but it can take upwards of 40 minutes on our computer with >40 threads each time it is run.

Thanks!
Waseem

Hi @wanani,

Thanks for your response.

I made some changes and parallelised the function over the number of repeats which is usually the intensive part, if there’s excess CPU it will parallelise the cross-validations as well. Can you please download the latest GitHub version using the code below and re-run your analyses:

## install devtools if not installed
if (!requireNamespace("devtools", quietly = TRUE))
    install.packages("devtools")
## install mixOmics devel
devtools::install_github("mixOmicsTeam/mixOmics")

I’d appreciate it if you could let us know if the CPU usage increased. It is faster on our datasets but I would be interested to know whether and how much it improves with your datasets.

I look forward to your feedback.

Hi @aljabadi,

The perf function runs much faster now! The odd thing is that the tune.block function now gives me this error
Error in if (cpus < 2) { : argument is of length zero

When I run detect cores, I get 24 on my personal computer. When I run it at work, I get 40. Everything looks okay, so I’m not sure where I am going wrong.

Update: I’ve tried on a few windows based computers and I realized the mclappy is not compatible with the windows platform. I may have to just to wait since there is not an easy way to do parallel work on windows computers in R.

Waseem

I also tried this in Ubuntu and I got the same error.

Hi @wanani,

Please try the following and your problem should be fixed:

## install devtools if not installed
if (!requireNamespace("devtools", quietly = TRUE))
    install.packages("devtools")
## install mixOmics devel
devtools::install_github("mixOmicsTeam/mixOmics", ref = "RELEASE_3_10")

Looking forward to see how it works on your datasets now.

Best

Al

Now I get this error:

You have provided a sequence of keepX of length: 27 for block RBCLectin and 30 for block PlasmaGlycan and 27 for block PlasmaLectin.
This results in 21870 models being fitted for each component and each nrepeat, this may take some time to run, be patient!
Error in checkForRemoteErrors(val) :
one node produced an error: $ operator is invalid for atomic vectors

I tried installing the R “future” package to see if that would fix it, but it still occurs.

I’m also only getting about 4-5 threads being consistently used. A colleague of mine initially tried the devel version when you first made the change and it worked on their Mac. Now the devel version does not work. Not sure if that helps you.

Hi @wanani,

Unfortunately, it’s hard to tell what the cause is without having a reproducible example as the error message is not informative enough.

I can see that your model used 1 repeat and 4 folds. We recommend using much more number of repeats (~ 50 or more) for a robust estimate of error rates. Because of that, the repeat of cross-validation process is prioritised in the allocation of resources and if there are excess CPUs, on non-Windows machines the cross-validation itself is also parallelised, so the usage of resources is bound primarily by nrepeat and then by folds. Therefore, if you increase the number of repeats you’ll start to see the benefits of parallel processing.

I’d appreciate if you could do the following and get back to us:

  • For a test run, run your model with much less number of test.keepX (such as c(5,10) for all), with nrepeat=20 and folds=10 on your machine and see if you encounter the previous error, and if not, how many CPUs are being used.

  • See if your colleague can run on Mac using the latest devel version (just updated) with the mentioned settings, and monitor the use of resources.

Looking forward to your feedback.

Al

Hi Al,

I found my mistake and now everything runs smoothly. The analysis is MUCH faster now. Thank you again for improving the package!

Waseem

I’m glad to hear that Waseem.
Please don’t hesitate to let us know if you run into any issues.

Best,

Al

HI,

I am having the same problem. Could you share how you solved this issue?

Kind regards,
Lonneke Nouwen