jaxdecomp 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. jaxdecomp-0.2.0/.clang-format +15 -0
  2. jaxdecomp-0.2.0/.github/workflows/formatting.yml +21 -0
  3. jaxdecomp-0.2.0/.github/workflows/github-deploy.yml +68 -0
  4. jaxdecomp-0.2.0/.github/workflows/joss-paper-pdf.yml +28 -0
  5. jaxdecomp-0.2.0/.github/workflows/tests.yml +39 -0
  6. jaxdecomp-0.2.0/.gitignore +137 -0
  7. jaxdecomp-0.2.0/.gitmodules +3 -0
  8. jaxdecomp-0.2.0/.pre-commit-config.yaml +28 -0
  9. jaxdecomp-0.2.0/.style.yapf +2 -0
  10. jaxdecomp-0.2.0/CHANGELOG.md +37 -0
  11. jaxdecomp-0.2.0/CMakeLists.txt +97 -0
  12. jaxdecomp-0.2.0/CONTRIBUTING.md +46 -0
  13. jaxdecomp-0.2.0/LICENSE +21 -0
  14. jaxdecomp-0.2.0/PKG-INFO +280 -0
  15. jaxdecomp-0.2.0/README.md +238 -0
  16. jaxdecomp-0.2.0/examples/README.md +23 -0
  17. jaxdecomp-0.2.0/examples/lpt_nbody_demo.py +280 -0
  18. jaxdecomp-0.2.0/examples/scatter.py +158 -0
  19. jaxdecomp-0.2.0/examples/submit_rusty.sbatch +20 -0
  20. jaxdecomp-0.2.0/examples/visualizer.ipynb +235 -0
  21. jaxdecomp-0.2.0/joss-paper/assets/benchmark.png +0 -0
  22. jaxdecomp-0.2.0/joss-paper/assets/fft.svg +4 -0
  23. jaxdecomp-0.2.0/joss-paper/assets/halo-exchange.svg +4 -0
  24. jaxdecomp-0.2.0/joss-paper/paper.bib +59 -0
  25. jaxdecomp-0.2.0/joss-paper/paper.md +176 -0
  26. jaxdecomp-0.2.0/pyproject.toml +46 -0
  27. jaxdecomp-0.2.0/scripts/autotune.py +27 -0
  28. jaxdecomp-0.2.0/scripts/test_fft3d.py +57 -0
  29. jaxdecomp-0.2.0/slurms/README.md +65 -0
  30. jaxdecomp-0.2.0/slurms/template.slurm +45 -0
  31. jaxdecomp-0.2.0/src/csrc/fft.cu +548 -0
  32. jaxdecomp-0.2.0/src/csrc/grid_descriptor_mgr.cc +240 -0
  33. jaxdecomp-0.2.0/src/csrc/halo.cu +80 -0
  34. jaxdecomp-0.2.0/src/csrc/include/checks.h +89 -0
  35. jaxdecomp-0.2.0/src/csrc/include/fft.h +179 -0
  36. jaxdecomp-0.2.0/src/csrc/include/grid_descriptor_mgr.h +76 -0
  37. jaxdecomp-0.2.0/src/csrc/include/halo.h +82 -0
  38. jaxdecomp-0.2.0/src/csrc/include/helpers.h +42 -0
  39. jaxdecomp-0.2.0/src/csrc/include/jaxdecomp.h +114 -0
  40. jaxdecomp-0.2.0/src/csrc/include/logger.hpp +277 -0
  41. jaxdecomp-0.2.0/src/csrc/include/perfostep.hpp +358 -0
  42. jaxdecomp-0.2.0/src/csrc/include/transpose.h +85 -0
  43. jaxdecomp-0.2.0/src/csrc/jaxdecomp.cc +369 -0
  44. jaxdecomp-0.2.0/src/csrc/transpose.cu +77 -0
  45. jaxdecomp-0.2.0/src/jaxdecomp/__init__.py +73 -0
  46. jaxdecomp-0.2.0/src/jaxdecomp/_src/__init__.py +40 -0
  47. jaxdecomp-0.2.0/src/jaxdecomp/_src/cudecomp/__init__.py +0 -0
  48. jaxdecomp-0.2.0/src/jaxdecomp/_src/cudecomp/fft.py +424 -0
  49. jaxdecomp-0.2.0/src/jaxdecomp/_src/cudecomp/halo.py +379 -0
  50. jaxdecomp-0.2.0/src/jaxdecomp/_src/cudecomp/transpose.py +519 -0
  51. jaxdecomp-0.2.0/src/jaxdecomp/_src/fft_utils.py +183 -0
  52. jaxdecomp-0.2.0/src/jaxdecomp/_src/jax/__init__.py +0 -0
  53. jaxdecomp-0.2.0/src/jaxdecomp/_src/jax/fft.py +522 -0
  54. jaxdecomp-0.2.0/src/jaxdecomp/_src/jax/fftfreq.py +91 -0
  55. jaxdecomp-0.2.0/src/jaxdecomp/_src/jax/halo.py +435 -0
  56. jaxdecomp-0.2.0/src/jaxdecomp/_src/jax/transpose.py +368 -0
  57. jaxdecomp-0.2.0/src/jaxdecomp/_src/pencil_utils.py +299 -0
  58. jaxdecomp-0.2.0/src/jaxdecomp/_src/spmd_ops.py +264 -0
  59. jaxdecomp-0.2.0/src/jaxdecomp/fft.py +278 -0
  60. jaxdecomp-0.2.0/src/jaxdecomp/halo.py +79 -0
  61. jaxdecomp-0.2.0/src/jaxdecomp/transpose.py +240 -0
  62. jaxdecomp-0.2.0/src/jaxdecomp/typing.py +12 -0
  63. jaxdecomp-0.2.0/tests/conftest.py +164 -0
  64. jaxdecomp-0.2.0/tests/run_all_tests.sh +2 -0
  65. jaxdecomp-0.2.0/tests/test_fft.py +312 -0
  66. jaxdecomp-0.2.0/tests/test_halo.py +244 -0
  67. jaxdecomp-0.2.0/tests/test_transpose.py +222 -0
