On 5 November 2017 at 11:08, ايمان <[email protected]> wrote:

> Good morning;
>
>
>  I want to run parallel  java code on more than one nodes , but it
> executed only on one nodes ?
>
> How can I run it on more than one nodes?
>

Good morning Eman,

Without more details, it's hard to answer accurately. But here goes.

When you run the Java app, you will often need to tell it how many cores to
use. Usually this is done via a command line switch in the java program.

EG

In this example, I will tell the java app to use ten cores

$ cat my_script.sbatch

java -jar -n 10 myJavaApp.jar


This isn't always the case - sometimes a java app will use all cores that
are assigned to it or that are available to it.

If I have a slurm cluster you can define the cluster to have Cores, CPUs or
Nodes as consumable units. Depending on which you have defined - the
default is nodes. https://slurm.schedmd.com/cons_res.html

sbatch has different ways of dealing with each. It's worth working through
each option - even though there are so many - because experimentation is
probably how you will need to go.

https://slurm.schedmd.com/sbatch.html

Depending on how you have defined the nodes, you could use
*-c*, *--cpus-per-task*=<*ncpus*>
*-N*, *--nodes*=<*minnodes*[-*maxnodes*]>
*-n*, *--ntasks*=<*number*>


$ sbatch -n 10 my_script.sbatch (this should automatically use 2.5 nodes if
there are 4 cores per node defined)

$ sbatch -N 3 my_script.sbatch  (this leaves 2 cores unused if there are 4
cores per node)


So what we have seen is that:

 - we have to tell the java program how many cores to use.
 - unless the java app uses "all available resources"
 - slurm allows you to give a portion of the resources to a program.
 - how many nodes/cpus/cores that java app runs on, depends on how many
resources you give it via slurm

 - if you run the java app above with 10 cores, but only ask slurm for 1
core, the usual result is that it will still run - just very slowly.


I hope that helps

cheers
L.


------
"The antidote to apocalypticism is *apocalyptic civics*. Apocalyptic civics
is the insistence that we cannot ignore the truth, nor should we panic
about it. It is a shared consciousness that our institutions have failed
and our ecosystem is collapsing, yet we are still here — and we are
creative agents who can shape our destinies. Apocalyptic civics is the
conviction that the only way out is through, and the only way through is
together. "

*Greg Bloom* @greggish https://twitter.com/greggish/
status/873177525903609857

Reply via email to