[slurm-users] Odd behavior/bug with --array env

Robert Anderson rea at sr.unh.edu
Tue Feb 20 16:36:27 MST 2018


--array	expected	current
0-15:4  15		12
0-14:4  14		12
0-13:4  13		12
0-12:4  12		12
0-11:4  11		8


Given a specified array of work I expected to get a reference to the
full array.  

Your explanation of step as sequence shorthand makes sense, I just
expected it to be a true index step through the given array range.

Seems equivalent and less confusing to just script it as:
  --array=0-3
  ID = SLURM_ARRAY_TASK_ID * 4

Clearly 4 jobs and no provided information was lost.


I certainly understand if it is working as designed.  Just wanted
to note that it didn't match my expectations, just in case it really was
a bug. 

Thanks for the quick response.

On Tue, 20 Feb 2018 12:00:01 -0700
slurm-users-request at lists.schedmd.com wrote:
> ----------------------------------------------------------------------
> 
> Message: 1
> Date: Tue, 20 Feb 2018 07:54:35 +0100
> From: "Loris Bennett" <loris.bennett at fu-berlin.de>
> To: Slurm User Community List <slurm-users at lists.schedmd.com>
> Subject: Re: [slurm-users] Odd behavior/bug with --array env
> 	SLURM_ARRAY_TASK_MAX
> Message-ID: <87k1v86thw.fsf at hornfels.zedat.fu-berlin.de>
> Content-Type: text/plain; charset=utf-8
> 
> Robert Anderson <rea at sr.unh.edu> writes:
> 
> > While working on an example python slurm job script I found the
> > environment variable SLURM_ARRAY_TASK_MAX was not set to the
> > expected value when a step is defined.
> >
> > Below is a minimal test of a 10 array job, with a step value of 5.
> > When a step value is defined the SLURM_ARRAY_TASK_MAX is set to the
> > maximum value that slurm will provide as a  , not
> > the actual expected "array max value".
> >
> > Current behavior looses the only hook to the real "array max" value.
> > I can think of no reason why the current behavior would be preferred
> > over my expected value. 
> >
> > Am I missing something?  
> 
> [snip (40 lines)]
> 
> I think the logic is that SLURM_ARRAY_TASK_MAX refers to the actual
> array produced, regardless of exactly how that was done.  So taking
> the example from the "--array" section the 'sbatch' manpage:
> 
>   For example, "--array=0-15:4" is equivalent to "--array=0,4,8,12".
> 
> the array produced is (0, 4, 8, 12) regardless of exactly how it was
> created, either "--array=0-15:4" or, say, "--array=0-12:4".
> 
> This definition of SLURM_ARRAY_TASK_MAX seems like it would definitely
> be useful.  What is the use case for what you expected?
> 
> Cheers,
> 
> Loris
> 



-- 
--------------------------------------------------
Robert E. Anderson -- (603) 862-3489
Associate Director -- UNH Research Computing Center    
http://www.unh.edu/research/rcc
--------------------------------------------------



More information about the slurm-users mailing list