55Devito is a Python package for implementing optimized stencil computation (finite differences, image processing, machine learning) from high-level symbolic problem definitions. It builds on SymPy and employs automated code generation and just-in-time compilation to execute optimized computational kernels on CPUs, GPUs, and clusters.
66
77** Key Facts:**
8- - Production-stable package (Development Status 5) for scientific computing
9- - Python 3.10-3.13 support (current development uses 3.12.3)
10- - ~ 50MB repository with extensive test coverage
8+ - Production-stable package (Development Status :: 5 - Production/Stable)
9+ - Python 3.10-3.13 support with comprehensive CI testing
10+ - ~ 290MB repository with extensive test coverage and benchmarking
1111- Primary languages: Python (core), C/C++ (generated code)
1212- Main dependencies: NumPy, SymPy, cgen, codepy, psutil
1313- Supports multiple compilation backends: C, OpenMP, OpenACC, MPI
14+ - Active development with 600+ stars, 238+ forks, and regular releases
1415
1516## Build and Development Environment
1617
@@ -91,16 +92,21 @@ devito/ # Main source package
9192├── __init__.py # Package initialization, configuration setup
9293├── arch/ # Architecture-specific compilation backends
9394├── builtins/ # Built-in mathematical functions
95+ ├── checkpointing/ # Checkpointing and reverse-mode functionality
9496├── core/ # Core IR (Intermediate Representation) classes
9597├── data/ # Data structures and memory management
9698├── finite_differences/# Finite difference operators and stencils
9799├── ir/ # Intermediate representation passes
100+ ├── mpatches/ # Memory patches and optimizations
98101├── mpi/ # MPI parallelization support
102+ ├── operations/ # Mathematical operations and transformations
99103├── operator/ # Operator compilation and generation
100104├── passes/ # Compiler optimization passes
101105├── symbolics/ # Symbolic computation utilities
102106├── tools/ # Utility functions and helpers
103- └── types/ # Core types (Grid, Function, Equation, etc.)
107+ ├── types/ # Core types (Grid, Function, Equation, etc.)
108+ ├── deprecations.py # Deprecation warnings and legacy support
109+ └── warnings.py # Warning system and configuration
104110
105111tests/ # Test suite (comprehensive coverage)
106112examples/ # Tutorials and demonstrations
@@ -110,26 +116,35 @@ examples/ # Tutorials and demonstrations
110116└── userapi/ # User API demonstrations
111117
112118scripts/ # Utility scripts
113- docker/ # Docker configurations
114- benchmarks/ # Performance benchmarks
119+ docker/ # Docker configurations
120+ benchmarks/ # Performance benchmarks and ASV configuration
121+ binder/ # Jupyter Binder configuration
115122```
116123
117124### Key Configuration Files
118- - ` pyproject.toml ` : Build configuration, dependencies, flake8 settings
125+ - ` pyproject.toml ` : Build configuration, dependencies, flake8 settings (max-line-length=90)
119126- ` pytest.ini ` : Test configuration and options
120- - ` requirements*.txt ` : Dependency specifications for different environments
121- - ` environment-dev.yml ` : Conda environment specification
122- - ` .github/workflows/ ` : CI/CD pipelines
127+ - ` requirements*.txt ` : Dependency specifications for different environments (mpi, nvidia, testing, optional)
128+ - ` environment-dev.yml ` : Conda environment specification (recommended for development)
129+ - ` .github/workflows/ ` : CI/CD pipelines (13 comprehensive workflows)
130+ - ` MANIFEST.in ` : Package distribution file inclusion/exclusion rules
123131
124132## Continuous Integration and Validation
125133
126134### GitHub Workflows (All Must Pass)
1271351 . ** pytest-core-nompi.yml** : Core functionality tests across Python 3.10-3.13, multiple GCC versions
128- 2 . ** pytest-core-mpi.yml** : MPI parallel execution tests
136+ 2 . ** pytest-core-mpi.yml** : MPI parallel execution tests
1291373 . ** pytest-gpu.yml** : GPU computation tests (OpenACC/CUDA)
130- 4 . ** flake8.yml** : Code style validation
138+ 4 . ** flake8.yml** : Code style validation (90-char line limit, specific ignore rules)
1311395 . ** examples.yml** : Integration tests via example execution
132- 6 . ** tutorials.yml** : Jupyter notebook validation
140+ 6 . ** examples-mpi.yml** : MPI-based example validation
141+ 7 . ** tutorials.yml** : Jupyter notebook validation
142+ 8 . ** asv.yml** : Performance benchmarking and regression detection
143+ 9 . ** docker-bases.yml** : Docker base image builds for testing environments
144+ 10 . ** docker-devito.yml** : Devito-specific Docker image builds
145+ 11 . ** pythonpublish.yml** : Package publishing to PyPI
146+ 12 . ** release-notes.yml** : Automated release documentation
147+ 13 . ** triggers.yml** : Workflow orchestration and triggers
133148
134149### Pre-commit Validation Steps
135150``` bash
@@ -156,12 +171,38 @@ python examples/seismic/acoustic/acoustic_example.py
156171## Development Guidelines
157172
158173### Code Style (Enforced by CI)
159- - ** Line length** : 90 characters maximum
174+ - ** Line length** : 90 characters maximum (configured in pyproject.toml)
160175- ** Indentation** : 4 spaces (no tabs)
161176- ** Imports** : Grouped (stdlib, third-party, devito) and alphabetically sorted
162177- ** Docstrings** : NumPy-style documentation required for public APIs
163178- ** Naming** : CamelCase classes, snake_case methods/variables
164179
180+ ### Commit Messages and PR Titles
181+ Use descriptive prefixes to categorize changes (based on recent repository patterns):
182+ - ** compiler:** Changes to compilation system, IR passes, code generation
183+ - ** mpi:** MPI-related functionality and parallel execution
184+ - ** misc:** General improvements, cleanup, modernization
185+ - ** docs:** Documentation updates, docstring fixes
186+ - ** install:** Installation, packaging, dependencies
187+ - ** bug-py:** Python code bug fixes
188+ - ** bug-C:** Generated C code bug fixes
189+
190+ ** Examples:**
191+ - ` compiler: Hotfix estimate memory for certain devices `
192+ - ` misc: switch to f-string throughout `
193+ - ` docs: fix mmin/mmax docstring `
194+ - ` install: Remove files and directories not needed for install `
195+
196+ ### Common Labels (for PR categorization)
197+ - ** bug-py** , ** bug-py-minor** , ** bug-C** : Bug fixes by category
198+ - ** compiler** : Compilation system changes
199+ - ** MPI** : MPI and parallel execution
200+ - ** documentation** : Documentation improvements
201+ - ** installation** : Package installation and setup
202+ - ** misc** : General improvements
203+ - ** dependencies** : Dependency updates
204+ - ** python** : Python code changes
205+
165206### Making Changes
1662071 . ** Always run linting first** : ` flake8 --builtins=ArgumentError . `
1672082 . ** Test specific areas** : Run relevant tests before committing
@@ -170,15 +211,21 @@ python examples/seismic/acoustic/acoustic_example.py
1702115 . ** Examples** : Add/update examples for new features
171212
172213### Critical Dependencies
173- - ** SymPy** : Symbolic mathematics (versions 1.12-1.14 supported)
174- - ** NumPy** : Numerical arrays (version 2.x)
214+ - ** SymPy** : Symbolic mathematics (versions 1.12+ supported)
215+ - ** NumPy** : Numerical arrays (version 2.x compatible )
175216- ** cgen/codepy** : C code generation and compilation
176217- ** psutil** : System monitoring and resource management
218+ - ** setuptools-scm** : Dynamic versioning from git tags
219+
220+ ### Flake8 Configuration and Common Workarounds
221+ The project uses flake8 with specific ignore rules (configured in pyproject.toml):
222+ - ** F403/F405** : Star imports are expected in ` __init__.py ` files due to API design
223+ - ** E731** : Lambda expressions are acceptable for configuration and simple cases
224+ - ** W503** : Line breaks before binary operators (older style preference)
225+ - ** E722** : Bare except clauses are sometimes necessary for compatibility
226+ - ** W605** : Invalid escape sequences in docstrings (legacy patterns)
177227
178- ### Common Workarounds
179- - ** Star imports** : F403/F405 warnings are expected in ` __init__.py ` due to API design
180- - ** Lambda expressions** : E731 warnings are sometimes acceptable for configuration
181- - ** Import order** : Follow the pattern in ` devito/__init__.py `
228+ ** Import order** : Follow the pattern in ` devito/__init__.py ` for consistency
182229
183230## Agent-Specific Instructions
184231
@@ -188,14 +235,18 @@ python examples/seismic/acoustic/acoustic_example.py
1882353 . Specific error messages require investigation
189236
190237** Time-saving tips:**
191- 1 . Use Docker if pip installation fails due to network issues
238+ 1 . Use Docker if pip installation fails due to network issues
1922392 . Set environment variables before running any compilation-dependent tests
193- 3 . Start with small test files when debugging
240+ 3 . Start with small test files when debugging (e.g., ` pytest tests/test_operator.py::test_specific ` )
1942414 . Check configuration output to verify environment setup
1952425 . Use ` --maxfail=5 ` to stop test runs early on systematic failures
243+ 6 . Use conda environment for full development workflow when possible
244+ 7 . Run flake8 first before making commits to catch style issues early
196245
197246** File modification priorities:**
1982471 . Core types and operators: ` devito/types/ ` , ` devito/operator/ `
1992482 . Mathematical operations: ` devito/finite_differences/ ` , ` devito/symbolics/ `
2002493 . Compilation backends: ` devito/arch/ ` , ` devito/passes/ `
201- 4 . Always update corresponding tests in ` tests/ `
250+ 4 . MPI functionality: ` devito/mpi/ `
251+ 5 . Always update corresponding tests in ` tests/ `
252+ 6 . Update documentation in examples/ if adding new features
0 commit comments