Skip to content

Allow test cases to run on login nodes - #538

Merged
xylar merged 4 commits into
MPAS-Dev:mainfrom
xylar:allow_compass_run_on_login_nodes
Feb 28, 2023
Merged

xylar merged 4 commits into
MPAS-Dev:mainfrom
xylar:allow_compass_run_on_login_nodes

Conversation

@xylar

@xylar xylar commented Feb 19, 2023 •

Copy link
Copy Markdown
Collaborator

If you are on a slurm system but a slurm job is not detected, you are assumed to be on a login node. In that case, it is like being on a single node system, restricted to a small number of cores (set with the config option login_cores = 4 in the [parallel] config section). In addition, you are not allowed to run MPI jobs (steps with ntasks > 1).

This is enforced by modifying the Step.constrain_resources() method, which now takes a dictionary of available_resources rather than a single available_cores argument. (Many tasks have their overridden constrain_resources() method changed as a result.)

The new, stricter linter required cleaning up some code in the process.

Checklist

  • Document (in a comment titled Testing in this PR) any testing that was used to verify the changes

closes #495

@xylar xylar added enhancement New feature or request framework labels Feb 19, 2023
@xylar xylar self-assigned this Feb 19, 2023
@xylar
xylar requested a review from matthewhoffman February 19, 2023 04:50
@xylar

xylar commented Feb 19, 2023 •

Copy link
Copy Markdown
Collaborator Author

Testing

I ran tests in all 3 parallel systems:

  1. nightly my linux laptop (single_node)
  2. pr on Chrysalis compute node (slurm)
  3. QU240 mesh on Chrysalis login node (login)

In addition, I verified that trying to run the QU240 init and performance_test test cases failed with the expected error message about running an MPI job on a login node.

@xylar
xylar force-pushed the allow_compass_run_on_login_nodes branch 2 times, most recently from a965771 to 3104105 Compare February 19, 2023 05:26
@xylar

xylar commented Feb 19, 2023

Copy link
Copy Markdown
Collaborator Author

@matthewhoffman, this is ready for you to try out (and to use in #488 if you like). You would need to set on_login = True in the config options for those tests where appropriate.

@matthewhoffman

Copy link
Copy Markdown
Member

@xylar , thanks for taking care of this. I'll test it out next time I test or set up an ensemble.

@matthewhoffman

Copy link
Copy Markdown
Member

@xylar , do you expect it would work to set on_login=True for some steps in a test case but have others be set to False? For #488 , we want to be able to run the step ensemble_manager from a login node, but the steps that form the ensemble members still need to know they are on a compute node.

@xylar

xylar commented Feb 22, 2023

Copy link
Copy Markdown
Collaborator Author

No that wouldn't work in the current implementation. The config options have to be the same for all steps in a test case. But one option might be to use the command line flag in that particular situation. I'll have to think about a way to include that in the step itself.

@xylar
xylar force-pushed the allow_compass_run_on_login_nodes branch from 3104105 to 30a2e4e Compare February 23, 2023 04:39
@xylar xylar added the in progress This PR is not ready for review or merging label Feb 23, 2023
@xylar
xylar marked this pull request as draft February 23, 2023 04:39
@xylar
xylar force-pushed the allow_compass_run_on_login_nodes branch from 30a2e4e to 642505d Compare February 23, 2023 04:46
@xylar

xylar commented Feb 23, 2023

Copy link
Copy Markdown
Collaborator Author

@matthewhoffman, I think this solution will be much messier to review but much better to use.

Essentially, you don't have to do anything different now for a step (or even a test case or a suite) to run on a login node. It just has to be made up of steps that don't use MPI and don't use more than login_cores = 4 CPUs (e.g in python threading).

I haven't had a chance to test this yet so hold off on doing anything but responding to the concept until I have a chance.

@xylar
xylar force-pushed the allow_compass_run_on_login_nodes branch from 642505d to 5e4c98a Compare February 23, 2023 05:20
This merge changes `run.serial` and `parallel` so we only poll
for slrum resources once and use that information for all test
cases and steps.

This merge also removes the error message when you run on a login
node.  Instead, a login node is allocated a small number of cores
(4 by default) and isn't allowed to run MPI jobs (it only supports
one task).

To accommodate this, the `Step.constrain_resources()` method takes
a dictionary of available resources instead of just the number of
available cores.
This also requires some pre-commit clean up
@xylar
xylar force-pushed the allow_compass_run_on_login_nodes branch from 5e4c98a to c8172ea Compare February 23, 2023 05:24
@xylar
xylar marked this pull request as ready for review February 23, 2023 05:28
@xylar xylar removed the in progress This PR is not ready for review or merging label Feb 23, 2023
@xylar

xylar commented Feb 23, 2023

Copy link
Copy Markdown
Collaborator Author

@matthewhoffman, okay, I tested this to my satisfaction. Have a look and tell me what you think. If you have something to test on, give it a whirl!

@matthewhoffman

Copy link
Copy Markdown
Member

Thanks, @xylar . I'll try it out with an ensemble test and suggest @trhille apply it when he tests #488 .

@trhille

trhille commented Feb 28, 2023 •

Copy link
Copy Markdown
Collaborator

I used this when testing #488 on Perlmutter, and I was able to use compass run from the login node to run the ensemble_manager to set up the default Thwaites ensemble.

@matthewhoffman matthewhoffman left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@xylar , thanks for reworking the solution for this issue. I tested this PR merged into my ensemble branch and it worked like a charm. I made a cursory review of the parts of the code changes that I understood. I'm approving now because my comment is minor.

Comment thread compass/default.cfg
partition_executable = gpmetis

# the number of cores a user can use on a login node
login_cores = 4

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is it allowable to have this be more than 1 at most centers?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yes, this is thread parallelism and we're often allowed to use a few cores (e.g. you can compile code in parallel)

Comment thread compass/parallel.py
nodes = _get_subprocess_int(args)
cores = cores_per_node * nodes
mpi_allowed = True
elif parallel_system == 'login':

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I like this solution - defining a different system for a login node seems like it would provide the flexibility needed to handle the situation properly.

@xylar
xylar merged commit c301cc4 into MPAS-Dev:main Feb 28, 2023
@xylar
xylar deleted the allow_compass_run_on_login_nodes branch February 28, 2023 20:43
@xylar

xylar commented Feb 28, 2023

Copy link
Copy Markdown
Collaborator Author

Thanks @matthewhoffman for your review and @trhille for trying it out, too!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request framework

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow compass run to be executed on a login node in some situations

3 participants