Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Aug 30, 2025

This PR adds comprehensive pytest test coverage for the message passing examples in examples/06_message_passing/, following the established pattern from test_load_bench.py.

Overview

The implementation provides test coverage for both message passing examples:

  • message_passing_load_store.py - Uses iris load/store operations for inter-rank communication
  • message_passing_put.py - Uses iris put operations for inter-rank communication

Key Features

Comprehensive Test Coverage: The new test_message_passing.py provides 32 test combinations across:

  • 4 data types: int8, fp16, bf16, fp32
  • 2 buffer/heap size combinations: (4096, 1MB), (8192, 2MB)
  • 2 block sizes: 512, 1024

Faithful Implementation: The tests exactly reproduce the validation logic from the original examples, ensuring that destination_buffer == source_buffer * 2 after the producer-consumer message passing operations complete.

Proper MPI Handling: Uses pytest.skip() to gracefully handle environments that don't have exactly 2 MPI ranks, which is required by the message passing examples.

Clean Architecture: Implements helper functions that mirror the original example structure:

  • create_test_args() - Creates argument dictionaries matching the original parse_args() output
  • run_message_passing_kernels() - Executes the core kernel logic without command-line argument parsing

Usage

# Run all message passing tests
pytest tests/examples/test_message_passing.py

# Run with MPI for actual execution
mpirun -np 2 python -m pytest tests/examples/test_message_passing.py

The tests follow the exact same pattern as the existing test_load_bench.py, using dynamic module imports via importlib.util and parameterized test functions for comprehensive coverage.

Fixes #60.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

@Copilot Copilot AI changed the title [WIP] Implement pytest for 06_message_passing Implement pytest tests for 06_message_passing examples Aug 30, 2025
@Copilot Copilot AI requested a review from mawad-amd August 30, 2025 22:09
Copilot finished work on behalf of mawad-amd August 30, 2025 22:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement pytest for 06_message_passing
2 participants