@@ -0,0 +1,15 @@
1
+ ---
2
+ BasedOnStyle: LLVM
3
+ ColumnLimit: 120
4
+ CommentPragmas: '^\\.+'
5
+ DerivePointerAlignment: false
6
+ Language: Cpp
7
+ PointerAlignment: Left
8
+ UseTab: Never
9
+ AlignAfterOpenBracket: Align
10
+ AlignTrailingComments: true
11
+ AllowShortBlocksOnASingleLine: true
12
+ AllowShortCaseLabelsOnASingleLine : true
13
+ AllowShortIfStatementsOnASingleLine: true
14
+ AllowShortLoopsOnASingleLine: true
15
+ ...
@@ -0,0 +1,21 @@
1
+ name: Code Formatting
2
+
3
+ on:
4
+ push:
5
+ branches: [ "main" ]
6
+ pull_request:
7
+ branches: [ "main" ]
8
+
9
+ jobs:
10
+ build:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/checkout@v4
14
+ - name: Set up Python ${{ matrix.python-version }}
15
+ uses: actions/setup-python@v3
16
+ - name: Install dependencies
17
+ run: |
18
+ python -m pip install --upgrade pip isort
19
+ python -m pip install pre-commit
20
+ - name: Run pre-commit
21
+ run: python -m pre_commit run --all-files
@@ -0,0 +1,68 @@
1
+ name: Build and upload to PyPI
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ pull_request:
6
+ push:
7
+ branches:
8
+ - main
9
+ release:
10
+ types:
11
+ - published
12
+
13
+ jobs:
14
+ build_wheels:
15
+ name: Build wheels on ${{ matrix.os }}
16
+ runs-on: ${{ matrix.os }}
17
+ strategy:
18
+ matrix:
19
+ # macos-13 is an intel runner, macos-14 is apple silicon
20
+ os: [ubuntu-latest]
21
+
22
+ steps:
23
+ - uses: actions/checkout@v4
24
+
25
+ - name: Build wheels
26
+ uses: pypa/cibuildwheel@v2.21.3
27
+ env:
28
+ CIBW_BUILD: "cp310-* cp311-* cp312-*"
29
+ CIBW_BUILD_VERBOSITY: 2
30
+ - uses: actions/upload-artifact@v4
31
+ with:
32
+ name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
33
+ path: ./wheelhouse/*.whl
34
+
35
+ build_sdist:
36
+ name: Build source distribution
37
+ runs-on: ubuntu-latest
38
+ steps:
39
+ - uses: actions/checkout@v4
40
+
41
+ - name: Build sdist
42
+ run: pipx run build --sdist
43
+
44
+ - uses: actions/upload-artifact@v4
45
+ with:
46
+ name: cibw-sdist
47
+ path: dist/*.tar.gz
48
+
49
+ upload_pypi:
50
+ needs: [build_wheels, build_sdist]
51
+ runs-on: ubuntu-latest
52
+ environment: pypi
53
+ permissions:
54
+ id-token: write
55
+ # if: github.event_name == 'release' && github.event.action == 'published'
56
+ # or, alternatively, upload to PyPI on every tag starting with 'v' (remove on: release above to use this)
57
+ # if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
58
+ steps:
59
+ - uses: actions/download-artifact@v4
60
+ with:
61
+ # unpacks all CIBW artifacts into dist/
62
+ pattern: cibw-*
63
+ path: dist
64
+ merge-multiple: true
65
+
66
+ - uses: pypa/gh-action-pypi-publish@release/v1
67
+ #with:
68
+ # repository-url: https://test.pypi.org/legacy/
@@ -0,0 +1,28 @@
1
+ name: Draft PDF
2
+ on:
3
+ push:
4
+ branches: [ "main" ]
5
+ pull_request:
6
+ branches: [ "main" ]
7
+
8
+ jobs:
9
+ paper:
10
+ runs-on: ubuntu-latest
11
+ name: Paper Draft
12
+ steps:
13
+ - name: Checkout
14
+ uses: actions/checkout@v4
15
+ - name: Build draft PDF
16
+ uses: openjournals/openjournals-draft-action@master
17
+ with:
18
+ journal: joss
19
+ # This should be the path to the paper within your repo.
20
+ paper-path: joss-paper/paper.md
21
+ - name: Upload
22
+ uses: actions/upload-artifact@v3
23
+ with:
24
+ name: paper
25
+ # This is the output path where Pandoc will write the compiled
26
+ # PDF. Note, this should be the same directory as the input
27
+ # paper.md
28
+ path: joss-paper/paper.pdf
@@ -0,0 +1,39 @@
1
+ name: Tests
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ pull_request:
8
+ branches:
9
+ - main
10
+
11
+ jobs:
12
+ build:
13
+
14
+ runs-on: ubuntu-latest
15
+ strategy:
16
+ matrix:
17
+ python-version: [3.10.4]
18
+
19
+ steps:
20
+ - name: Checkout Source
21
+ uses: actions/checkout@v2.3.1
22
+
23
+ - name: Set up Python ${{ matrix.python-version }}
24
+ uses: actions/setup-python@v2
25
+ with:
26
+ python-version: ${{ matrix.python-version }}
27
+
28
+ - name: Install dependencies
29
+ run: |
30
+ python -m pip install --upgrade pip
31
+ pip install jax[cpu]
32
+ pip install .[test]
33
+
34
+ - name: Run tests
35
+ run: |
36
+ cd tests
37
+ export JAX_PLATFORM_NAME=cpu
38
+ export XLA_FLAGS='--xla_force_host_platform_device_count=8'
39
+ pytest -v
@@ -0,0 +1,137 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ pip-wheel-metadata/
24
+ share/python-wheels/
25
+ *.egg-info/
26
+ .installed.cfg
27
+ *.egg
28
+ MANIFEST
29
+
30
+ # PyInstaller
31
+ # Usually these files are written by a python script from a template
32
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
33
+ *.manifest
34
+ *.spec
35
+
36
+ # Installer logs
37
+ pip-log.txt
38
+ pip-delete-this-directory.txt
39
+
40
+ # Unit test / coverage reports
41
+ htmlcov/
42
+ .tox/
43
+ .nox/
44
+ .coverage
45
+ .coverage.*
46
+ .cache
47
+ nosetests.xml
48
+ coverage.xml
49
+ *.cover
50
+ *.py,cover
51
+ .hypothesis/
52
+ .pytest_cache/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ target/
76
+
77
+ # Jupyter Notebook
78
+ .ipynb_checkpoints
79
+
80
+ # IPython
81
+ profile_default/
82
+ ipython_config.py
83
+
84
+ # pyenv
85
+ .python-version
86
+
87
+ # pipenv
88
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
89
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
90
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
91
+ # install all needed dependencies.
92
+ #Pipfile.lock
93
+
94
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow
95
+ __pypackages__/
96
+
97
+ # Celery stuff
98
+ celerybeat-schedule
99
+ celerybeat.pid
100
+
101
+ # SageMath parsed files
102
+ *.sage.py
103
+
104
+ # Environments
105
+ .env
106
+ .venv
107
+ env/
108
+ venv/
109
+ ENV/
110
+ env.bak/
111
+ venv.bak/
112
+
113
+ # Spyder project settings
114
+ .spyderproject
115
+ .spyproject
116
+
117
+ # Rope project settings
118
+ .ropeproject
119
+
120
+ # mkdocs documentation
121
+ /site
122
+
123
+ # mypy
124
+ .mypy_cache/
125
+ .dmypy.json
126
+ dmypy.json
127
+
128
+ # Pyre type checker
129
+ .pyre/
130
+
131
+ .vscode/
132
+
133
+ scripts/experimental
134
+ compile_commands.json
135
+ CMakeFiles
136
+ traces*
137
+ notes.txt
@@ -0,0 +1,3 @@
1
+ [submodule "third_party/cuDecomp"]
2
+ path = third_party/cuDecomp
3
+ url = https://github.com/NVIDIA/cuDecomp.git
@@ -0,0 +1,28 @@
1
+ repos:
2
+ - repo: https://github.com/pre-commit/pre-commit-hooks
3
+ rev: v2.3.0
4
+ hooks:
5
+ - id: check-yaml
6
+ - id: end-of-file-fixer
7
+ - id: trailing-whitespace
8
+ - repo: https://github.com/google/yapf
9
+ rev: v0.40.2
10
+ hooks:
11
+ - id: yapf
12
+ args: ['--parallel', '--in-place']
13
+ - repo: https://github.com/pycqa/isort
14
+ rev: 5.13.2
15
+ hooks:
16
+ - id: isort
17
+ name: isort (python)
18
+ - repo: https://github.com/pre-commit/mirrors-clang-format
19
+ rev: v18.1.4
20
+ hooks:
21
+ - id: clang-format
22
+ files: '\.(c|cc|cpp|h|hpp|cxx|hh|cu|cuh)$'
23
+ exclude: '^third_party/|/pybind11/'
24
+ name: clang-format
25
+ - repo: https://github.com/pre-commit/mirrors-mypy
26
+ rev: v1.13.0
27
+ hooks:
28
+ - id: mypy
@@ -0,0 +1,2 @@
1
+ [style]
2
+ based_on_style = yapf
@@ -0,0 +1,37 @@
1
+ # Change log
2
+
3
+ ## jaxdecomp 0.2.0
4
+
5
+ * Changes
6
+ * jaxDecomp works without MPI and using only JAX as backend
7
+ * with mesh is no longer required (will be deprecated by JAX)
8
+ * Added support for fftfreq
9
+ * Added testing for all functions
10
+ * Added static typing and checked with mypy
11
+
12
+ ## jaxdecomp 0.1.0
13
+
14
+ * Changes
15
+ * Fixed bug with Halo
16
+ * Added joss paper
17
+
18
+
19
+ ## jaxdecomp 0.0.1
20
+
21
+ * Changes
22
+ * New version compatible with JAX 0.4.30
23
+ * jaxDecomp now works in a multi-host environment
24
+ * Added custom partitioning for FFTs
25
+ * Added custom partitioning for halo exchange
26
+ * Added custom partitioning for slice_pad and slice_unpad
27
+ * Add example for multi-host FFTs in `examples/jaxdecomp_lpt.py`
28
+
29
+
30
+ ## jaxdecomp 0.0.1rc2
31
+ * Changes
32
+ * Added utility to run autotuning
33
+
34
+
35
+ ## jaxdecomp 0.0.1rc1 (Nov. 25th 2022)
36
+
37
+ Initial pre-release, include support for parallel ffts and halo exchange
@@ -0,0 +1,97 @@
1
+ cmake_minimum_required(VERSION 3.19...3.25)
2
+
3
+
4
+
5
+ project(jaxdecomp LANGUAGES CXX)
6
+
7
+ # NVCC 12 does not support C++20
8
+ set(CMAKE_CXX_STANDARD 17)
9
+ set(CMAKE_CUDA_STANDARD 17)
10
+
11
+ option(JD_CUDECOMP_BACKEND "Use cuDecomp backend" OFF)
12
+ # Set default build type to Release
13
+ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
14
+ set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE)
15
+ set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
16
+ endif()
17
+
18
+ set(PYBIND11_FINDPYTHON ON)
19
+ find_package(pybind11 CONFIG REQUIRED)
20
+
21
+ # Check for CUDA
22
+ include(CheckLanguage)
23
+ check_language(CUDA)
24
+
25
+ if(CMAKE_CUDA_COMPILER AND JD_CUDECOMP_BACKEND)
26
+ enable_language(CUDA)
27
+
28
+ # Latest JAX v0.4.26 no longer supports cuda 11.8
29
+ find_package(CUDAToolkit REQUIRED VERSION 12)
30
+ set(NVHPC_CUDA_VERSION ${CUDAToolkit_VERSION_MAJOR}.${CUDAToolkit_VERSION_MINOR})
31
+
32
+ message(STATUS "Using CUDA ${NVHPC_CUDA_VERSION}")
33
+
34
+ add_subdirectory(third_party/cuDecomp)
35
+
36
+ option(CUDECOMP_BUILD_FORTRAN "Build Fortran bindings" OFF)
37
+ option(CUDECOMP_ENABLE_NVSHMEM "Enable NVSHMEM" OFF)
38
+ option(CUDECOMP_BUILD_EXTRAS "Build benchmark, examples, and tests" OFF)
39
+
40
+ # 70: Volta, 80: Ampere, 89: RTX 4060
41
+ set(CUDECOMP_CUDA_CC_LIST "70;80;89" CACHE STRING "List of CUDA compute capabilities to build cuDecomp for.")
42
+
43
+ find_package(NVHPC REQUIRED COMPONENTS MATH MPI NCCL)
44
+
45
+ string(REPLACE "/lib64" "/include" NVHPC_MATH_INCLUDE_DIR ${NVHPC_MATH_LIBRARY_DIR})
46
+ string(REPLACE "/lib64" "/include" NVHPC_CUDA_INCLUDE_DIR ${NVHPC_CUDA_LIBRARY_DIR})
47
+
48
+
49
+ find_library(NCCL_LIBRARY
50
+ NAMES nccl
51
+ HINTS ${NVHPC_NCCL_LIBRARY_DIR}
52
+ )
53
+ string(REPLACE "/lib" "/include" NCCL_INCLUDE_DIR ${NVHPC_NCCL_LIBRARY_DIR})
54
+
55
+
56
+ message(STATUS "Using NCCL library: ${NCCL_LIBRARY}")
57
+ message(STATUS "NVHPC NCCL lib dir: ${NVHPC_NCCL_LIBRARY_DIR}")
58
+ message(STATUS "NCCL include dir: ${NCCL_INCLUDE_DIR}")
59
+
60
+ # Add _jaxdecomp modulei
61
+ pybind11_add_module(_jaxdecomp
62
+ src/csrc/halo.cu
63
+ src/csrc/jaxdecomp.cc
64
+ src/csrc/grid_descriptor_mgr.cc
65
+ src/csrc/fft.cu
66
+ src/csrc/transpose.cu
67
+ )
68
+
69
+ set_target_properties(_jaxdecomp PROPERTIES CUDA_ARCHITECTURES "${CUDECOMP_CUDA_CC_LIST}")
70
+
71
+ target_include_directories(_jaxdecomp
72
+ PRIVATE
73
+ ${CMAKE_CURRENT_LIST_DIR}/src/csrc/include
74
+ ${CMAKE_CURRENT_SOURCE_DIR}/third_party/cuDecomp/include
75
+ ${NVHPC_CUDA_INCLUDE_DIR}
76
+ ${MPI_CXX_INCLUDE_DIRS}
77
+ ${NVHPC_MATH_INCLUDE_DIR}
78
+ ${NCCL_INCLUDE_DIR}
79
+ )
80
+
81
+ target_link_libraries(_jaxdecomp PRIVATE MPI::MPI_CXX)
82
+ target_link_libraries(_jaxdecomp PRIVATE NVHPC::CUFFT)
83
+ target_link_libraries(_jaxdecomp PRIVATE NVHPC::CUTENSOR)
84
+ target_link_libraries(_jaxdecomp PRIVATE NVHPC::CUDA)
85
+ target_link_libraries(_jaxdecomp PRIVATE ${NCCL_LIBRARY})
86
+ target_link_libraries(_jaxdecomp PRIVATE cudecomp)
87
+ target_link_libraries(_jaxdecomp PRIVATE stdc++fs)
88
+ set_target_properties(_jaxdecomp PROPERTIES LINKER_LANGUAGE CXX)
89
+ target_compile_definitions(_jaxdecomp PRIVATE JD_CUDECOMP_BACKEND)
90
+ else()
91
+ pybind11_add_module(_jaxdecomp src/csrc/jaxdecomp.cc)
92
+ target_include_directories(_jaxdecomp PRIVATE ${CMAKE_CURRENT_LIST_DIR}/src/csrc/include)
93
+ target_compile_definitions(_jaxdecomp PRIVATE JD_JAX_BACKEND)
94
+ endif()
95
+
96
+ set_target_properties(_jaxdecomp PROPERTIES INSTALL_RPATH "$ORIGIN/lib")
97
+ install(TARGETS _jaxdecomp LIBRARY DESTINATION . PUBLIC_HEADER DESTINATION .)
@@ -0,0 +1,46 @@
1
+ # Code and Contribution guidelines
2
+
3
+ ## Code formatting
4
+
5
+ Formatting is enforced using [yapf](https://github.com/google/yapf) and automatically applied using pre-commit hooks. To manually format the code, run the following command:
6
+
7
+ ```shell
8
+ yapf -i -r .
9
+ ```
10
+ but we highly recommend using the pre-commit hooks to ensure consistent formatting across the codebase, see below.
11
+
12
+ ### Pre-commit
13
+
14
+ We use pre-commit to enforce code formatting and quality standards. Follow these steps to install and use pre-commit:
15
+
16
+ 1. Make sure you have Python installed on your system.
17
+
18
+ 2. Install pre-commit by running the following command in your terminal:
19
+
20
+ ```shell
21
+ pip install pre-commit
22
+ ```
23
+
24
+ 3. Navigate to the root directory of your project.
25
+
26
+ 4. Run the following command to initialize pre-commit:
27
+
28
+ ```shell
29
+ pre-commit install
30
+ ```
31
+
32
+ 5. Now, whenever you make a commit, pre-commit will automatically run the configured hooks on the files you modified. If any issues are found, pre-commit will prevent the commit from being made.
33
+
34
+ You can also manually run pre-commit on all files by running the following command:
35
+
36
+ ```shell
37
+ pre-commit run --all-files
38
+ ```
39
+
40
+ This is useful if you want to check all files before making a commit.
41
+
42
+ 6. Customize the pre-commit configuration by creating a `.pre-commit-config.yaml` file in the root directory of your project. This file allows you to specify which hooks should be run and how they should be configured.
43
+
44
+ For more information on configuring pre-commit, refer to the [pre-commit documentation](https://pre-commit.com/#configuration).
45
+
46
+ That's it! You now have pre-commit set up to automatically enforce code formatting and quality standards in your project.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Differentiable Universe Initiative
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.