[slurm-users] Block jobs on GPU partition when GPU is not specified

Ratnasamy, Fritz fritz.ratnasamy at chicagobooth.edu
Sat Sep 25 05:21:50 UTC 2021


Hi,

I would like to block jobs submitted in our GPU partition when gres=gpu:1
(or any number between 1 and 4) is not specified when submitting a job
through sbatch or requesting an interactive session with srun.
Currently, /etc/slurm/slurm.conf has JobSumitPlugins=lua commented.
The liblua.so is now installed.
I would like to use something similar as the example mentioned at the end
of the page:
https://slurm.schedmd.com/resource_limits.html
Can I use the following code :

function slurm_job_submit(job_desc, part_list, submit_uid)
   if (job_desc.gres ~= nil)
   then
      for g in job_desc.gres:gmatch("[^,]+")
      do
	 bad = string.match(g,'^gpu[:]*[0-9]*$')
	 if (bad ~= nil)
	 then
	    slurm.log_info("User specified gpu GRES without type: %s", bad)
	    slurm.user_msg("You must always specify a type when requesting gpu GRES")
	    return slurm.ERROR
	 end
      end
   end
end

I do not need to check if the model is specified though. In that case,
1/ Should I change the line bad = string.match(g,'^gpu[:]*[0-9]*$') to
string.match(g,'^gpu[:]*[0-9]')
2/ Do I need to uncomment  JobSumitPlugins=lua
3/ Where to specify the function call slurm_job_submit so I make sure the
check to see if gres=gpu:1 is happening?
4/ I would need job_submit_lua.so, where can I find that library and if it
is not there, how can i dowload it?

Thanks for your help. I am new to regular expressions, lua and Slurm so I
apologize if my questions do not make sense.


*Fritz Ratnasamy*

Data Scientist

Information Technology

The University of Chicago

Booth School of Business

5807 S. Woodlawn

Chicago, Illinois 60637

Phone: +(1) 773-834-4556
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.schedmd.com/pipermail/slurm-users/attachments/20210925/9922cc1a/attachment.htm>


More information about the slurm-users mailing list