pyscotch 7.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pyscotch-7.0.0/CHANGELOG.md +111 -0
- pyscotch-7.0.0/CONTRIBUTING.md +141 -0
- pyscotch-7.0.0/LICENSE +21 -0
- pyscotch-7.0.0/MANIFEST.in +27 -0
- pyscotch-7.0.0/Makefile +216 -0
- pyscotch-7.0.0/PKG-INFO +262 -0
- pyscotch-7.0.0/README.md +224 -0
- pyscotch-7.0.0/examples/distributed_coarsening.py +203 -0
- pyscotch-7.0.0/examples/graph_ordering.py +66 -0
- pyscotch-7.0.0/examples/mesh_partitioning.py +126 -0
- pyscotch-7.0.0/examples/simple_partition.py +55 -0
- pyscotch-7.0.0/patches/Makefile.inc.default +22 -0
- pyscotch-7.0.0/patches/README.md +22 -0
- pyscotch-7.0.0/pyproject.toml +75 -0
- pyscotch-7.0.0/pyscotch/__init__.py +116 -0
- pyscotch-7.0.0/pyscotch/_version.py +10 -0
- pyscotch-7.0.0/pyscotch/api_decorators.py +209 -0
- pyscotch-7.0.0/pyscotch/arch.py +241 -0
- pyscotch-7.0.0/pyscotch/cli.py +243 -0
- pyscotch-7.0.0/pyscotch/context.py +120 -0
- pyscotch-7.0.0/pyscotch/dgraph.py +1544 -0
- pyscotch-7.0.0/pyscotch/geom.py +56 -0
- pyscotch-7.0.0/pyscotch/graph.py +1532 -0
- pyscotch-7.0.0/pyscotch/libscotch.py +1101 -0
- pyscotch-7.0.0/pyscotch/mapping.py +154 -0
- pyscotch-7.0.0/pyscotch/mesh.py +318 -0
- pyscotch-7.0.0/pyscotch/mpi.py +215 -0
- pyscotch-7.0.0/pyscotch/native/file_compat.c +115 -0
- pyscotch-7.0.0/pyscotch/ordering.py +146 -0
- pyscotch-7.0.0/pyscotch/py.typed +2 -0
- pyscotch-7.0.0/pyscotch/strategy.py +373 -0
- pyscotch-7.0.0/pyscotch.egg-info/PKG-INFO +262 -0
- pyscotch-7.0.0/pyscotch.egg-info/SOURCES.txt +115 -0
- pyscotch-7.0.0/pyscotch.egg-info/dependency_links.txt +1 -0
- pyscotch-7.0.0/pyscotch.egg-info/entry_points.txt +2 -0
- pyscotch-7.0.0/pyscotch.egg-info/not-zip-safe +1 -0
- pyscotch-7.0.0/pyscotch.egg-info/requires.txt +17 -0
- pyscotch-7.0.0/pyscotch.egg-info/top_level.txt +1 -0
- pyscotch-7.0.0/scripts/build_wheel_libs.sh +164 -0
- pyscotch-7.0.0/setup.cfg +4 -0
- pyscotch-7.0.0/setup.py +130 -0
- pyscotch-7.0.0/tests/README.md +239 -0
- pyscotch-7.0.0/tests/__init__.py +1 -0
- pyscotch-7.0.0/tests/conftest.py +64 -0
- pyscotch-7.0.0/tests/hypothesis/README.md +35 -0
- pyscotch-7.0.0/tests/hypothesis/__init__.py +0 -0
- pyscotch-7.0.0/tests/hypothesis/test_graph_properties.py +310 -0
- pyscotch-7.0.0/tests/pyscotch_base/__init__.py +0 -0
- pyscotch-7.0.0/tests/pyscotch_base/conftest.py +25 -0
- pyscotch-7.0.0/tests/pyscotch_base/test_api_completeness.py +153 -0
- pyscotch-7.0.0/tests/pyscotch_base/test_architecture.py +131 -0
- pyscotch-7.0.0/tests/pyscotch_base/test_binding_signatures.py +167 -0
- pyscotch-7.0.0/tests/pyscotch_base/test_context.py +102 -0
- pyscotch-7.0.0/tests/pyscotch_base/test_custom_strategies.py +176 -0
- pyscotch-7.0.0/tests/pyscotch_base/test_error_messages.py +71 -0
- pyscotch-7.0.0/tests/pyscotch_base/test_geometry.py +25 -0
- pyscotch-7.0.0/tests/pyscotch_base/test_graph.py +139 -0
- pyscotch-7.0.0/tests/pyscotch_base/test_graph_advanced.py +157 -0
- pyscotch-7.0.0/tests/pyscotch_base/test_graph_coarsen.py +36 -0
- pyscotch-7.0.0/tests/pyscotch_base/test_int_sizes.py +157 -0
- pyscotch-7.0.0/tests/pyscotch_base/test_interop.py +481 -0
- pyscotch-7.0.0/tests/pyscotch_base/test_mapping_ordering.py +217 -0
- pyscotch-7.0.0/tests/pyscotch_base/test_mesh_advanced.py +109 -0
- pyscotch-7.0.0/tests/pyscotch_base/test_module_functions.py +62 -0
- pyscotch-7.0.0/tests/pyscotch_base/test_random_enhanced.py +125 -0
- pyscotch-7.0.0/tests/pyscotch_base/test_scotch_compat.py +382 -0
- pyscotch-7.0.0/tests/pyscotch_base/test_structure_sizing.py +341 -0
- pyscotch-7.0.0/tests/pyscotch_base/test_symbol_prefixes.py +275 -0
- pyscotch-7.0.0/tests/pyscotch_integration/distributed_coarsening_workflow.py +244 -0
- pyscotch-7.0.0/tests/pyscotch_integration/orchestrated_mesh_partitioning.py +84 -0
- pyscotch-7.0.0/tests/pyscotch_integration/orchestrated_sequential_partitioning.py +72 -0
- pyscotch-7.0.0/tests/pyscotch_integration/test_orchestrator.py +122 -0
- pyscotch-7.0.0/tests/scotch_ports/API_ANALYSIS.md +212 -0
- pyscotch-7.0.0/tests/scotch_ports/PORTING_STATUS.md +124 -0
- pyscotch-7.0.0/tests/scotch_ports/_DGRAPH_MPI_NOTE.md +42 -0
- pyscotch-7.0.0/tests/scotch_ports/__init__.py +0 -0
- pyscotch-7.0.0/tests/scotch_ports/test_common_file_compress.py +24 -0
- pyscotch-7.0.0/tests/scotch_ports/test_common_random.py +107 -0
- pyscotch-7.0.0/tests/scotch_ports/test_common_thread.py +29 -0
- pyscotch-7.0.0/tests/scotch_ports/test_fibo.py +27 -0
- pyscotch-7.0.0/tests/scotch_ports/test_libesmumps.py +15 -0
- pyscotch-7.0.0/tests/scotch_ports/test_libmetis.py +17 -0
- pyscotch-7.0.0/tests/scotch_ports/test_libmetis_dual.py +14 -0
- pyscotch-7.0.0/tests/scotch_ports/test_multilib.py +59 -0
- pyscotch-7.0.0/tests/scotch_ports/test_scotch_arch_deco.py +176 -0
- pyscotch-7.0.0/tests/scotch_ports/test_scotch_context.py +34 -0
- pyscotch-7.0.0/tests/scotch_ports/test_scotch_dgraph_band.py +11 -0
- pyscotch-7.0.0/tests/scotch_ports/test_scotch_dgraph_check.py +11 -0
- pyscotch-7.0.0/tests/scotch_ports/test_scotch_dgraph_coarsen.py +11 -0
- pyscotch-7.0.0/tests/scotch_ports/test_scotch_dgraph_grow.py +11 -0
- pyscotch-7.0.0/tests/scotch_ports/test_scotch_dgraph_induce.py +11 -0
- pyscotch-7.0.0/tests/scotch_ports/test_scotch_dgraph_redist.py +11 -0
- pyscotch-7.0.0/tests/scotch_ports/test_scotch_graph_coarsen.py +161 -0
- pyscotch-7.0.0/tests/scotch_ports/test_scotch_graph_color.py +138 -0
- pyscotch-7.0.0/tests/scotch_ports/test_scotch_graph_diam.py +128 -0
- pyscotch-7.0.0/tests/scotch_ports/test_scotch_graph_dump.py +154 -0
- pyscotch-7.0.0/tests/scotch_ports/test_scotch_graph_induce.py +133 -0
- pyscotch-7.0.0/tests/scotch_ports/test_scotch_graph_map_copy.py +198 -0
- pyscotch-7.0.0/tests/scotch_ports/test_scotch_graph_part_ovl.py +98 -0
- pyscotch-7.0.0/tests/scotch_ports/test_scotch_mesh_graph.py +47 -0
- pyscotch-7.0.0/tests/scotch_ports/test_strat_par.py +25 -0
- pyscotch-7.0.0/tests/scotch_ports_mpi/__init__.py +5 -0
- pyscotch-7.0.0/tests/scotch_ports_mpi/mpi_scripts/dgraph_band.py +163 -0
- pyscotch-7.0.0/tests/scotch_ports_mpi/mpi_scripts/dgraph_build.py +89 -0
- pyscotch-7.0.0/tests/scotch_ports_mpi/mpi_scripts/dgraph_check.py +90 -0
- pyscotch-7.0.0/tests/scotch_ports_mpi/mpi_scripts/dgraph_check_real.py +82 -0
- pyscotch-7.0.0/tests/scotch_ports_mpi/mpi_scripts/dgraph_coarsen.py +163 -0
- pyscotch-7.0.0/tests/scotch_ports_mpi/mpi_scripts/dgraph_gather_scatter.py +124 -0
- pyscotch-7.0.0/tests/scotch_ports_mpi/mpi_scripts/dgraph_grid_stat.py +91 -0
- pyscotch-7.0.0/tests/scotch_ports_mpi/mpi_scripts/dgraph_grow.py +175 -0
- pyscotch-7.0.0/tests/scotch_ports_mpi/mpi_scripts/dgraph_induce_part.py +175 -0
- pyscotch-7.0.0/tests/scotch_ports_mpi/mpi_scripts/dgraph_init.py +65 -0
- pyscotch-7.0.0/tests/scotch_ports_mpi/mpi_scripts/dgraph_order.py +250 -0
- pyscotch-7.0.0/tests/scotch_ports_mpi/mpi_scripts/dgraph_order_extra.py +143 -0
- pyscotch-7.0.0/tests/scotch_ports_mpi/mpi_scripts/dgraph_part.py +140 -0
- pyscotch-7.0.0/tests/scotch_ports_mpi/mpi_scripts/dgraph_redist.py +135 -0
- pyscotch-7.0.0/tests/scotch_ports_mpi/test_dgraph.py +291 -0
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
## [7.0.0] - 2026-07-13
|
|
11
|
+
|
|
12
|
+
### Changed - Versioning scheme
|
|
13
|
+
- Versions now mirror the supported Scotch series: `X.Y` = Scotch major.minor
|
|
14
|
+
(7.0.x), the patch digit is PyScotch's own release counter. Hence the jump
|
|
15
|
+
from 0.2.0 to 7.0.0.
|
|
16
|
+
|
|
17
|
+
### Added - Interop
|
|
18
|
+
- `Graph.from_scipy_sparse()` / `Graph.to_scipy_sparse()` — exact CSR round-trips, strict symmetry/self-loop/weight validation
|
|
19
|
+
- `Graph.from_networkx()` / `Graph.to_networkx()` — arbitrary node labels via `(graph, nodes)` mapping
|
|
20
|
+
- `interop` optional dependency extra (`pip install "pyscotch[interop]"`)
|
|
21
|
+
|
|
22
|
+
### Added - Packaging & Distribution
|
|
23
|
+
- Binary wheel pipeline: `.github/workflows/wheels.yml` (cibuildwheel, manylinux_2_28, x86_64 + aarch64), `scripts/build_wheel_libs.sh`, `MANIFEST.in`; wheels bundle sequential Scotch (32- and 64-bit) and are tagged `py3-none-<platform>`
|
|
24
|
+
- System-Scotch support: automatic fallback to distro/conda `libscotch` (dlopen by soname), `PYSCOTCH_SYSTEM=1` to force it, `PYSCOTCH_LIB_DIR` explicit override
|
|
25
|
+
- Unsuffixed-symbol support with integer-width verification via `SCOTCH_numSizeof()` — unblocks conda-forge (`packaging/conda/meta.yaml` recipe skeleton)
|
|
26
|
+
- `c_fopen` falls back to the platform libc when no compat shim is present (system-Scotch mode)
|
|
27
|
+
|
|
28
|
+
### Added - Verification & Testing
|
|
29
|
+
- `tests/pyscotch_base/test_binding_signatures.py` — every ctypes binding diff-checked against the parsed Scotch headers (existence, arg counts, arg types, return types)
|
|
30
|
+
- 26 behavioral tests upgrading coverage: save/load roundtrips parsed back, hand-checked `graphStat`/mesh duals, context determinism, all 10 architecture topologies, `dgraphCoarsenVertLocMax` under mpirun
|
|
31
|
+
- 42 interop tests (round-trips, validation errors, karate-club end-to-end partition)
|
|
32
|
+
|
|
33
|
+
### Added - Documentation
|
|
34
|
+
- Auto-generated API reference (`docs/site/gen_api.py`) from the `@scotch_binding` decorator registries, with coverage stats
|
|
35
|
+
- SVG diagrams replacing ASCII art (triangle graph, multilevel V-cycle, architecture layers); flat single-surface site theme; GitHub Primer syntax highlighting
|
|
36
|
+
- `docs/FINDINGS.md` — index of all internal and upstream findings
|
|
37
|
+
|
|
38
|
+
### Changed
|
|
39
|
+
- **Default variant is now 64-bit sequential** (`PYSCOTCH_INT_SIZE=64`, `PYSCOTCH_PARALLEL=0`; was 32/0 in code, documented as 64/1). 64-bit indices are safe at any graph size, and a sequential default is required for the binary wheels, which do not ship PT-Scotch. conda-forge's `scotch` is 64-bit, so it matches the new default; a mismatched-width system Scotch gets a load-time error naming the correct `PYSCOTCH_INT_SIZE`.
|
|
40
|
+
|
|
41
|
+
### Fixed - Binding signatures (found by the new signature verifier)
|
|
42
|
+
- `SCOTCH_meshBuild` (missing parameter), `SCOTCH_meshData` (3 missing parameters), `SCOTCH_dgraphData` (misaligned 16/17 layout)
|
|
43
|
+
- `SCOTCH_version` now uses `int*` per the header (was `SCOTCH_Num*`)
|
|
44
|
+
- `SCOTCH_memCur`/`SCOTCH_memMax` return `SCOTCH_Idx` (was wrong-width `c_long` on 32-bit)
|
|
45
|
+
- `Dgraph.data()` MPI communicator buffer widened to `c_void_p` — was a 4-byte buffer receiving an 8-byte OpenMPI handle (memory corruption)
|
|
46
|
+
- `SCOTCH_memFree` resolved despite upstream exporting it unsuffixed
|
|
47
|
+
|
|
48
|
+
### Upstream (reported in docs/QUESTIONS_FOR_SCOTCH_TEAM_2.md)
|
|
49
|
+
- Scotch 7.0.12 does not build with `SCOTCH_RENAME_ALL` (`SCOTCH_meshBuildElem` missing from module.h) — verified fix in `patches/scotch-7.0.12-rename-all-fix.patch`; full suite passes on patched 7.0.12
|
|
50
|
+
- `SCOTCH_memFree` missing from the module.h rename table (7.0.11 and 7.0.12)
|
|
51
|
+
- `SCOTCH_contextOptionSetNum` switches on the option value instead of the option index
|
|
52
|
+
|
|
53
|
+
## [0.2.0] - 2025-11-18
|
|
54
|
+
|
|
55
|
+
### Added - Distributed Graph Operations (Phase 1 Complete! 🎉)
|
|
56
|
+
- **NEW:** `Dgraph.ghst()` - Compute ghost edge array for distributed graphs
|
|
57
|
+
- **NEW:** `Dgraph.grow()` - Grow subgraphs from seed vertices (adaptive mesh refinement)
|
|
58
|
+
- **NEW:** `Dgraph.band()` - Extract band graph from frontier (sparse matrix reordering)
|
|
59
|
+
- **NEW:** `Dgraph.redist()` - Redistribute graph across processes (dynamic load balancing)
|
|
60
|
+
- **NEW:** `Dgraph.induce_part()` - Extract induced subgraph from partition (hierarchical partitioning)
|
|
61
|
+
- **100% Scotch Coverage:** All 6 Scotch distributed graph operations now implemented!
|
|
62
|
+
|
|
63
|
+
### Added - Testing & Validation
|
|
64
|
+
- Integration test: Sequential partitioning workflow (end-to-end)
|
|
65
|
+
- Integration test: Distributed coarsening workflow (MPI)
|
|
66
|
+
- Integration test: Mesh partitioning workflow
|
|
67
|
+
- 4 new MPI test ports matching Scotch C tests exactly:
|
|
68
|
+
- `dgraph_grow.py` - Region growing test
|
|
69
|
+
- `dgraph_band.py` - Band graph extraction test
|
|
70
|
+
- `dgraph_redist.py` - Graph redistribution test
|
|
71
|
+
- `dgraph_induce_part.py` - Induced subgraph test
|
|
72
|
+
- Total test count: 192 passing tests (was 188)
|
|
73
|
+
|
|
74
|
+
### Added - Examples & Documentation
|
|
75
|
+
- `examples/distributed_coarsening.py` - MPI coarsening example
|
|
76
|
+
- `examples/mesh_partitioning.py` - Mesh partitioning example
|
|
77
|
+
- `examples/README.md` - Comprehensive examples documentation
|
|
78
|
+
- `benchmarks/benchmark_sequential_partitioning.py` - Performance benchmarking
|
|
79
|
+
- `benchmarks/benchmark_distributed_operations.py` - MPI benchmarking
|
|
80
|
+
- `benchmarks/README.md` - Benchmark documentation
|
|
81
|
+
- Updated `ROADMAP.md` - Phase 1 complete, now 80% overall completion
|
|
82
|
+
- Updated `MPI_TEST_COVERAGE.md` - 100% coverage achieved
|
|
83
|
+
|
|
84
|
+
### Added - Build & Development
|
|
85
|
+
- `make test` now runs `pytest -vvvv` for detailed test output
|
|
86
|
+
- Makefile improvements for better developer experience
|
|
87
|
+
|
|
88
|
+
### Changed
|
|
89
|
+
- Project completion: 65% → 80% (Phase 1 complete)
|
|
90
|
+
- MPI test coverage: 33% → 100% (6/6 operations)
|
|
91
|
+
- Documentation updated to reflect new capabilities
|
|
92
|
+
|
|
93
|
+
### Performance
|
|
94
|
+
- All distributed operations tested and validated
|
|
95
|
+
- Benchmarks available for performance comparison
|
|
96
|
+
- Ready for production distributed graph processing
|
|
97
|
+
|
|
98
|
+
## [0.1.0] - 2024-XX-XX
|
|
99
|
+
|
|
100
|
+
### Added
|
|
101
|
+
- Initial release
|
|
102
|
+
- Graph partitioning support
|
|
103
|
+
- Mesh partitioning support
|
|
104
|
+
- Sparse matrix ordering support
|
|
105
|
+
- Command-line interface
|
|
106
|
+
- Python API with type hints
|
|
107
|
+
- PT-Scotch library integration
|
|
108
|
+
- Makefile-based build system
|
|
109
|
+
|
|
110
|
+
[Unreleased]: https://github.com/c4ffein/pyscotch/compare/v0.1.0...HEAD
|
|
111
|
+
[0.1.0]: https://github.com/c4ffein/pyscotch/releases/tag/v0.1.0
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
# Contributing to PyScotch
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing to PyScotch!
|
|
4
|
+
|
|
5
|
+
## Development Setup
|
|
6
|
+
|
|
7
|
+
1. Clone the repository:
|
|
8
|
+
```bash
|
|
9
|
+
git clone <repository-url>
|
|
10
|
+
cd pyscotch
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
2. Add the Scotch submodule:
|
|
14
|
+
```bash
|
|
15
|
+
git submodule add https://gitlab.inria.fr/scotch/scotch.git external/scotch
|
|
16
|
+
git submodule update --init --recursive
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
3. Build the Scotch library:
|
|
20
|
+
```bash
|
|
21
|
+
make build-scotch
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
4. Install development dependencies:
|
|
25
|
+
```bash
|
|
26
|
+
pip install -e ".[dev]"
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Building the Library
|
|
30
|
+
|
|
31
|
+
The project uses a Makefile to build the Scotch library:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
# Build sequential Scotch
|
|
35
|
+
make build-scotch
|
|
36
|
+
|
|
37
|
+
# Build parallel PT-Scotch
|
|
38
|
+
make build-ptscotch
|
|
39
|
+
|
|
40
|
+
# Build both
|
|
41
|
+
make all
|
|
42
|
+
|
|
43
|
+
# Clean build artifacts
|
|
44
|
+
make clean-scotch
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Code Style
|
|
48
|
+
|
|
49
|
+
- Follow PEP 8 guidelines
|
|
50
|
+
- Use type hints where possible
|
|
51
|
+
- Maximum line length: 100 characters
|
|
52
|
+
- Use Black for formatting: `black pyscotch/`
|
|
53
|
+
- Run flake8 for linting: `flake8 pyscotch/`
|
|
54
|
+
|
|
55
|
+
## Testing
|
|
56
|
+
|
|
57
|
+
Run tests with pytest:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
# Run all tests
|
|
61
|
+
pytest tests/
|
|
62
|
+
|
|
63
|
+
# Run with coverage
|
|
64
|
+
pytest tests/ --cov=pyscotch --cov-report=html
|
|
65
|
+
|
|
66
|
+
# Run specific test file
|
|
67
|
+
pytest tests/test_graph.py -v
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Note: Tests require the Scotch library to be built first.
|
|
71
|
+
|
|
72
|
+
## Documentation
|
|
73
|
+
|
|
74
|
+
- Add docstrings to all public functions and classes
|
|
75
|
+
- Follow Google-style docstring format
|
|
76
|
+
- Update API.md when adding new features
|
|
77
|
+
- Add examples for significant new features
|
|
78
|
+
|
|
79
|
+
## Pull Request Process
|
|
80
|
+
|
|
81
|
+
1. Fork the repository
|
|
82
|
+
2. Create a feature branch: `git checkout -b feature/my-feature`
|
|
83
|
+
3. Make your changes
|
|
84
|
+
4. Add tests for new functionality
|
|
85
|
+
5. Ensure all tests pass
|
|
86
|
+
6. Update documentation
|
|
87
|
+
7. Commit with clear messages
|
|
88
|
+
8. Push to your fork
|
|
89
|
+
9. Open a pull request
|
|
90
|
+
|
|
91
|
+
## Commit Message Guidelines
|
|
92
|
+
|
|
93
|
+
- Use present tense: "Add feature" not "Added feature"
|
|
94
|
+
- Use imperative mood: "Move cursor to..." not "Moves cursor to..."
|
|
95
|
+
- Reference issues and pull requests when relevant
|
|
96
|
+
- First line: brief summary (50 chars or less)
|
|
97
|
+
- Followed by blank line and detailed description if needed
|
|
98
|
+
|
|
99
|
+
## Adding New Features
|
|
100
|
+
|
|
101
|
+
When adding new PT-Scotch functionality:
|
|
102
|
+
|
|
103
|
+
1. Add low-level bindings in `libscotch.py`
|
|
104
|
+
2. Create or update high-level Python class
|
|
105
|
+
3. Add CLI command if appropriate (in `cli.py`)
|
|
106
|
+
4. Write tests
|
|
107
|
+
5. Update documentation
|
|
108
|
+
6. Add example if helpful
|
|
109
|
+
|
|
110
|
+
## Project Structure
|
|
111
|
+
|
|
112
|
+
```
|
|
113
|
+
pyscotch/
|
|
114
|
+
├── pyscotch/ # Main package
|
|
115
|
+
│ ├── __init__.py # Package initialization
|
|
116
|
+
│ ├── libscotch.py # Low-level C bindings
|
|
117
|
+
│ ├── graph.py # Graph class
|
|
118
|
+
│ ├── mesh.py # Mesh class
|
|
119
|
+
│ ├── strategy.py # Strategy class
|
|
120
|
+
│ ├── arch.py # Architecture class
|
|
121
|
+
│ ├── mapping.py # Mapping class
|
|
122
|
+
│ ├── ordering.py # Ordering class
|
|
123
|
+
│ └── cli.py # Command-line interface
|
|
124
|
+
├── tests/ # Test files
|
|
125
|
+
├── examples/ # Example scripts
|
|
126
|
+
├── docs/ # Documentation
|
|
127
|
+
├── external/ # External dependencies
|
|
128
|
+
│ └── scotch/ # Scotch submodule
|
|
129
|
+
├── Makefile # Build system
|
|
130
|
+
└── setup.py # Package configuration
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Questions?
|
|
134
|
+
|
|
135
|
+
Feel free to open an issue for:
|
|
136
|
+
- Bug reports
|
|
137
|
+
- Feature requests
|
|
138
|
+
- Questions about usage or development
|
|
139
|
+
- Documentation improvements
|
|
140
|
+
|
|
141
|
+
Thank you for contributing!
|
pyscotch-7.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 c4ffein
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# sdist contents. sdist users build Scotch from source (see README), so the
|
|
2
|
+
# sdist ships the build tooling (Makefile, patches, compat C source) but NEVER
|
|
3
|
+
# any prebuilt binaries, the scotch submodule, or local build trees.
|
|
4
|
+
include README.md
|
|
5
|
+
include LICENSE
|
|
6
|
+
include CHANGELOG.md
|
|
7
|
+
include CONTRIBUTING.md
|
|
8
|
+
include Makefile
|
|
9
|
+
include pyproject.toml
|
|
10
|
+
include pyscotch/py.typed
|
|
11
|
+
recursive-include pyscotch/native *.c
|
|
12
|
+
recursive-include patches *
|
|
13
|
+
recursive-include scripts *.sh
|
|
14
|
+
recursive-include tests *.py *.md
|
|
15
|
+
recursive-include examples *.py
|
|
16
|
+
|
|
17
|
+
# Never ship binaries or build trees in the sdist. Note: this does not affect
|
|
18
|
+
# binary wheels — the pyscotch/_libs/*.so files are included in wheels via the
|
|
19
|
+
# explicit package_data globs in setup.py.
|
|
20
|
+
prune pyscotch/_libs
|
|
21
|
+
prune scotch-builds
|
|
22
|
+
prune external
|
|
23
|
+
prune docs
|
|
24
|
+
prune benchmarks
|
|
25
|
+
prune scotchpy
|
|
26
|
+
global-exclude *.so *.a *.o *.py[cod]
|
|
27
|
+
global-exclude __pycache__
|
pyscotch-7.0.0/Makefile
ADDED
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
# Makefile for building PT-Scotch and PyScotch
|
|
2
|
+
|
|
3
|
+
# Directories
|
|
4
|
+
SCOTCH_DIR = external/scotch
|
|
5
|
+
SCOTCH_SRC = $(SCOTCH_DIR)/src
|
|
6
|
+
BUILDS_DIR = scotch-builds
|
|
7
|
+
|
|
8
|
+
# Compiler settings
|
|
9
|
+
CC = gcc
|
|
10
|
+
MPICC = mpicc
|
|
11
|
+
LDFLAGS = -lm -lpthread -lz
|
|
12
|
+
|
|
13
|
+
# Platform detection
|
|
14
|
+
UNAME_S := $(shell uname -s)
|
|
15
|
+
ifeq ($(UNAME_S),Linux)
|
|
16
|
+
SHARED_EXT = so
|
|
17
|
+
SHARED_FLAGS = -shared
|
|
18
|
+
endif
|
|
19
|
+
ifeq ($(UNAME_S),Darwin)
|
|
20
|
+
SHARED_EXT = dylib
|
|
21
|
+
SHARED_FLAGS = -dynamiclib
|
|
22
|
+
endif
|
|
23
|
+
|
|
24
|
+
# Targets
|
|
25
|
+
.PHONY: all build-all build-32 build-64 build-seq-only build-seq-32 build-seq-64 clean clean-scotch install test test-full test-quadrant help
|
|
26
|
+
|
|
27
|
+
help:
|
|
28
|
+
@echo "PyScotch Build System"
|
|
29
|
+
@echo "====================="
|
|
30
|
+
@echo ""
|
|
31
|
+
@echo "Build targets:"
|
|
32
|
+
@echo " make build-all - Build all 4 variants (scotch+ptscotch × 32+64-bit)"
|
|
33
|
+
@echo " make build-32 - Build both scotch and ptscotch with 32-bit integers"
|
|
34
|
+
@echo " make build-64 - Build both scotch and ptscotch with 64-bit integers"
|
|
35
|
+
@echo " make build-seq-only - Build sequential-only libscotch (32+64-bit, no MPI needed)"
|
|
36
|
+
@echo ""
|
|
37
|
+
@echo "Output structure:"
|
|
38
|
+
@echo " scotch-builds/lib32/ - Sequential & parallel libraries (32-bit)"
|
|
39
|
+
@echo " scotch-builds/lib64/ - Sequential & parallel libraries (64-bit)"
|
|
40
|
+
@echo " scotch-builds/inc32/ - Headers (32-bit: SCOTCH_Num = int)"
|
|
41
|
+
@echo " scotch-builds/inc64/ - Headers (64-bit: SCOTCH_Num = int64_t)"
|
|
42
|
+
@echo ""
|
|
43
|
+
@echo "Other targets:"
|
|
44
|
+
@echo " make install - Install Python package"
|
|
45
|
+
@echo " make test - Run tests (64-bit parallel, skips hypothesis)"
|
|
46
|
+
@echo " make test-full - Run full test suite including hypothesis"
|
|
47
|
+
@echo " make test-quadrant - Run all 4 variants (32/64 × seq/parallel) with hypothesis"
|
|
48
|
+
@echo " make clean - Clean Python build artifacts"
|
|
49
|
+
@echo " make clean-scotch - Clean all Scotch builds"
|
|
50
|
+
@echo " make check-submodule - Gets Scotch as a submodule"
|
|
51
|
+
@echo ""
|
|
52
|
+
|
|
53
|
+
# Build all variants
|
|
54
|
+
all: build-all
|
|
55
|
+
|
|
56
|
+
build-all: build-32 build-64
|
|
57
|
+
@echo ""
|
|
58
|
+
@echo "✓ All Scotch variants built successfully!"
|
|
59
|
+
@echo " - scotch-builds/lib32/ (sequential + parallel, 32-bit)"
|
|
60
|
+
@echo " - scotch-builds/lib64/ (sequential + parallel, 64-bit)"
|
|
61
|
+
|
|
62
|
+
# Build 32-bit variants (sequential + parallel) with suffix
|
|
63
|
+
build-32: check-submodule
|
|
64
|
+
@echo "=========================================="
|
|
65
|
+
@echo "Building 32-bit Scotch with suffix '_32'"
|
|
66
|
+
@echo "=========================================="
|
|
67
|
+
@mkdir -p $(BUILDS_DIR)/lib32 $(BUILDS_DIR)/inc32
|
|
68
|
+
@cd $(SCOTCH_SRC) && $(MAKE) realclean
|
|
69
|
+
@echo ""
|
|
70
|
+
@echo "[1/3] Building sequential scotch (32-bit + suffix)..."
|
|
71
|
+
@cd $(SCOTCH_SRC) && \
|
|
72
|
+
$(MAKE) scotch CFLAGS="$$(grep '^CFLAGS' Makefile.inc | cut -d= -f2-) -DSCOTCH_NAME_SUFFIX=_32 -DSCOTCH_RENAME_ALL" || true
|
|
73
|
+
@echo ""
|
|
74
|
+
@echo "[2/3] Building parallel ptscotch (32-bit + suffix)..."
|
|
75
|
+
@cd $(SCOTCH_SRC) && \
|
|
76
|
+
$(MAKE) ptscotch CFLAGS="$$(grep '^CFLAGS' Makefile.inc | cut -d= -f2-) -DSCOTCH_NAME_SUFFIX=_32 -DSCOTCH_RENAME_ALL" || true
|
|
77
|
+
@echo ""
|
|
78
|
+
@echo "[3/3] Building PyScotch file compatibility layer (32-bit)..."
|
|
79
|
+
@$(CC) $(SHARED_FLAGS) -fPIC -O2 -o $(BUILDS_DIR)/lib32/libpyscotch_compat.$(SHARED_EXT) \
|
|
80
|
+
pyscotch/native/file_compat.c
|
|
81
|
+
@echo ""
|
|
82
|
+
@echo "Copying 32-bit libraries and headers..."
|
|
83
|
+
@cp -f $(SCOTCH_DIR)/lib/lib*scotch*.$(SHARED_EXT) $(BUILDS_DIR)/lib32/ 2>/dev/null || true
|
|
84
|
+
@cp -f $(SCOTCH_DIR)/lib/lib*scotch*.a $(BUILDS_DIR)/lib32/ 2>/dev/null || true
|
|
85
|
+
@cp -f $(SCOTCH_DIR)/include/*.h $(BUILDS_DIR)/inc32/ 2>/dev/null || true
|
|
86
|
+
@echo "✓ 32-bit build complete: scotch-builds/{lib32,inc32}/"
|
|
87
|
+
|
|
88
|
+
# Build 64-bit variants (sequential + parallel) with suffix
|
|
89
|
+
build-64: check-submodule
|
|
90
|
+
@echo "=========================================="
|
|
91
|
+
@echo "Building 64-bit Scotch with suffix '_64'"
|
|
92
|
+
@echo "=========================================="
|
|
93
|
+
@mkdir -p $(BUILDS_DIR)/lib64 $(BUILDS_DIR)/inc64
|
|
94
|
+
@cd $(SCOTCH_SRC) && $(MAKE) realclean
|
|
95
|
+
@echo ""
|
|
96
|
+
@echo "[1/3] Building sequential scotch (64-bit + suffix)..."
|
|
97
|
+
@cd $(SCOTCH_SRC) && \
|
|
98
|
+
$(MAKE) scotch CFLAGS="$$(grep '^CFLAGS' Makefile.inc | cut -d= -f2-) -DINTSIZE64 -DSCOTCH_NAME_SUFFIX=_64 -DSCOTCH_RENAME_ALL" || true
|
|
99
|
+
@echo ""
|
|
100
|
+
@echo "[2/3] Building parallel ptscotch (64-bit + suffix)..."
|
|
101
|
+
@cd $(SCOTCH_SRC) && \
|
|
102
|
+
$(MAKE) ptscotch CFLAGS="$$(grep '^CFLAGS' Makefile.inc | cut -d= -f2-) -DINTSIZE64 -DSCOTCH_NAME_SUFFIX=_64 -DSCOTCH_RENAME_ALL" || true
|
|
103
|
+
@echo ""
|
|
104
|
+
@echo "[3/3] Building PyScotch file compatibility layer (64-bit)..."
|
|
105
|
+
@$(CC) $(SHARED_FLAGS) -fPIC -O2 -o $(BUILDS_DIR)/lib64/libpyscotch_compat.$(SHARED_EXT) \
|
|
106
|
+
pyscotch/native/file_compat.c
|
|
107
|
+
@echo ""
|
|
108
|
+
@echo "Copying 64-bit libraries and headers..."
|
|
109
|
+
@cp -f $(SCOTCH_DIR)/lib/lib*scotch*.$(SHARED_EXT) $(BUILDS_DIR)/lib64/ 2>/dev/null || true
|
|
110
|
+
@cp -f $(SCOTCH_DIR)/lib/lib*scotch*.a $(BUILDS_DIR)/lib64/ 2>/dev/null || true
|
|
111
|
+
@cp -f $(SCOTCH_DIR)/include/*.h $(BUILDS_DIR)/inc64/ 2>/dev/null || true
|
|
112
|
+
@echo "✓ 64-bit build complete: scotch-builds/{lib64,inc64}/"
|
|
113
|
+
|
|
114
|
+
# Sequential-only builds (no MPI toolchain required).
|
|
115
|
+
# Used for binary wheels: builds only libscotch/libscotcherr (suffixed) plus the
|
|
116
|
+
# PyScotch compat layer. Unlike build-32/build-64, failures are NOT swallowed.
|
|
117
|
+
build-seq-only: build-seq-32 build-seq-64
|
|
118
|
+
@echo ""
|
|
119
|
+
@echo "✓ Sequential-only Scotch variants built successfully!"
|
|
120
|
+
|
|
121
|
+
build-seq-32: check-submodule
|
|
122
|
+
@echo "=========================================="
|
|
123
|
+
@echo "Building sequential-only 32-bit Scotch ('_32' suffix)"
|
|
124
|
+
@echo "=========================================="
|
|
125
|
+
@mkdir -p $(BUILDS_DIR)/lib32 $(BUILDS_DIR)/inc32
|
|
126
|
+
@cd $(SCOTCH_SRC) && $(MAKE) realclean
|
|
127
|
+
@cd $(SCOTCH_SRC) && \
|
|
128
|
+
$(MAKE) libscotch CFLAGS="$$(grep '^CFLAGS' Makefile.inc | cut -d= -f2-) -DSCOTCH_NAME_SUFFIX=_32 -DSCOTCH_RENAME_ALL"
|
|
129
|
+
@$(CC) $(SHARED_FLAGS) -fPIC -O2 -o $(BUILDS_DIR)/lib32/libpyscotch_compat.$(SHARED_EXT) \
|
|
130
|
+
pyscotch/native/file_compat.c
|
|
131
|
+
@cp -f $(SCOTCH_DIR)/lib/libscotch.$(SHARED_EXT) $(SCOTCH_DIR)/lib/libscotcherr*.$(SHARED_EXT) $(BUILDS_DIR)/lib32/
|
|
132
|
+
@cp -f $(SCOTCH_DIR)/include/*.h $(BUILDS_DIR)/inc32/
|
|
133
|
+
@echo "✓ Sequential 32-bit build complete: scotch-builds/{lib32,inc32}/"
|
|
134
|
+
|
|
135
|
+
build-seq-64: check-submodule
|
|
136
|
+
@echo "=========================================="
|
|
137
|
+
@echo "Building sequential-only 64-bit Scotch ('_64' suffix)"
|
|
138
|
+
@echo "=========================================="
|
|
139
|
+
@mkdir -p $(BUILDS_DIR)/lib64 $(BUILDS_DIR)/inc64
|
|
140
|
+
@cd $(SCOTCH_SRC) && $(MAKE) realclean
|
|
141
|
+
@cd $(SCOTCH_SRC) && \
|
|
142
|
+
$(MAKE) libscotch CFLAGS="$$(grep '^CFLAGS' Makefile.inc | cut -d= -f2-) -DINTSIZE64 -DSCOTCH_NAME_SUFFIX=_64 -DSCOTCH_RENAME_ALL"
|
|
143
|
+
@$(CC) $(SHARED_FLAGS) -fPIC -O2 -o $(BUILDS_DIR)/lib64/libpyscotch_compat.$(SHARED_EXT) \
|
|
144
|
+
pyscotch/native/file_compat.c
|
|
145
|
+
@cp -f $(SCOTCH_DIR)/lib/libscotch.$(SHARED_EXT) $(SCOTCH_DIR)/lib/libscotcherr*.$(SHARED_EXT) $(BUILDS_DIR)/lib64/
|
|
146
|
+
@cp -f $(SCOTCH_DIR)/include/*.h $(BUILDS_DIR)/inc64/
|
|
147
|
+
@echo "✓ Sequential 64-bit build complete: scotch-builds/{lib64,inc64}/"
|
|
148
|
+
|
|
149
|
+
# Check if scotch submodule exists and apply patches
|
|
150
|
+
check-submodule:
|
|
151
|
+
@if [ ! -d "$(SCOTCH_DIR)" ] || [ ! -f "$(SCOTCH_DIR)/README.md" ]; then \
|
|
152
|
+
echo "Scotch submodule not initialized. Initializing..."; \
|
|
153
|
+
git submodule update --init --recursive; \
|
|
154
|
+
echo "✓ Submodule initialized"; \
|
|
155
|
+
fi
|
|
156
|
+
@if [ ! -f "$(SCOTCH_SRC)/Makefile.inc" ]; then \
|
|
157
|
+
echo "Creating default Makefile.inc..."; \
|
|
158
|
+
cp patches/Makefile.inc.default $(SCOTCH_SRC)/Makefile.inc; \
|
|
159
|
+
echo "✓ Makefile.inc created"; \
|
|
160
|
+
fi
|
|
161
|
+
@echo "✓ Submodule ready"
|
|
162
|
+
|
|
163
|
+
# Install Python package
|
|
164
|
+
install:
|
|
165
|
+
pip install -e .
|
|
166
|
+
|
|
167
|
+
# Run tests (64-bit parallel by default, skip slow hypothesis tests)
|
|
168
|
+
test:
|
|
169
|
+
PYSCOTCH_INT_SIZE=64 PYSCOTCH_PARALLEL=1 pytest tests/ -v --ignore=tests/hypothesis/
|
|
170
|
+
|
|
171
|
+
# Run full test suite including hypothesis property tests
|
|
172
|
+
test-full:
|
|
173
|
+
PYSCOTCH_INT_SIZE=64 PYSCOTCH_PARALLEL=1 pytest tests/ -v
|
|
174
|
+
|
|
175
|
+
# Run all 4 variants (32/64-bit × sequential/parallel) with hypothesis
|
|
176
|
+
test-quadrant:
|
|
177
|
+
@echo "========================================"
|
|
178
|
+
@echo "[1/4] Testing 32-bit sequential"
|
|
179
|
+
@echo "========================================"
|
|
180
|
+
PYSCOTCH_INT_SIZE=32 PYSCOTCH_PARALLEL=0 pytest tests/ -v
|
|
181
|
+
@echo ""
|
|
182
|
+
@echo "========================================"
|
|
183
|
+
@echo "[2/4] Testing 32-bit parallel"
|
|
184
|
+
@echo "========================================"
|
|
185
|
+
PYSCOTCH_INT_SIZE=32 PYSCOTCH_PARALLEL=1 pytest tests/ -v
|
|
186
|
+
@echo ""
|
|
187
|
+
@echo "========================================"
|
|
188
|
+
@echo "[3/4] Testing 64-bit sequential"
|
|
189
|
+
@echo "========================================"
|
|
190
|
+
PYSCOTCH_INT_SIZE=64 PYSCOTCH_PARALLEL=0 pytest tests/ -v
|
|
191
|
+
@echo ""
|
|
192
|
+
@echo "========================================"
|
|
193
|
+
@echo "[4/4] Testing 64-bit parallel"
|
|
194
|
+
@echo "========================================"
|
|
195
|
+
PYSCOTCH_INT_SIZE=64 PYSCOTCH_PARALLEL=1 pytest tests/ -v
|
|
196
|
+
@echo ""
|
|
197
|
+
@echo "✓ All 4 variants tested successfully!"
|
|
198
|
+
|
|
199
|
+
# Clean Python build artifacts
|
|
200
|
+
clean:
|
|
201
|
+
rm -rf build/ dist/ *.egg-info
|
|
202
|
+
find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
|
|
203
|
+
find . -type f -name "*.pyc" -delete
|
|
204
|
+
find . -type f -name "*.pyo" -delete
|
|
205
|
+
|
|
206
|
+
# Clean Scotch builds
|
|
207
|
+
clean-scotch:
|
|
208
|
+
@if [ -f "$(SCOTCH_SRC)/Makefile" ]; then \
|
|
209
|
+
cd $(SCOTCH_SRC) && $(MAKE) realclean; \
|
|
210
|
+
fi
|
|
211
|
+
rm -rf $(BUILDS_DIR)
|
|
212
|
+
rm -rf lib lib32 lib64 include include32 include64
|
|
213
|
+
|
|
214
|
+
# Full clean
|
|
215
|
+
distclean: clean clean-scotch
|
|
216
|
+
rm -rf $(SCOTCH_DIR)
|