title: Slurm: What is the difference for code executing under salloc vs srun
body: <p>I'm using a cluster managed by slurm to run some yarn/hadoop benchmarks. To do this I am starting the hadoop servers on nodes allocated by slurm and then running the benchmarks on them. I realize that this is not the intended way to run a production hadoop cluster, but needs must. </p>
  
  <p>To do this I started by writing a script that runs with srun eg <code>srun -N 4 setup.sh</code>. This script writes the configuration files and starts the servers on the allocated nodes, with the lowest numbered machine acting as the master. This all works, and I am able to run applications.</p>
  
  <p>However, as I would like to start the servers once and then launch multiple applications on them without restarting/encoding everything in at the begining I would like to use <code>salloc</code> instead. I had thought that this would be a simple case of running <code>salloc -N 4</code> and then running <code>srun setup.sh</code>. Unfortunately this does not work as the different servers are unable to communicate with each other. Could any one explain to me what the difference in the operating environment is between using <code>srun</code> and using <code>salloc</code> then <code>srun</code>?</p>
  
  <p>Many thanks</p>
  
  <p>Daniel </p>