Skip to content

Conversation

@coketaste
Copy link
Contributor

πŸ“‹ Description

Brief description of the changes in this pull request.

πŸ” Type of Change

  • πŸ› Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • πŸ’₯ Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • πŸ“š Documentation update
  • πŸ§ͺ Test improvements
  • πŸ”§ Code refactoring
  • 🎨 Style/formatting changes

🎯 Related Issues

Fixes #(issue number)
Relates to #(issue number)

πŸ“ Module/Area Affected

  • Module 1 - Fundamentals
  • Module 2 - Mathematics
  • Module 3 - Programming
  • Module 4 - Algorithms
  • Module 5 - Error Correction
  • Module 6 - Machine Learning
  • Module 7 - Hardware
  • Module 8 - Applications
  • Documentation
  • Testing/CI
  • Project infrastructure

πŸ§ͺ Testing

Describe how you tested your changes:

βœ… Completed Testing

  • All affected examples run without errors
  • Help text is accurate and informative
  • Visualizations display correctly
  • Parameter validation works as expected
  • Code follows project style guidelines

πŸ–₯️ Testing Environment

  • OS: (e.g., Ubuntu 20.04)
  • Python Version: (e.g., 3.9.7)
  • Qiskit Version: (e.g., 1.0.0)

πŸ“ Test Commands

# Commands used to test the changes
python module_x/example.py --help
python module_x/example.py --parameter value

πŸ“Έ Screenshots (if applicable)

Include screenshots for visual changes, new visualizations, or UI improvements.

πŸ“š Documentation Changes

  • Updated relevant README files
  • Added/updated docstrings
  • Updated module documentation
  • Added code comments for complex sections

⚑ Performance Impact

  • No performance impact
  • Improves performance
  • May impact performance (please describe)

πŸ”„ Breaking Changes

If this introduces breaking changes, please describe:

  • What will break?
  • How can users migrate?
  • Is this change necessary?

πŸ“‹ Checklist

Code Quality

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added docstrings to new functions and classes

Testing

  • I have tested these changes locally
  • Existing examples still work correctly
  • New functionality has been tested
  • Error handling has been tested

Documentation

  • I have made corresponding changes to the documentation
  • I have updated relevant README files
  • I have added appropriate comments to the code

Educational Value

  • Changes maintain or improve educational value
  • Learning objectives are clear
  • Examples are appropriate for the target skill level
  • Concepts are explained clearly

πŸŽ“ Educational Impact

How do these changes improve the learning experience?

  • What new concepts do they teach?
  • How do they fit into the overall curriculum?
  • What skill level are they appropriate for?

🀝 Review Notes

Anything specific you'd like reviewers to focus on?

πŸ“ˆ Future Work

Any follow-up work that should be done in future PRs?


Thank you for contributing to Quantum Computing 101! πŸš€βš›οΈ

Copilot AI review requested due to automatic review settings October 1, 2025 02:32
@coketaste coketaste merged commit 5c00d7d into main Oct 1, 2025
3 checks passed
@coketaste coketaste deleted the coketaste/docker branch October 1, 2025 02:33
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a unified Docker architecture for the Quantum Computing 101 project, consolidating multiple separate Dockerfiles and build scripts into a single, maintainable solution while updating the requirements structure for better organization.

  • Unified multi-stage Dockerfile supporting CPU, NVIDIA GPU, and AMD GPU variants
  • Consolidated build system with single build script replacing multiple variant-specific scripts
  • Reorganized requirements files with clearer documentation and improved dependency management

