Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

running on SLURM with MP and MPI #53

Closed
chillydog opened this issue Oct 29, 2019 · 3 comments
Closed

running on SLURM with MP and MPI #53

chillydog opened this issue Oct 29, 2019 · 3 comments

Comments

@chillydog
Copy link

Hi All,

I have a large data set that kept giving me out of memory errors. So, I've reduced it to 50000 rows by 100 columns (plus response column) for testing on a cluster managed by SLURM to explore if I can break things up among nodes to access more memory (and cores). Incidentally, all variables are 2-level factors with substantial imbalance in the response (output) factor, so I'm using imbalanced.rfsrc.

My R code and my SLURM batch files are below. Basically, I ask for 56 processes over 2 nodes (28 cores each node) as a way to explore if I'm getting the benefit of the memory of 2 nodes (plus the cores); I've asked for a minimum of 128GB each node. I'm wondering if my R code is structured correctly to exploit both the shared memory (MP) and distributed memory (MPI). I get the following output (56 times), which does not look good (indeed my batch job seems to be hanging as I type).

OUTPUT (so far...still running...seems to be hanging):

56 times I get:
randomForestSRC 2.9.1

Type rfsrc.news() to see new features, changes, and bug fixes.

**followed by 56 instances of **:

A process has executed an operation involving a call to the
"fork()" system call to create a child process. Open MPI is currently
operating in a condition that could result in memory corruption or
other system errors; your job may hang, crash, or produce silent
data corruption. The use of fork() (or system() or other calls that
create child processes) is strongly discouraged.

The process that invoked fork was:

Local host: [[42790,0],2] (PID 302952)

If you are absolutely sure that your application will successfully
and correctly survive a call to fork(), you may disable this warning
by setting the mpi_warn_on_fork MCA parameter to 0.

followed by 56 instances of (from detectCores())
[1] 28

But, so far, I cannot tell if imbalanced.rfsrc has been called yet. As the warnings suggest, my job may be hanging. I expected that, with the presence of Rmpi, etc, imbalanced.rfsrc would take care of the MPI + MP details behind the scenes. What wrong? Your help is much appreciated.

Best, -- Jay

MY R CODE (testing.R):

lp<- .libPaths()
.libPaths(c("/home/jjb485/Rlib", lp))
library(parallel)
library(Rmpi, lib.loc="/home/jjb485/Rlib")
library(randomForestSRC, lib.loc="/home/jjb485/Rlib")
detectCores()
options(rf.cores=detectCores(), mc.cores=detectCores())
load("/home/jjb485/neonatal/testing/testing.df.RData")
testing.rfsrc<- imbalanced(NAS ~ .,
testing.df,
method="brf",
importance="permute")
save("testing.rfsrc", file="testing.RData")

MY SLURM BATCH SCRIPT:

#!/bin/bash
#SBATCH --job-name=testing
#SBATCH --output=/scratch/jjb485/neonatal/testing/testing.txt
#SBATCH --time=1-00:00:00
#SBATCH --chdir=/scratch/jjb485/neonatal/testing
#SBATCH --ntasks=56
#SBATCH --nodes=2-2
#SBATCH --mem=128G

module load openmpi
module load R/latest
srun Rscript /home/jjb485/neonatal/testing/testing.R

@kogalur
Copy link
Owner

kogalur commented Nov 4, 2019

By MP, I assume you mean OpenMP. On a cluster you have OpenMP and MPI occurring simultaneously. Within a node, you have OpenMP executing, and across nodes, you have MPI. We successfully ran a SLURM batch script on a cluster back in the day as a test of scalability. The use of a cluster is indicated if you want to grow more trees simultaneously. Hybrid computing is not indicated as a work-around for memory issues.

In your case, it's theoretically possible to grow 56 trees in parallel across two nodes. But each tree still needs to access all the data. Also, a complicating issue is that one must give the cluster instructions to grow two sub-forests, one on each node. The problem is then of combining the ensembles from each forest into a single forest. It's a non-trivial enterprise.

You are using the wrapper imbalanced.rfsrc() in a hybrid environment. Anything other than standard rfsrc() or predict.rfsrc() calls are not recommended on a cluster as many of the other functions contain multiple calls to these two core functions. Combining sub-forest outputs from either of the two core functions into a single forest would be necessary before any other calculations could proceed.

At the end of the day, using a cluster requires writing some code and using mpi.send.Robj(), mpi.recv.Robj(), mpi.spawn.Rslaves(), and using the supervisor process to parse the output sent back from the workers into a single forest output.

I don't think any of this is what you need to do at all. What are the original dimensions of your data? What is ntree? What, specifically, are the parameters in your function call?

@chillydog
Copy link
Author

chillydog commented Nov 4, 2019 via email

@ishwaran
Copy link
Collaborator

ishwaran commented Nov 4, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants