Skip to main content

Python Binding for HPX C++ library

Project description

HPyX: Python Bindings for HPX C++ Parallelism Library

DOI BSD License Ruff

Documentation Status pre-commit.ci status CI

Project Overview

HPyX provides Python bindings for the HPX C++ Parallelism Library using Nanobind and leveraging Python 3.13's free-threading capabilities. This project aims to make HPX's powerful parallel processing features accessible to Python developers while achieving optimal performance through true multi-threading.

Status: HPyX is currently in active development as part of a research project at the University of Washington's Scientific Software Engineering Center (SSEC). The project is experimental and APIs may change as we explore optimal integration patterns between Python's free-threading mode and HPX's parallel execution model.

What is HPX?

HPX (High Performance ParalleX) is a C++ Standard Library for Concurrency and Parallelism that implements modern C++ parallelism features defined by the C++ Standard. It provides:

  • A unified API for local and remote parallel operations
  • Asynchronous execution through futures and dataflow
  • Fine-grained task parallelism
  • Support for distributed computing
  • Performance counter frameworks for runtime adaptivity

Features

  • Python Interface: Clean Python API for HPX's parallel algorithms and components
  • True Parallel Execution: Leverages Python 3.13's experimental free-threading mode
  • High-Performance Bindings: Uses Nanobind for minimal-overhead C++ integration
  • Pythonic Design: APIs that follow Python conventions while exposing HPX capabilities
  • Comprehensive Testing: Automated testing and benchmarking framework
  • Cross-Platform Support: Builds consistently on Linux, macOS, and Windows

Current Development Focus

  • Core HPX binding infrastructure
  • Python 3.13 free-threading compatibility
  • Parallel algorithm implementations
  • Performance optimization and benchmarking
  • API design and developer experience

Installation and Building

Note: HPyX is currently in active development. Pre-built packages are not yet available. Installation requires building from source using the provided build system.

HPyX uses pixi for environment and dependency management, which provides reproducible builds and handles complex C++ dependencies automatically.

Prerequisites

  • Install pixi following the instructions on the pixi documentation
  • Python 3.13 built with --disable-gil option for optimal performance
  • Modern C++ compiler with C++17 support (GCC 8+, Clang 8+, MSVC 2019+)

Setting up the environment

Clone the repository and navigate to the project directory:

git clone https://github.com/uw-ssec/HPyX.git
cd HPyX

HPyX provides predefined pixi environments (see also docs/CONTRIBUTING.md):

Environment Purpose
py313t Default development (Python 3.13 free-threading) + editable HPyX install
test-py313t Run test suite (pytest + test deps)
build-py313t Build distributions (sdist / wheel + verification)
benchmark-py313t Performance benchmarking (pytest-benchmark etc.)
docs Documentation authoring (MkDocs + plugins)
linting Lint / formatting (pre-commit)
py313t-src Advanced: build HPX from source & test against it

To create and activate an environment:

pixi shell -e py313t

Note: Environments that include the hpyx feature (e.g. py313t) automatically install HPyX in editable mode.

Available Tasks (High-Level)

pixi run get-python-version   # Show Python version
pixi run test                 # Run full test suite
pixi run benchmark            # Run benchmarks
pixi run lint                 # Lint & format (pre-commit hooks)
pixi run build                # Build sdist + wheel

Underlying / environment-scoped examples:

pixi run -e build-py313t build-sdist
pixi run -e build-py313t build-wheel
pixi run -e build-py313t build-wheel-and-test   # build wheel, install, print versions
pixi run -e benchmark-py313t run-benchmark keyword_expression=for_loop
pixi run -e benchmark-py313t run-benchmark keyword_expression=hpx_linalg

Building the Package

High-level aggregated build:

pixi run build    # Builds sdist (dist/) + wheel (wheelhouse/)

Granular control:

pixi run -e build-py313t build-sdist
pixi run -e build-py313t build-wheel
pixi run -e build-py313t build-wheel-and-test

Running tests

To run the test suite:

pixi run test

Performance Benchmarking

Run all benchmarks:

pixi run benchmark

Filter by keyword (raw task):

pixi run -e benchmark-py313t run-benchmark keyword_expression=for_loop
pixi run -e benchmark-py313t run-benchmark keyword_expression=hpx_linalg

Benchmark configuration highlights: group-by function, warmup enabled, minimum 3 rounds, time unit milliseconds.

