Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing the estimation of available cpus for a machine (localhost) #971

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

mikibonacci
Copy link
Member

@mikibonacci mikibonacci commented Dec 15, 2024

This fixes #937
This fixes #888

Issue #937 is fixed here,
while #888 is fixed here

(now under the `machine_cpus` variable, no more `localhost_cpus`)
This is done by using the `get_default_mpiprocs_per_machine` method of the
computer node.
pre-commit-ci bot and others added 4 commits December 15, 2024 13:19
I take the information from the computer setup:

```python
default_mpiprocs = computer.get_default_mpiprocs_per_machine()
```
@mikibonacci mikibonacci changed the title Fixing the estimation of available cpus estimation Fixing the estimation of available cpus for a machine (localhost) Dec 15, 2024
self.num_cpus.value = 1
self.num_cpus.description = "CPUs"
else:
default_mpiprocs = computer.get_default_mpiprocs_per_machine()
self.num_nodes.disabled = False
self.num_cpus.max = default_mpiprocs
self.num_cpus.value = default_mpiprocs
self.num_cpus.value = (
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this can fix the number of max cpus we can choose for a code, avoid the erroneous os.cpu_count

localhost_cpus = os.cpu_count()
machine_cpus = orm.load_node(
pw_code_model.selected
).computer.get_default_mpiprocs_per_machine()
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I called machine_cpus as is not more only for localhost_cpus

@mikibonacci mikibonacci requested a review from unkcpz December 15, 2024 13:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant