Would it ever make sense to use --array and --ntasks ...
Absolutely yes.

This is what is set today:
SLURM_ARRAY_TASK_ID
    Job array ID (index) number.
SLURM_ARRAY_JOB_ID
    Job array's master job ID number.

How about this for a name?
SLURM_ARRAY_MAX_TASK_ID

Quoting Jason Bacon <[email protected]>:

Moe and other SLURM developers:

Do you think this should be done by setting SLURM_NTASKS, SLURM_STEP_NUM_TASKS and SLURM*_TASKS_PER_*, or by creating a new variable such as SLURM_ARRAY_NUM_TASKS?

I'm not sure if the former might already serve a purpose under an array job. It seems that array jobs do set SLURM_TASKS_PER_NODE but not SLURM_NTASKS, SLURM_STEP_NUM_TASKS.

Would it ever make sense to use --array and --ntasks in the same job? If so, then separate variables would seem necessary.

Either way, I'll try to dig into the code next week.

Regards,

    JB

On 03/13/15 12:05, Jean-Christophe Domenge wrote:
Re: [slurm-dev] Re: Array job: get number of array tasks in batch script
Many thanks Jason!

On Fri, Mar 13, 2015 at 6:01 PM, Jason Bacon <[email protected] <mailto:[email protected]>> wrote:



   I'll do it.

   I had the same concern recently and now that Moe told us exactly
   which file to update, it shouldn't take much effort.

       Jason

   On 03/13/15 11:18, Jean-Christophe Domenge wrote:

       Re: [slurm-dev] Re: Array job: get number of array tasks in
       batch script
       Thanks for the tip.
       Unfortunately patching src/sbatch/opt.c seems beyond my reach
       to be frank.
       Is there a way I can submit a feature request?

       On Fri, Mar 13, 2015 at 4:48 PM, Moe Jette <[email protected]
       <mailto:[email protected]> <mailto:[email protected]
       <mailto:[email protected]>>> wrote:


           That information is not current available, but it should
       be easy
           to add with a few lines of code in src/sbatch/opt.c. If you do
           this, please forward the patch so it can be added to the Slurm
           code base.


           Quoting Jean-Christophe Domenge <[email protected]
       <mailto:[email protected]>
           <mailto:[email protected] <mailto:[email protected]>>>:

               When I submit an array job using *sbatch --array:1-N
               myscript.sh *the task
               id is passed at runtime to *myscript.sh* via the
       environment
               variable
               SLURM_ARRAY_TASK_ID.
               But how can I access *N* (the number of tasks in the
       array job) in
               *myscript.sh*?

               This is especially useful when splitting a list into *N*
               slices with each
               task in the array job handling a different slice.

               Thanks for your help,

               jc



           --     Morris "Moe" Jette
           CTO, SchedMD LLC
           Commercial Slurm Development and Support





--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  Jason W. Bacon
  [email protected]

  If a problem can be solved,
  there's no need to worry.
    If it cannot be solved, then
  worrying will do no good.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


--
Morris "Moe" Jette
CTO, SchedMD LLC
Commercial Slurm Development and Support

Reply via email to