'R - mclapply takes more processors than it should and is slower

I am trying to fix an issue that I came across in one of my lab servers. When I use mclapply on server A using 30 processors it behaves as expected: https://user-images.githubusercontent.com/26927889/167973438-55f5c60c-b8ba-45b9-a31f-b17004a79e45.png

Then when switching to server B using just 5 processors: https://user-images.githubusercontent.com/26927889/167973523-d705d66f-4721-4436-a0bf-54a2ee466bcc.png

The code I am using is kinda long, but I launch mclapply in this way:

mclapply(1:length(peak.list), function(x) GLM(gene,x), mc.cores = 5)

I have no idea why server B behaves like that, it is using more processors than I ask and going way slower.

I tried to detectCores(logical = FALSE) or detectCores() and the answer is always 80 cores.

Ideas? What should I check?!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source