Thank you for contributing to LeetGPU! We welcome new challenges and framework support.
Add new GPU programming problems with starter templates across multiple frameworks.
Add starter templates for new GPU programming frameworks to existing challenges.
Fix issues with existing starter templates or problem descriptions.
Each challenge should include:
challenges/<difficulty>/<number>_<name>/
├── challenge.html # Problem description
├── challenge.py # Reference implementation and metadata
└── starter/ # Starter templates
├── starter.cu # CUDA
├── starter.mojo # Mojo
├── starter.pytorch.py # PyTorch
├── starter.tinygrad.py # TinyGrad
└── starter.triton.py # Triton
- Clear problem description with 1 or more examples
- Starter templates should follow the format of existing starter templates
- Follow existing challenge patterns
- Comments: Match the format of existing challenges
- Easy problems: Provide more starter code and helpful structure
- Medium/Hard problems: Just have an empty solve function
- All templates should compile but not solve the problem
All starter code must pass automated linting checks before being merged. We use:
The easiest way to ensure your code is properly formatted is to use pre-commit hooks:
# Install pre-commit
pip install pre-commit
# Install the git hooks
pre-commit install
# Now formatting happens automatically when you commit!
# To run manually on all files:
pre-commit run --all-filesThis will automatically format your code with black, isort, and clang-format before each commit.
- black: Code formatting (line length: 100)
- isort: Import sorting
- flake8: Style and error checking
Format your Python code manually:
pip install black==24.1.1 flake8==7.0.0 isort==5.13.2
black challenges/ scripts/
isort challenges/ scripts/
flake8 challenges/ scripts/- clang-format: Code formatting (LLVM style with modifications)
Format your C++/CUDA code manually:
sudo apt-get install clang-format
find challenges -name "*.cu" -o -name "*.cpp" -o -name "*.h" | xargs clang-format -i- Basic validation checks (file not empty, required imports,
@exportdecorator)
The CI will automatically check all code submissions. Fix any linting errors before submitting your PR.
- Easy: Single concept, basic kernel launches
- Medium: Multiple concepts, memory optimizations
- Hard: Advanced techniques, complex algorithms
- Fork the repository
- Create a feature branch:
git checkout -b challenge/new-challenge-name - Add your challenge with all required files
- Submit a pull request with a clear description
- Open an issue for questions
- Check existing challenges for examples
Thank you for helping improve LeetGPU!
By submitting code, documentation, or any other content to this repository (“Contribution”), you confirm that:
-
Ownership
You are the sole author of the Contribution, or have obtained all necessary rights and permissions to grant the licenses below. -
Dual License to the Project
You grant AlphaGPU and its downstream users two non‑exclusive, worldwide, royalty‑free licenses to your Contribution:a. Under the repository’s public license,
Creative Commons Attribution‑NonCommercial‑NoDerivatives 4.0
(“CC BY‑NC‑ND”), for all public distribution.b. Under a commercial‑friendly license to AlphaGPU itself:
– Grant: AlphaGPU may reproduce, distribute, adapt, sublicense,
and create derivative works of your Contribution for any purpose,
including commercial use.
– No further conditions: AlphaGPU need not attribute further or
seek additional permission beyond this agreement. -
No Additional Restrictions
You may not impose any further terms on your Contribution that conflict with the licenses granted above. -
Pull Request = Acceptance
Submitting a Pull Request constitutes acceptance of these terms.