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

Slurm script update #265

Merged
merged 31 commits into from
Dec 16, 2024
Merged

Slurm script update #265

merged 31 commits into from
Dec 16, 2024

Conversation

jarlsondre
Copy link
Collaborator

@jarlsondre jarlsondre commented Dec 3, 2024

Summary

This implements the SLURM scripts in Python instead of bash, for more simplicity in the long run.

The current implementation allows you to use configuration files to run SLURM jobs, bypassing the need for one (or multiple) bash script(s) to do the same. If you need more fine-grained control, you can also inherit from the SlurmScriptBuilderclass and write your own logic. This makes it very easy to do things such as running all the strategies or doing scalings tests.

Below, you can see an example of using the built in builder. Assuming you have a configuration file called slurm_config.yaml, you can pass it with -c and then add/override any arguments you want after.

python slurm_script_builder.py -c slurm_config.yaml --no-submit-job --no-retain-file --debug

In this case, we do --no-submit-job and --no-retain-file, meaning that it will not run the script with sbatch and it will also not save it to file. When both of these are active, the builder will simply print the script to the console. This allows for a quick feedback loop when creating your config, as you can make changes, look at the definitive output without having to wonder what the variables are evaluated to, and repeat until you get exactly the script you want. Afterwards, you can then remove --no-submit-job to make sure it is being executed and if you want to store the same script for later (e.g. for reproducibility) then you can also remove --no-retain-file to make it automatically save to file.

Future Plans

This PR contains the initial design for the SLURM job creator. There are more features that we wish to add, but these might be more suitable for another PR, as I currently have something else that is being blocked by this. Besides, getting your input after testing this out is also valuable. Some features for a future PR are:

  • Integrate this into the CLI tool for itwinai
  • Only use a single config file, the one from the use cases, instead of having two separate ones
  • Add SLURM scripts for Ray stuff

Related issue :
#263

@jarlsondre jarlsondre added the enhancement New feature or request label Dec 3, 2024
@jarlsondre jarlsondre self-assigned this Dec 3, 2024
@jarlsondre jarlsondre changed the title Slurm script update [DRAFT] [DRAFT] Slurm script update Dec 3, 2024
src/itwinai/slurm/slurm_script_builder.py Outdated Show resolved Hide resolved
src/itwinai/slurm/slurm_script_builder.py Outdated Show resolved Hide resolved
src/itwinai/slurm/slurm_script_builder.py Outdated Show resolved Hide resolved
src/itwinai/slurm/slurm_script_builder.py Show resolved Hide resolved
src/itwinai/slurm/slurm_script_builder.py Show resolved Hide resolved
@jarlsondre jarlsondre marked this pull request as ready for review December 16, 2024 12:45
@jarlsondre jarlsondre changed the title [DRAFT] Slurm script update Slurm script update Dec 16, 2024
src/itwinai/slurm/slurm_config.yaml Outdated Show resolved Hide resolved
src/itwinai/slurm/slurm_constants.py Show resolved Hide resolved
src/itwinai/slurm/slurm_constants.py Outdated Show resolved Hide resolved
src/itwinai/slurm/slurm_script_builder.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@annaelisalappe annaelisalappe left a comment

Choose a reason for hiding this comment

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

It looks good to me! I know you and Matteo talked about this a lot, and he probably has more valuable feedback to give on slurm, but it looks very well written to me! Also as a non-slurm expert I was able to understand it, so nice :)

@matbun matbun self-requested a review December 16, 2024 15:41
@jarlsondre jarlsondre merged commit 33f13c8 into main Dec 16, 2024
9 checks passed
annaelisalappe pushed a commit that referenced this pull request Jan 8, 2025
* add slurm template script

* add eurac slurm script for testing

* fix some linting errors

* add contributors

* make script class based

* add code for running script

* fix more linting errors

* move slurm scripts into src and add use-case specific script

* rename slurmscript class

* add argparser

* create runall methods

* fix import order

* add builder for tutorial

* make parser more general

* add logic for disabling running script

* add function for generating identifier

* fix linting errors

* make runall work for eurac

* fix merge conflicts

* some code clean up

* small adjustments to make it work for the EURAC case

* add implementation for virgo use case

* add slurm_scripts/ to gitignore

* add ability to override training command in config file

* update std_out and err_out automatically

* add auto std_out for real this time

* make slurm script for scaling test

* fix linting errors

* add separate file for generic slurm script maker and small changes

* fix linting errors
@jarlsondre jarlsondre deleted the slurm-script-update branch January 15, 2025 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants