# Setting limit for number of cores and tasks per node

**URL:** <https://discourse.openondemand.org/t/setting-limit-for-number-of-cores-and-tasks-per-node/3618>\
**Category:** Get Help\
**Tags:** ondemand2, question\
**Created:** [July 11, 2024, 5:34am UTC](https://discourse.openondemand.org/t/setting-limit-for-number-of-cores-and-tasks-per-node/3618 "2024-07-11T05:34:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ionli](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/ionli/32/2340_2.png) [@ionli](https://discourse.openondemand.org/u/ionli)\
**Post date:** [July 11, 2024, 5:34am UTC](https://discourse.openondemand.org/t/setting-limit-for-number-of-cores-and-tasks-per-node/3618/1 "2024-07-11T05:34:16Z")

</div>

I’m attempting to fully use dynamic form widgets and no JS in my OOD app. Currently, I have it configured for number\_fields to take in cores\_per\_task and tasks\_per\_node. The maximum number of cores per node is 24 cores, so I want to define a limit for the product of cores\_per\_task and tasks\_per\_node to be less than or equal to 24. Any ideas on how I can achieve this?

---

<div class="post-metadata">

**Author:** ![jeff.ohrstrom](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/jeff.ohrstrom/32/136_2.png) [@jeff.ohrstrom](https://discourse.openondemand.org/u/jeff.ohrstrom)\
**Post date:** [July 11, 2024, 3:54pm UTC](https://discourse.openondemand.org/t/setting-limit-for-number-of-cores-and-tasks-per-node/3618/2 "2024-07-11T15:54:34Z")

</div>

Hi and welcome!

I don’t think the dynamic javascript can do products or similar calculations, it can just set mins and maxes. So it would appear you’d have to write your own javascript to do that.

That said - I’d consider removing one of those from the form entirely just to simplify the user experience. My gut feeling is that they’re only interested in how many cores they have access to while interacting with the application, and the application itself deals with parallelism (as opposed to invoking srun or similar).

---

<div class="post-metadata">

**Author:** ![RonRahaman](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/ronrahaman/32/1031_2.png) [@RonRahaman](https://discourse.openondemand.org/u/RonRahaman)\
**Post date:** [July 12, 2024, 6:54pm UTC](https://discourse.openondemand.org/t/setting-limit-for-number-of-cores-and-tasks-per-node/3618/3 "2024-07-12T18:54:51Z")

</div>

Hey Jeff!

So we’re actually trying to support workflows where users do need to differentiate between ntasks-per-node and cpus-per-task

Currently, in OOD, we have one field that gets passed to `--ntasks-per-node` (we use Slurm). But there are some use cases where it matters if people use `--ntasks-per-node` or `--cpus-per-task`.

- Some users have a TensorFlow workflow where they have multiple threads submitting to one GPU. In normal batch jobs, `--ntasks-per-node=1` and `--cpus-per-task=N` works for them, whereas `--ntasks-per-node=N` does not. We’d like to have that same level of support in our Jupyter OOD app.
- On the other hand, we have people running MPI apps like ANSYS through an OOD Interactive Desktop, and they do need `--ntasks-per-node=N`

Are these use cases anyone else has addressed?

---

<div class="post-metadata">

**Author:** ![jeff.ohrstrom](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/jeff.ohrstrom/32/136_2.png) [@jeff.ohrstrom](https://discourse.openondemand.org/u/jeff.ohrstrom)\
**Post date:** [July 12, 2024, 7:06pm UTC](https://discourse.openondemand.org/t/setting-limit-for-number-of-cores-and-tasks-per-node/3618/4 "2024-07-12T19:06:52Z")

</div>

OSC uses `--ntasks-per-node` exclusively to request cores.

> [@RonRahaman](#):
>
> In normal batch jobs, `--ntasks-per-node=1` and `--cpus-per-task=N` works for them, whereas `--ntasks-per-node=N` does not.

I wonder why. I always have to remind myself of the distinction whenever an issue like this comes up.

In any case - if you need multiplication or similar behavior to set boundaries when given user input, then it seems like you’ve got to write the javascript for it.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex015/uploads/osc/original/2X/b/bae70bd0ed39a3ae769c2108155f4cb3e9da8385.png) [@system](https://discourse.openondemand.org/u/system)\
**Post date:** [January 8, 2025, 7:07pm UTC](https://discourse.openondemand.org/t/setting-limit-for-number-of-cores-and-tasks-per-node/3618/5 "2025-01-08T19:07:11Z")

</div>

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
