Skip to content

Commit a6ee8e1

Browse files
authored
add support for specifying cores for the adapters that can support it (#851)
* add support for specifying cores for the adapters that can support it * correct this variable name * fujitsu support
1 parent 4342e29 commit a6ee8e1

File tree

6 files changed

+28
-2
lines changed

6 files changed

+28
-2
lines changed

lib/ood_core/job/adapters/fujitsu_tcs.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ def submit(script, after: [], afterok: [], afternotok: [], afterany: [])
233233

234234
args.concat ["-N", script.job_name] unless script.job_name.nil?
235235
args.concat ["-o", script.output_path] unless script.output_path.nil?
236+
args.concat ['--mpi', "proc=#{script.cores}"] unless script.cores.nil?
236237
if script.error_path.nil?
237238
args.concat ["-j"]
238239
else

lib/ood_core/job/adapters/lsf/helper.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ def batch_submit_args(script, after: [], afterok: [], afternotok: [], afterany:
9191
args.concat ["-b", script.start_time.localtime.strftime("%Y:%m:%d:%H:%M")] unless script.start_time.nil?
9292
args.concat ["-W", (script.wall_time / 60).to_i] unless script.wall_time.nil?
9393
args.concat ["-L", script.shell_path.to_s] unless script.shell_path.nil?
94+
args.concat ['-n', script.cores] unless script.cores.nil?
9495

9596
# environment
9697
env = script.job_environment || {}

lib/ood_core/job/adapters/pbspro.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@ def submit(script, after: [], afterok: [], afternotok: [], afterany: [])
269269
args.concat ["-a", script.start_time.localtime.strftime("%C%y%m%d%H%M.%S")] unless script.start_time.nil?
270270
args.concat ["-A", script.accounting_id] unless script.accounting_id.nil?
271271
args.concat ["-l", "walltime=#{seconds_to_duration(script.wall_time)}"] unless script.wall_time.nil?
272+
args.concat ppn(script)
272273

273274
# Set dependencies
274275
depend = []
@@ -422,6 +423,13 @@ def directive_prefix
422423
'#PBS'
423424
end
424425

426+
# place holder for when we support both nodes and cpus.
427+
def ppn(script)
428+
return [] if script.cores.nil?
429+
430+
['-l', "ncpus=#{script.cpus}"]
431+
end
432+
425433
private
426434
# Convert duration to seconds
427435
def duration_in_seconds(time)

lib/ood_core/job/adapters/slurm.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -526,6 +526,7 @@ def submit(script, after: [], afterok: [], afternotok: [], afterany: [])
526526
args.concat ['-a', script.job_array_request] unless script.job_array_request.nil?
527527
args.concat ['--qos', script.qos] unless script.qos.nil?
528528
args.concat ['--gpus-per-node', script.gpus_per_node] unless script.gpus_per_node.nil?
529+
args.concat ['-n', script.cores] unless script.cores.nil?
529530
# ignore nodes, don't know how to do this for slurm
530531

531532
# Set dependencies

lib/ood_core/job/adapters/torque.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ def submit(script, after: [], afterok: [], afternotok: [], afterany: [])
160160
args.concat ['-t', script.job_array_request] unless script.job_array_request.nil?
161161
args.concat ['-l', "qos=#{script.qos}"] unless script.qos.nil?
162162
args.concat ['-l', "gpus=#{script.gpus_per_node}"] unless script.gpus_per_node.nil?
163+
args.concat ppn(script)
163164

164165
# Set environment variables
165166
env = script.job_environment.to_h
@@ -302,6 +303,13 @@ def directive_prefix
302303
'#QSUB'
303304
end
304305

306+
# place holder for when we support both nodes and cpus.
307+
def ppn(script)
308+
return [] if script.cores.nil?
309+
310+
['-l', "procs=#{script.cpus}"]
311+
end
312+
305313
private
306314
# Convert duration to seconds
307315
def duration_in_seconds(time)

lib/ood_core/job/script.rb

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,10 @@ class Script
108108
# @return [Integer, nil] gpus per node
109109
attr_reader :gpus_per_node
110110

111+
# The core request for this job
112+
# @return [Integer, nil] cores
113+
attr_reader :cores
114+
111115
# Object detailing any native specifications that are implementation specific
112116
# @note Should not be used at all costs.
113117
# @return [Object, nil] native specifications
@@ -151,7 +155,8 @@ def initialize(content:, args: nil, submit_as_hold: nil, rerunnable: nil,
151155
output_path: nil, error_path: nil, reservation_id: nil,
152156
queue_name: nil, priority: nil, start_time: nil,
153157
wall_time: nil, accounting_id: nil, job_array_request: nil,
154-
qos: nil, gpus_per_node: nil, native: nil, copy_environment: nil, **_)
158+
qos: nil, gpus_per_node: nil, native: nil, copy_environment: nil,
159+
cores: nil, **_)
155160
@content = content.to_s
156161

157162
@submit_as_hold = submit_as_hold
@@ -179,6 +184,7 @@ def initialize(content:, args: nil, submit_as_hold: nil, rerunnable: nil,
179184
@gpus_per_node = gpus_per_node && gpus_per_node.to_i
180185
@native = native
181186
@copy_environment = (copy_environment.nil?) ? nil : !! copy_environment
187+
@cores = cores&.to_i
182188
end
183189

184190
# Convert object to hash
@@ -209,7 +215,8 @@ def to_h
209215
qos: qos,
210216
gpus_per_node: gpus_per_node,
211217
native: native,
212-
copy_environment: copy_environment
218+
cores: cores,
219+
copy_environment: copy_environment,
213220
}
214221
end
215222

0 commit comments

Comments
 (0)