Troubleshooting Test Issues

If you encounter errors related to duplicate library paths on macOS/Unix systems, such as:

duplicate LC_RPATH '@loader_path'

Run the library path fix task (Unix):

pixi run -e py313t fix-lib-paths

This script will automatically detect and remove duplicate RPATH entries from dynamic libraries in your conda environment, which can occur due to dependency conflicts between conda packages.

Code quality and linting

To run code quality checks and formatting:

pixi run lint

Additional utilities

Check the Python version in your current environment:

pixi run get-python-version

Documentation Development

Live docs server:

pixi run -e docs start

Simulate Read the Docs build (maintainers):

pixi run -e docs rtd-publish

Development

HPyX uses pixi for reproducible development environments and dependency management. This approach ensures consistent builds across different platforms and simplifies the complex build process for HPX and its dependencies.

Development Environment

See the environment table above (duplicated list removed for brevity).

Build Process

The build system integrates several complex components:

  1. HPX C++ Library: Conda package or optional source build via py313t-src environment
  2. Nanobind Integration: Efficient Python–C++ bindings with minimal overhead
  3. Free-Threading Support: Optimizations for Python 3.13's experimental free-threading mode
  4. Cross-Platform Support: Consistent builds on Linux, macOS, and Windows

Technical Approach

Our development approach consists of:

  1. Core Binding Layer: Low-level bindings for HPX C++ core functionality using Nanobind
  2. High-Level Python API: A Pythonic interface that wraps the core bindings
  3. Free-Threading Integration: Mechanisms to ensure the bindings work optimally with Python's free-threading mode
  4. Comprehensive Testing: Benchmarks + functionality tests to verify behavior

Advanced: Building HPX From Source

For testing unreleased HPX versions or allocator variants use the py313t-src environment:

pixi shell -e py313t-src

Key tasks:

# Build specific HPX (defaults: tag=v1.11.0-rc1 malloc=system build_dir=build)
pixi run build-hpx tag=v1.11.0-rc1 malloc=system

# Install latest RC HPX + reinstall HPyX (all extras)
pixi run install-latest-lib

# Install stable HPX + reinstall HPyX (all extras)
pixi run install-stable-lib

Arguments:

  • tag – HPX git tag
  • malloc – allocator (system default)
  • build_dir – build directory name

Helper tasks (implicit): _fetch-hpx-source, _pip-install-all, _restore-submodule.

Contributing

We welcome contributions to HPyX! Whether you're interested in fixing bugs, adding new features, improving documentation, or helping with testing, your contributions are valuable.

Please see our Contributing Guide for detailed information on:

  • Setting up the development environment with pixi
  • Understanding the build system and HPX integration
  • Running tests and benchmarks
  • Code quality standards and linting
  • Pull request process

For a quick start:

  1. Install pixi for environment management

  2. Clone the repository and activate the development environment:

    git clone https://github.com/uw-ssec/HPyX.git
    cd HPyX
    pixi shell -e py313t
    
  3. (Optional) Reinstall in editable mode (already done in py313t):

    pip install -e '.[all]'
    
  4. Run tests to verify your setup:

    pixi run test
    

You can also explore other development tasks:

pixi run benchmark    # Run performance benchmarks
pixi run lint        # Check code quality and formatting  
pixi run build       # Build distribution packages

Thanks to our contributors so far!

Contributors

License

HPyX is licensed under the BSD 3-Clause License. See the LICENSE file for details.

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

