Skip to content

feat: Supporting SLURM env vars for launching MAPDL configuration#2754

Merged
germa89 merged 46 commits intomainfrom
feat/supporting-slurm-manager
Aug 27, 2024
Merged

feat: Supporting SLURM env vars for launching MAPDL configuration#2754
germa89 merged 46 commits intomainfrom
feat/supporting-slurm-manager

Conversation

@germa89
Copy link
Copy Markdown
Collaborator

@germa89 germa89 commented Feb 8, 2024

As the title.

The idea is that on SLURM HPC clusters, PyMAPDL will read the SLURM job through the env vars that the SLURM manager creates, so it can launch MAPDL with the appropriate number of cores.

You can see in the code:

options = [
            # 4,  # Fall back option
            SLURM_CPUS_PER_TASK * SLURM_NTASKS,  # (CPUs)
            SLURM_NPROCS,  # (CPUs)
            # SLURM_NTASKS,  # (tasks) Not necessary the number of CPUs,
            # SLURM_NNODES * SLURM_TASKS_PER_NODE * SLURM_CPUS_PER_TASK,  # (CPUs)
            SLURM_CPUS_ON_NODE * SLURM_NNODES,  # (cpus)
        ]
nproc = max(options)

which is the way I use to decide how many cores should MAPDL instance use.

Same with memory:

        if SLURM_MEM_PER_NODE:
            # RAM argument is in MB, so we need to convert
            if SLURM_MEM_PER_NODE[-1] == "T":  # tera
                ram = int(SLURM_MEM_PER_NODE[:-1]) * 10**6
            elif SLURM_MEM_PER_NODE[-1] == "G":  # giga
                ram = int(SLURM_MEM_PER_NODE[:-1]) * 10**3
            elif SLURM_MEM_PER_NODE[-1] == "G":  # mega
                ram = int(SLURM_MEM_PER_NODE[:-1]) * 10**0
            elif SLURM_MEM_PER_NODE[-1].upper() == "k":  # mega
                ram = int(SLURM_MEM_PER_NODE[:-1]) * 10 ** (-3)
            else:
                ram = int(SLURM_MEM_PER_NODE)

I do not use the MAPDL -machines argument to specify the machines used. I don't think it is needed/compatible.

@germa89 germa89 self-assigned this Feb 8, 2024
@ansys-reviewer-bot
Copy link
Copy Markdown
Contributor

Thanks for opening a Pull Request. If you want to perform a review write a comment saying:

@ansys-reviewer-bot review

germa89 and others added 2 commits February 9, 2024 15:55
Co-authored-by: Maxime Rey <87315832+MaxJPRey@users.noreply.github.com>
@germa89
Copy link
Copy Markdown
Collaborator Author

germa89 commented Jul 3, 2024

This PR should be complemented with https://github.com/ansys-internal/rep-orchestration-interfaces library.

GitHub
GitHub is where people build software. More than 100 million people use GitHub to discover, fork, and contribute to over 420 million projects.

@germa89 germa89 added the DO NOT MERGE Not ready to be merged yet label Jul 17, 2024
@github-actions github-actions bot added the documentation Documentation related (improving, adding, etc) label Aug 26, 2024
pyansys-ci-bot and others added 3 commits August 26, 2024 11:09
@germa89 germa89 requested a review from koubaa August 26, 2024 11:11
@germa89
Copy link
Copy Markdown
Collaborator Author

germa89 commented Aug 26, 2024

@pyansys-ci-bot LGTM.

@germa89 germa89 marked this pull request as ready for review August 26, 2024 11:12
@germa89 germa89 requested a review from a team as a code owner August 26, 2024 11:12
Copy link
Copy Markdown
Contributor

@pyansys-ci-bot pyansys-ci-bot left a comment

Choose a reason for hiding this comment

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

✅ Approving this PR because germa89 said so in here 😬

LGTM

@germa89 germa89 enabled auto-merge (squash) August 26, 2024 11:12
@germa89 germa89 changed the title Supporting SLURM env vars for launching MAPDL configuration feat: Supporting SLURM env vars for launching MAPDL configuration Aug 26, 2024
@github-actions github-actions bot added the new feature Request or proposal for a new feature label Aug 26, 2024
@germa89 germa89 removed the DO NOT MERGE Not ready to be merged yet label Aug 27, 2024
@germa89 germa89 merged commit c8fb44e into main Aug 27, 2024
@germa89 germa89 deleted the feat/supporting-slurm-manager branch August 27, 2024 15:35
@germa89 germa89 mentioned this pull request Feb 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Documentation related (improving, adding, etc) new feature Request or proposal for a new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants