Skip to content

Commit

Permalink
Update Python format checker (#471)
Browse files Browse the repository at this point in the history
* Add pre commit hook for Python formatting

Signed-off-by: coleramos425 <[email protected]>

* Update formatting workflow to run on latest Python and add isort formatter

Signed-off-by: coleramos425 <[email protected]>

* Fix caught yaml formatting issues

* Update pyproject file

* Add pre-commit hook instruction to CONTRIBUTING guide

* Remove target-version from black pyproject.toml

* Fixed formatting errors found with black and isort

Signed-off-by: David Galiffi <[email protected]>

* Run hook: Whitespaces, fix end of file spaces

---------

Signed-off-by: coleramos425 <[email protected]>
Signed-off-by: David Galiffi <[email protected]>
Co-authored-by: David Galiffi <[email protected]>
  • Loading branch information
coleramos425 and dgaliffiAMD authored Nov 7, 2024
1 parent e4241a9 commit 1e5cb38
Show file tree
Hide file tree
Showing 402 changed files with 7,969 additions and 8,111 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ docs/ @ROCm/rocm-documentation
cmake/ @koomie
tests/ @koomie
CMakeLists.txt @koomie
utils/ @koomie
utils/ @koomie
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/bug_report.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ body:
placeholder: e.g. I found the following error when trying to...
validations:
required: true

- type: markdown
attributes:
value: |
Expand Down Expand Up @@ -128,4 +128,4 @@ body:
id: context
attributes:
label: Additional Context
description: Add any other context about the problem here.
description: Add any other context about the problem here.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature_request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ body:
id: context
attributes:
label: Additional context
description: Add any other context or screenshots about the feature request here.
description: Add any other context or screenshots about the feature request here.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/question.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ body:
id: context
attributes:
label: Additional context
description: Add any other context or screenshots about the question here.
description: Add any other context or screenshots about the question here.
1 change: 0 additions & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,3 @@ jobs:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4

18 changes: 9 additions & 9 deletions .github/workflows/formatting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,25 @@ concurrency:
jobs:
python:
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: [3.8, 3.9]

steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
- name: Set up Python '3.x'
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install black
python -m pip install black isort
if [ -f requirements.txt ]; then python -m pip install -r requirements.txt; fi
- name: black format
run: |
black --diff --check .
- name: Run black formatter
uses: psf/black@stable
with:
use_pyproject: true
- name: Run isort formatter
uses: isort/isort-action@master

cmake:
runs-on: ubuntu-20.04
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/packaging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,3 @@ jobs:
files: |
build/rocprofiler-compute-${{github.ref_name}}.tar.gz
name: ${{ env.RELEASE_NAME }}

1 change: 0 additions & 1 deletion .github/workflows/tarball.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,3 @@ jobs:
module load rocprofiler-compute
module list
rocprof-compute --version
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,3 @@ VERSION.sha
# documentation artifacts
/_build
_toc.yml

19 changes: 19 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
default_stages: [pre-commit]
fail_fast: true
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
# Python import sorting
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
# Python formatting (Using this mirror lets us use mypyc-compiled black, which is about 2x faster)
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 24.8.0
hooks:
- id: black
12 changes: 6 additions & 6 deletions .zenodo.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
{
"creators": [
{
"affiliation": "AMD",
"affiliation": "AMD",
"name": "Xiaomin Lu"
},
},
{
"affiliation": "AMD Research",
"affiliation": "AMD Research",
"name": "Cole Ramos"
},
{
"affiliation": "AMD",
"affiliation": "AMD",
"name": "Fei Zheng"
},
{
"affiliation": "AMD Research",
"affiliation": "AMD Research",
"name": "Karl W. Schulz"
},
{
"affiliation": "AMD Research",
"affiliation": "AMD Research",
"name": "Jose Santos"
}
]
Expand Down
16 changes: 8 additions & 8 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Full documentation for ROCm Compute Profiler is available at [https://rocm.docs.

### Optimized

* reduced running time of Omniperf when profiling (#384)
* reduced running time of Omniperf when profiling (#384)
* console logging improvements

## Omniperf 2.0.1 for ROCm 6.2.0
Expand All @@ -42,7 +42,7 @@ Full documentation for ROCm Compute Profiler is available at [https://rocm.docs.
* overhauled CI/CD that spans all modes (#179)
* extensible SoC classes to better support adding new hardware configs (#180)
* --kernel-verbose no longer overwrites kernel names (#193)
* general cleanup and improved organization of source code (#200) (#210)
* general cleanup and improved organization of source code (#200) (#210)
* separate requirement files for docs and testing dependencies (#205) (#262) (#358)
* add support for MI300 hardware (#231)
* upgrade Grafana assets and build script to latest release (#235)
Expand Down Expand Up @@ -89,14 +89,14 @@ Full documentation for ROCm Compute Profiler is available at [https://rocm.docs.
* roofline support for sles15 sp4 and future service packs (#109)
* adding dockerfiles for all supported Linux distros
* new examples for `--roof-only` and `--kernel` options added to documentation

* enable cli analysis in Windows (#110)
* optional random port number in standalone GUI (#111)
* limit length of visible kernelName in `--kernel-names` option (#115)
* adjust metric definitions (#117, #130)
* manually merge rocprof runs, overriding default rocprofiler implementation (#125)
* fixed compatibility issues with Python 3.11 (#131)

## Omniperf 1.0.8-PR2 (17 Apr 2023)

* ux improvements in standalone GUI (#101)
Expand All @@ -112,7 +112,7 @@ Full documentation for ROCm Compute Profiler is available at [https://rocm.docs.
* remove unused python modules (#96)
* fix empirical roofline calculation for single dispatch workloads (#97)
* match color of arithmetic intensity points to corresponding bw lines

## Omniperf 1.0.7 (21 Feb 2023)

* update documentation (#52, #64)
Expand All @@ -126,7 +126,7 @@ Full documentation for ROCm Compute Profiler is available at [https://rocm.docs.
* add MI100 configs to override rocprofiler's incomplete default (#75)
* improve error message when no GPU(s) detected (#85)
* separate CI tests by Linux distro and add status badges

## Omniperf 1.0.6 (21 Dec 2022)

* CI update: documentation now published via github action (#22)
Expand All @@ -148,8 +148,8 @@ Full documentation for ROCm Compute Profiler is available at [https://rocm.docs.
* update python requirements.txt with minimum versions for numpy and pandas
* addition of progress bar indicator in web-based GUI (#8)
* reduced default content for web-based GUI to reduce load times (#9)
* minor packaging and CI updates
* variety of documentation updates
* minor packaging and CI updates
* variety of documentation updates
* added an optional argument to vcopy.cpp workload example to specify device id

## Omniperf 1.0.3 (07 Nov 2022)
Expand Down
42 changes: 18 additions & 24 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,27 +33,21 @@ and apply your changes there.

- Ensure the PR is based on the `amd-staging` branch of the ROCm Compute Profiler GitHub repository.

- ROCm Compute Profiler requires new commits to include a "Signed-off-by" token in the commit message (typically enabled via the `git commit -s` option), indicating your agreement to the projects's [Developer's Certificate of Origin](https://developercertificate.org/) and compatability with the project [LICENSE](LICENSE):


> (a) The contribution was created in whole or in part by me and I
> have the right to submit it under the open source license
> indicated in the file; or
>
> (b) The contribution is based upon previous work that, to the best
> of my knowledge, is covered under an appropriate open source
> license and I have the right under that license to submit that
> work with modifications, whether created in whole or in part
> by me, under the same open source license (unless I am
> permitted to submit under a different license), as indicated
> in the file; or
>
> (c) The contribution was provided directly to me by some other
> person who certified (a), (b) or (c) and I have not modified
> it.
>
> (d) I understand and agree that this project and the contribution
> are public and that a record of the contribution (including all
> personal information I submit with it, including my sign-off) is
> maintained indefinitely and may be redistributed consistent with
> this project or the open source license(s) involved.
> [!TIP]
> To ensure you meet all formatting requirements before publishing, we recommend you utilize our included [*pre-commit hooks*](https://pre-commit.com/#introduction). For more information on how to use pre-commit hooks please see the [section below](#using-pre-commit-hooks).
## Using pre-commit hooks

Our project supports optional [*pre-commit hooks*](https://pre-commit.com/#introduction) which developers can leverage to verify formatting before publishing their code. Once enabled, any commits you propose to the repository will be automatically checked for formatting. Initial setup is as follows:

```console
python3 -m pip install pre-commit
cd rocprofiler-compute
pre-commit install
```

Now, when you commit code to the repository you should see something like this:

![A screen capture showing terminal output from a pre-commit hook](docs/data/contributing/pre-commit-hook.png)

Please see the [pre-commit documentation](https://pre-commit.com/#quick-start) for additional information.
2 changes: 1 addition & 1 deletion MAINTAINERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Before publishing a new ROCm Compute Profiler release, please review this checkl
2) **Sync `amd-mainline` with `amd-staging`**. A rebase may be required to pull all the desired patches from the development branch to our stable mainline. Click [here](https://github.com/ROCm/rocprofiler-compute/compare/amd-mainline...amd-staging) to begin that process.
3) **Update [CHANGES](CHANGES)** to reflect all major modifications to the codebase since the last release. When modifying [CHANGES](CHANGES) please ensure formatting is consistent with the rest of the ROCm software stack. See [this template](https://github.com/ROCm/hipTensor/blob/develop/CHANGELOG.md) for reference.
4) **Confirm all CI tests are passing**. You can easily confirm this by peeking the passing status of all GitHub continuous integration tests.
5) **Create a tag from `amd-mainline`**. More information on tagging can be found at [Git Docs - Tagging](https://git-scm.com/book/en/v2/Git-Basics-Tagging).
5) **Create a tag from `amd-mainline`**. More information on tagging can be found at [Git Docs - Tagging](https://git-scm.com/book/en/v2/Git-Basics-Tagging).

> [!NOTE]
Note: A successful tag should trigger the [packaging action](.github/workflows/packaging.yml) which will produce a tarball artifact. **This artifact needs to be included as an asset in your release**. Please find that the [packaging action](.github/workflows/packaging.yml) will automatically create a draft release with your tarball attached.
Expand Down
1 change: 0 additions & 1 deletion cmake/rocprofcompute.lua.in
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,3 @@ prepend_path("PATH",binDir)
if ( pythonDeps ~= "" ) then
prepend_path("PYTHONPATH",pythonDeps)
end

2 changes: 1 addition & 1 deletion docker/Dockerfile.opensuse
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ RUN wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -
conda init

WORKDIR /home
SHELL [ "/bin/bash", "--login", "-c" ]
SHELL [ "/bin/bash", "--login", "-c" ]
2 changes: 1 addition & 1 deletion docker/Dockerfile.rhel
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@ WORKDIR /home
ENV LC_ALL C.UTF-8
SHELL [ "/bin/bash", "--login", "-c" ]
COPY ./entrypoint-rhel.sh /docker-entrypoint.sh
ENTRYPOINT [ "/docker-entrypoint.sh" ]
ENTRYPOINT [ "/docker-entrypoint.sh" ]
2 changes: 1 addition & 1 deletion docker/Dockerfile.ubuntu
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@ RUN wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -

ENV LC_ALL C.UTF-8
WORKDIR /home
SHELL [ "/bin/bash", "--login", "-c" ]
SHELL [ "/bin/bash", "--login", "-c" ]
2 changes: 1 addition & 1 deletion docker/Dockerfile.ubuntu.ci
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ RUN apt-get update && \

ENV LC_ALL C.UTF-8
WORKDIR /home
SHELL [ "/bin/bash", "--login", "-c" ]
SHELL [ "/bin/bash", "--login", "-c" ]
2 changes: 1 addition & 1 deletion docker/build-docker-ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -151,4 +151,4 @@ if [ "${PUSH}" -gt 0 ]; then
do
verbose-run docker push ${USER}/rocprofiler-compute:ci-base-${DISTRO}-${VERSION}
done
fi
fi
4 changes: 2 additions & 2 deletions docker/build-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ do
*)
;;
esac
echo
echo
verbose-build docker build . ${PULL} --progress plain -f ${DOCKER_FILE} --tag ${CONTAINER} --build-arg DISTRO=${DISTRO} --build-arg VERSION=${VERSION} --build-arg ROCM_VERSION=${ROCM_VERSION} --build-arg ROCM_REPO_VERSION=${ROCM_REPO_VERSION} --build-arg ROCM_REPO_DIST=${ROCM_REPO_DIST} --build-arg PYTHON_VERSIONS=\"${PYTHON_VERSIONS}\"
elif [ "${DISTRO}" = "rhel" ]; then
if [ -z "${VERSION_MINOR}" ]; then
Expand Down Expand Up @@ -269,4 +269,4 @@ do
docker push ${CONTAINER}
fi
done
done
done
2 changes: 1 addition & 1 deletion docs/archive/docs-1.x/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
/_build
/_doxygen
/.gitinfo
/omniperf.dox
/omniperf.dox
2 changes: 1 addition & 1 deletion docs/archive/docs-1.x/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ help:
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
Loading

0 comments on commit 1e5cb38

Please sign in to comment.