hpyx-2025.8.28.tar.gz (244.2 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

hpyx-2025.8.28-cp313-cp313t-win_amd64.whl (137.4 kB view details)

Uploaded CPython 3.13tWindows x86-64

hpyx-2025.8.28-cp313-cp313t-manylinux_2_39_x86_64.whl (5.1 MB view details)

Uploaded CPython 3.13tmanylinux: glibc 2.39+ x86-64

hpyx-2025.8.28-cp313-cp313t-macosx_15_0_arm64.whl (105.5 kB view details)

Uploaded CPython 3.13tmacOS 15.0+ ARM64

hpyx-2025.8.28-cp313-cp313t-macosx_14_0_arm64.whl (105.5 kB view details)

Uploaded CPython 3.13tmacOS 14.0+ ARM64

hpyx-2025.8.28-cp313-cp313t-macosx_13_0_x86_64.whl (109.9 kB view details)

Uploaded CPython 3.13tmacOS 13.0+ x86-64

File details

Details for the file hpyx-2025.8.28.tar.gz.

File metadata

  • Download URL: hpyx-2025.8.28.tar.gz
  • Upload date:
  • Size: 244.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for hpyx-2025.8.28.tar.gz
Algorithm Hash digest
SHA256 ce582d60d0ad50256fc8f6666d5c30be9f15af8936a8711c5f2f03404caf2958
MD5 99e9481e38ced059550cd8c482f7ec39
BLAKE2b-256 4e20c4ac767b4394de2240d49a7214899585a2faa030bbe024d130633992663c

See more details on using hashes here.

Provenance

The following attestation bundles were made for hpyx-2025.8.28.tar.gz:

Publisher: cd.yml on uw-ssec/HPyX

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hpyx-2025.8.28-cp313-cp313t-win_amd64.whl.

File metadata

  • Download URL: hpyx-2025.8.28-cp313-cp313t-win_amd64.whl
  • Upload date:
  • Size: 137.4 kB
  • Tags: CPython 3.13t, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for hpyx-2025.8.28-cp313-cp313t-win_amd64.whl
Algorithm Hash digest
SHA256 8a5e018e841f3a65c9f42baed0973d69904aea5c3f83583079839cb655af54b1
MD5 35fbd905ecd1fe51ebfb7c47ee67a7d1
BLAKE2b-256 8c8bf3573ce0892f0c93d67362c3adf79d990cddede95ae60b5978260428db3f

See more details on using hashes here.

Provenance

The following attestation bundles were made for hpyx-2025.8.28-cp313-cp313t-win_amd64.whl:

Publisher: cd.yml on uw-ssec/HPyX

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hpyx-2025.8.28-cp313-cp313t-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for hpyx-2025.8.28-cp313-cp313t-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 9a4fc131cfcdf531e5a2a7d41a83774cec607195975c3cc31f2489f23c55acef
MD5 605049e1aaf65ab5eb5bcf6ce909008f
BLAKE2b-256 63291d7b2992c99f7fc47aa8121689aa1232ede18482bffc2b26759de206e1ab

See more details on using hashes here.

Provenance

The following attestation bundles were made for hpyx-2025.8.28-cp313-cp313t-manylinux_2_39_x86_64.whl:

Publisher: cd.yml on uw-ssec/HPyX

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hpyx-2025.8.28-cp313-cp313t-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for hpyx-2025.8.28-cp313-cp313t-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 4d9b16e029d787d0f31f4f59fdbec2b5111da2ecd70b7cf8489e6f2c8a75f21d
MD5 3623f3fb228092906903ff40a0a9e9ba
BLAKE2b-256 01b12626cec908c9332ff6a65272739eb1e5e9c209f34925e10584dd84e1cf48

See more details on using hashes here.

Provenance

The following attestation bundles were made for hpyx-2025.8.28-cp313-cp313t-macosx_15_0_arm64.whl:

Publisher: cd.yml on uw-ssec/HPyX

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hpyx-2025.8.28-cp313-cp313t-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for hpyx-2025.8.28-cp313-cp313t-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 215387583ba4864f8a87281b7b9c1970464ac1dff45161e7acf36c91aab443ab
MD5 184221c1800e0d7327932eb57984513e
BLAKE2b-256 cfd28142df39bc52f04f1dc6ab0f4c54e5b88d41240c01dc2aff5482c93930f5

See more details on using hashes here.

Provenance

The following attestation bundles were made for hpyx-2025.8.28-cp313-cp313t-macosx_14_0_arm64.whl:

Publisher: cd.yml on uw-ssec/HPyX

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hpyx-2025.8.28-cp313-cp313t-macosx_13_0_x86_64.whl.

File metadata

File hashes

Hashes for hpyx-2025.8.28-cp313-cp313t-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 6c8e8c6774addd9c2c61853d7b5c9948f9a96e0b857bba874bdde9d99bbbb3bb
MD5 8382885b75dc123f84b0ff6762b9040b
BLAKE2b-256 0694a4a504a889ba5566d9f5f8e286b7bf0275cc479bdc6d65cd6a6303c43c2b

See more details on using hashes here.

Provenance

The following attestation bundles were made for hpyx-2025.8.28-cp313-cp313t-macosx_13_0_x86_64.whl:

Publisher: cd.yml on uw-ssec/HPyX

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page