Reviewed Changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
setup.py Added filtering for -r requirements include directives
examples/requirements*.txt Enhanced documentation headers explaining purpose and usage context
docker/Dockerfile New unified multi-stage Dockerfile replacing 4 separate variant files
docker/build-unified.sh New consolidated build script with improved hardware detection
docker/entrypoint.sh New unified entrypoint script for all container variants
docker/requirements/*.txt Updated requirement files with better documentation and structure
docker/README.md Comprehensive documentation rewrite covering new unified architecture
Legacy files Removed old Dockerfiles and build scripts (consolidated into unified approach)

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines 18 to +25
def read_requirements(filename):
with open(os.path.join("examples", filename), "r", encoding="utf-8") as fh:
return [line.strip() for line in fh if line.strip() and not line.startswith("#")]
return [
line.strip()
for line in fh
if line.strip()
and not line.startswith("#")
and not line.startswith("-r")
Copy link

Copilot AI Oct 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The filtering logic excludes -r (include) directives but doesn't handle requirements files that might legitimately use includes. Consider adding a comment explaining why -r directives are filtered out, or make this configurable if the filtering behavior should be conditional.

Copilot uses AI. Check for mistakes.
Comment on lines +19 to +24
VARIANT="${1:-cpu}"
NO_CACHE="${2:-false}"
PYTORCH_VERSION="2.8.0"
CUDA_VERSION="12.9"
CUDNN_VERSION="9"

Copy link

Copilot AI Oct 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The script relies on positional parameter ordering which can be fragile. Consider using proper argument parsing (getopts) to handle options like --no-cache more robustly, especially since the usage examples show --no-cache as a flag rather than a positional argument.

Suggested change
VARIANT="${1:-cpu}"
NO_CACHE="${2:-false}"
PYTORCH_VERSION="2.8.0"
CUDA_VERSION="12.9"
CUDNN_VERSION="9"
VARIANT="cpu"
NO_CACHE="false"
PYTORCH_VERSION="2.8.0"
CUDA_VERSION="12.9"
CUDNN_VERSION="9"
# -----------------------------------------------------------------------------
# Argument parsing
# -----------------------------------------------------------------------------
while [[ $# -gt 0 ]]; do
case "$1" in
--no-cache)
NO_CACHE="true"
shift
;;
cpu|nvidia|amd)
VARIANT="$1"
shift
;;
-*)
print_warning "Unknown option: $1"
shift
;;
*)
print_warning "Unknown argument: $1"
shift
;;
esac
done

Copilot uses AI. Check for mistakes.
Comment on lines +97 to +98
RUN sed '/^qiskit-aer/d' /tmp/requirements/base.txt > /tmp/requirements/base-no-aer.txt && \
pip install -r /tmp/requirements/base-no-aer.txt
Copy link

Copilot AI Oct 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sed command to exclude qiskit-aer from base requirements is duplicated between the NVIDIA and AMD stages. Consider extracting this logic to a shared stage or create a separate base-no-aer.txt file to reduce code duplication.

Copilot uses AI. Check for mistakes.
# Detect variant
if command -v nvidia-smi &> /dev/null; then
echo "Platform: NVIDIA CUDA GPU"
echo "CUDA Version: $(nvcc --version | grep "release" | awk '{print $6}' | cut -c2- || echo 'N/A')"
Copy link

Copilot AI Oct 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CUDA version extraction command is complex and fragile. Consider using nvidia-smi --query-gpu=driver_version --format=csv,noheader,nounits or a more robust parsing method to extract version information.

Suggested change
echo "CUDA Version: $(nvcc --version | grep "release" | awk '{print $6}' | cut -c2- || echo 'N/A')"
echo "CUDA Version: $(nvidia-smi --query-gpu=driver_version --format=csv,noheader,nounits 2>/dev/null | head -n1 || nvcc --version | grep "release" | awk '{print $6}' | cut -c2- || echo 'N/A')"

Copilot uses AI. Check for mistakes.
nvidia-smi --query-gpu=name,memory.total --format=csv,noheader 2>/dev/null || echo "GPU info not available"

# Check PyTorch CUDA
python -c "import torch; print(f'PyTorch CUDA Available: {torch.cuda.is_available()}')" 2>/dev/null || true
Copy link

Copilot AI Oct 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both CUDA and ROCm variants use torch.cuda.is_available() to check GPU availability. For ROCm, this should use ROCm-specific detection methods or at minimum clarify in the output that cuda.is_available() also returns true for ROCm devices.

Copilot uses AI. Check for mistakes.
rocm-smi --showproductname 2>/dev/null || echo "ROCm GPU detected"

# Check PyTorch ROCm
python -c "import torch; print(f'PyTorch ROCm Available: {torch.cuda.is_available()}')" 2>/dev/null || true
Copy link

Copilot AI Oct 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both CUDA and ROCm variants use torch.cuda.is_available() to check GPU availability. For ROCm, this should use ROCm-specific detection methods or at minimum clarify in the output that cuda.is_available() also returns true for ROCm devices.

Suggested change
python -c "import torch; print(f'PyTorch ROCm Available: {torch.cuda.is_available()}')" 2>/dev/null || true
python -c "import torch; print(f'PyTorch CUDA interface available (used for both CUDA and ROCm): {torch.cuda.is_available()}'); print(f'PyTorch device name: {torch.cuda.get_device_name(0) if torch.cuda.is_available() else \"N/A\"}')" 2>/dev/null || true

Copilot uses AI. Check for mistakes.
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.

2 participants