Thank you for your interest in contributing to the CUDA Samples!
-
Fork & Clone the Repository:
Fork the reporistory and clone the fork. For more information, check GitHub's documentation on forking and cloning a repository.
-
Create a New Branch:
git checkout -b your-feature-branch
-
Make Changes.
-
Build and Test:
Ensure changes don't break existing functionality by building and running tests.
For more details on building and testing, refer to the Building and Testing section below.
-
Commit Changes:
git commit -m "Brief description of the change"
For information on building a running tests on the samples, please refer to the main README
- Push changes to your fork
- Create a pull request targeting the
masterbranch of the original CUDA Samples repository. Refer to GitHub's documentation for more information on creating a pull request. - Describe the purpose and context of the changes in the pull request description.
The CUDA Samples repository uses pre-commit to execute all code linters and formatters. These tools ensure a consistent coding style throughout the project. Using pre-commit ensures that linter versions and options are aligned for all developers. Additionally, there is a CI check in place to enforce that committed code follows our standards.
The linters used by the CUDA Samples are listed in .pre-commit-config.yaml.
For example, C++ and CUDA code is formatted with clang-format.
To use pre-commit, install via conda or pip:
conda config --add channels conda-forge
conda install pre-commitpip install pre-commitThen run pre-commit hooks before committing code:
pre-commit runBy default, pre-commit runs on staged files (only changes and additions that will be committed). To run pre-commit checks on all files, execute:
pre-commit run --all-filesOptionally, you may set up the pre-commit hooks to run automatically when you make a git commit. This can be done by running:
pre-commit installNow code linters and formatters will be run each time you commit changes.
You can skip these checks with git commit --no-verify or with the short version git commit -n, althoguh please note
that this may result in pull requests being rejected if subsequent checks fail.
Once submitted, maintainers will be automatically assigned to review the pull request. They might suggest changes or improvements. Constructive feedback is a part of the collaborative process, aimed at ensuring the highest quality code.
For constructive feedback and effective communication during reviews, we recommend following Conventional Comments.
Further recommended reading for successful PR reviews:
Your contributions enhance the CUDA Samples for the entire community. We appreciate your effort and collaboration!