hpc_connect: lightweight HPC submission and launching interfaces
Project description
hpc_connect
hpc_connect is a Python package that provides abstract interfaces to High-Performance Computing (HPC) schedulers and launchers. A default shell scheduler and MPI launcher is provided. Users can extend the functionality by subclassing the provided interfaces.
Features
- Abstract Interfaces: Provides base classes for creating custom HPC schedulers and launchers.
- Default Implementations: Includes a default shell scheduler and an MPI launcher for immediate use.
- Extensibility: Easily create and register custom launchers and schedulers.
Installation
You can install hpc_connect using pip:
python3 -m pip install hpc-connect
Usage
Scheduler
import hpc_connect
submission_manager = hpc_connect.get_submission_manager("shell")
submission_manager.submit("hello-world", ["echo 'Hello, world!'"], cpus=1)
hpc-launch
A command-line interface for launching parallel applications using various HPC launchers.
SYNOPSIS
hpc-launch [mpi-options] <application> [application-options]
Description
hpc-launch is a command line tool that forwards arguments to configured backend launchers such as mpiexec, mpirun, and jsrun. hpc-launch works by translating the command given by
hpc-launch [mpi-options] <application> [application options]
to
<exec> <default-options> [mapped mpi-options] <application> [application-options]
where default-options and mapped mpi-options are replaced according to the mappings in the configuration.
hpc-launch provides a unified command structure for launching parallel applications, allowing users to execute their applications without needing to remember the specific syntax for each launcher.
Configuration
The behavior of hpc-launch is determined by a YAML configuration file. The default configuration is:
hpc_connect:
launch:
vendor: openmpi
exec: mpiexec
numproc_flag: -n
default_flags: []
local_flags: []
post_flags: []
mappings: {}
Configuration Parameters
- vendor: The MPI implementation vendor (e.g., openmpi, mpich).
- exec: The command to execute the launcher (e.g., mpiexec, mpirun).
- numproc_flag: The flag used to specify the number of processes (e.g., -n).
- default_flags: A list of default options passed to the launcher.
- local_flags: A list of options specific to local execution.
- post_flags: A list of options that are added to the command line after all other launcher args
- mappings: A dictionary for additional mappings or configurations, where command-line flags can be replaced with their corresponding values.
Configuration variables can also be specified through environment variables named HPCC_LAUNCH_NAME where NAME is any one of the configuration variables given above. Variables defined in the environment take precedent over variables defined in the configuration file.
Examples
Perhaps the base way to describe the behavior of hpc-connect is through example
Example 1
Given the configuration
hpc_connect:
launch:
vendor: mpich
exec: mpiexec
numproc_flag: -np
the command line
hpc-launch -n 4 my-app ...
becomes
mpiexec -np 4 my-app ...
NOTE: the flag
-nwas replaced bynumproc_flag=-np
NOTE: the default flag mapping is
{'-n': '-np'}
Example 2
Given the configuration
hpc_connect:
launch:
vendor: mpich
exec: mpiexec
numproc_flag: -np
default_flags: --bind-to none
the command line
hpc-launch -n 4 my-app ...
becomes
mpiexec --bind-to none -np 4 my-app ...
Example 3
Given the configuration
hpc_connect:
launch:
vendor: mpich
exec: mpiexec
numproc_flag: -np
mappings:
'--foo': '--bar'
'--spam': '--eggs'
the command line
hpc-launch -n 4 --foo=on --spam yummy my-app ...
becomes
mpiexec --bind-to none -np 4 --bar=on --eggs yummy my-app ...
Example 4
Given the configuration
hpc_connect:
launch:
vendor: mpich
exec: mpiexec
numproc_flag: -np
default_flags: --bind-to core --map-by ppr:%(np)d:numa
the command line
hpc-launch -n 4 my-app ...
becomes
mpiexec --bind-to core --map-by ppr:4:numa -np 4 my-app ...
Example 5
Given the configuration
hpc_connect:
launch:
vendor: mpich
exec: mpiexec
numproc_flag: -np
mappings:
'--account': SUPPRESS
'--clusters': SUPPRESS
the command line
hpc-launch -n 4 --account=[MASKED] --clusters=my-cluster my-app ...
becomes
mpiexec -np 4 my-app ...
Example 6
Given the configuration
hpc_connect:
launch:
vendor: mpich
exec: mpiexec
numproc_flag: -np
default_flags: --bind-to core --map-by ppr:%(np)d:numa
local_flags: -H localhost
the command line
hpc-launch -n 4 app-1 app-1-options. : -n 5 app-2 app-2-options
becomes
mpiexec --bind-to core --map-by ppr:9:numa -H localhost -np 4 my-app -1 app-1-options : -H localhost -np 5 app-2 app-2-options
Example 7
Given the configuration
hpc_connect:
launch:
vendor: schedmd
exec: srun
the command line
hpc-launch -n 4 app-1 app-1-options : -n 5 app-2 app-2-options
becomes
srun -n9 --multi-prog launch-multi-prog.conf
where
$ cat launch-multi-prog.conf
0-3 app-1 app-1-options
4-8 app-2 app-2-options
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hpc_connect-26.3.5.tar.gz.
File metadata
- Download URL: hpc_connect-26.3.5.tar.gz
- Upload date:
- Size: 49.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0c3973a05e01d5b3d6b62c8299cf147fd169ce2179f330fdab61825b983f9653
|
|
| MD5 |
9fb093fd6578526c1c988c4d405b667c
|
|
| BLAKE2b-256 |
49635d14068db13093c876fa628b4be43e0dad204916420442050cf4f931afc3
|
Provenance
The following attestation bundles were made for hpc_connect-26.3.5.tar.gz:
Publisher:
publish.yml on sandialabs/hpc-connect
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hpc_connect-26.3.5.tar.gz -
Subject digest:
0c3973a05e01d5b3d6b62c8299cf147fd169ce2179f330fdab61825b983f9653 - Sigstore transparency entry: 1045583351
- Sigstore integration time:
-
Permalink:
sandialabs/hpc-connect@ac8a696cb82db39deddbb391c340298f91e8caff -
Branch / Tag:
refs/tags/release/26.02.24 - Owner: https://github.com/sandialabs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ac8a696cb82db39deddbb391c340298f91e8caff -
Trigger Event:
push
-
Statement type:
File details
Details for the file hpc_connect-26.3.5-py3-none-any.whl.
File metadata
- Download URL: hpc_connect-26.3.5-py3-none-any.whl
- Upload date:
- Size: 51.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f73675599bac892232abe936cb2bf988f5f7ece10a49ea6da367989f02289438
|
|
| MD5 |
9990e578662157d9e2428a68821ae156
|
|
| BLAKE2b-256 |
68e30bbda7d77466897eede5ea1ac1f243a21675da4405a6dd199bc5c9f051a7
|
Provenance
The following attestation bundles were made for hpc_connect-26.3.5-py3-none-any.whl:
Publisher:
publish.yml on sandialabs/hpc-connect
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hpc_connect-26.3.5-py3-none-any.whl -
Subject digest:
f73675599bac892232abe936cb2bf988f5f7ece10a49ea6da367989f02289438 - Sigstore transparency entry: 1045583399
- Sigstore integration time:
-
Permalink:
sandialabs/hpc-connect@ac8a696cb82db39deddbb391c340298f91e8caff -
Branch / Tag:
refs/tags/release/26.02.24 - Owner: https://github.com/sandialabs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ac8a696cb82db39deddbb391c340298f91e8caff -
Trigger Event:
push
-
Statement type: