Skip to content

Commit

Permalink
migrate ETS to C++ (#757)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmoralez authored Aug 30, 2024
1 parent 29f4734 commit beb7fcf
Show file tree
Hide file tree
Showing 43 changed files with 1,481 additions and 1,492 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ jobs:
steps:
- name: Clone repo
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
submodules: "true"
- name: Clone docs repo
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
Expand Down
119 changes: 111 additions & 8 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,46 +14,138 @@ env:
NIXTLA_NUMBA_CACHE: "1"

jobs:
build_wheels:
name: Build wheels for cp${{ matrix.python-version }}-${{ matrix.os-platform[1] }}
runs-on: ${{ matrix.os-platform[0] }}
strategy:
fail-fast: false
matrix:
python-version: [38, 39, 310, 311, 312]
os-platform:
[
[ubuntu-latest, manylinux_x86_64],
[ubuntu-latest, manylinux_aarch64],
[windows-latest, win_amd64],
[macos-12, macosx_x86_64],
[macos-14, macosx_arm64],
]
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
submodules: "true"

- name: Set up QEMU
if: matrix.os-platform[1] == 'manylinux_aarch64'
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0
with:
platforms: arm64

- name: Build wheels
uses: pypa/cibuildwheel@bd033a44476646b606efccdd5eed92d5ea1d77ad # v2.20.0
env:
CIBW_BUILD: cp${{ matrix.python-version }}-${{ matrix.os-platform[1] }}

- uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
with:
name: artifact-cp${{ matrix.python-version }}-${{ matrix.os-platform[1] }}
path: wheelhouse/*.whl
retention-days: 1

publish-nightly-wheels:
if: github.event_name == 'push'
needs: [build_wheels]
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID_NIXTLA_PACKAGES }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY_NIXTLA_PACKAGES }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: Download wheels
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
path: dist
pattern: "artifact-*"
merge-multiple: true

- uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1
with:
python-version: "3.10"

- name: Publish wheels
run: |
pip install awscli beautifulsoup4
aws s3 cp s3://nixtla-packages/statsforecast/index.html .
python action_files/update_index.py
aws s3 sync dist s3://nixtla-packages/statsforecast/
run-local-tests:
runs-on: windows-latest
needs: [build_wheels]
runs-on: ${{ matrix.os }}
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
os: [macos-13, macos-14, windows-latest]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- name: Clone repo
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
submodules: "true"

- name: Set up environment
uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1
with:
python-version: ${{ matrix.python-version }}

- name: Install pip requirements
run: pip install uv && uv pip install --system ".[dev,plotly]"
run: pip install uv && uv pip install --system -r setup.py --extra dev --extra plotly

- name: Download wheels
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
path: dist
pattern: "artifact-*"
merge-multiple: true

- name: Install the library
run: pip install --no-index --find-links dist statsforecast

- name: Run local tests
run: nbdev_test --skip_file_re '(models|distributed|ets|prophet).*.ipynb' --pause 1.0 --do_print --timing
run: nbdev_test --skip_file_re '(distributed|prophet).*.ipynb' --pause 1.0 --do_print --timing

run-tests:
runs-on: ${{ matrix.os }}
needs: [build_wheels]
runs-on: ubuntu-latest
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-13]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- name: Clone repo
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
submodules: "true"

- name: Set up environment
uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1
with:
python-version: ${{ matrix.python-version }}

- name: Install pip requirements
run: pip install uv && uv pip install --system ".[all]"
run: pip install uv && uv pip install --system -r setup.py --extra all

- name: Download wheels
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
path: dist
pattern: "artifact-*"
merge-multiple: true

- name: Install the library
run: pip install --no-index --find-links dist statsforecast

- name: Run tests
run: nbdev_test --skip_file_re '(distributed|prophet).*.ipynb' --pause 1.0 --do_print --timing
Expand All @@ -64,6 +156,7 @@ jobs:
pytest --durations=0 action_files
test-m3-performance:
needs: [build_wheels]
runs-on: ubuntu-latest
steps:
- name: Clone repo
Expand All @@ -74,8 +167,18 @@ jobs:
with:
python-version: "3.10"

- name: Install library and extra deps
run: pip install uv && uv pip install --system ".[dev]"
- name: Install pip requirements
run: pip install uv && uv pip install --system -r setup.py --extra dev

- name: Download wheels
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
path: dist
pattern: "artifact-*"
merge-multiple: true

- name: Install the library
run: pip install --no-index --find-links dist statsforecast

- name: Run M3 experiment
run: |
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ jobs:
- name: Set up python
uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1
with:
python-version: '3.10'
python-version: "3.10"

- name: Install linters
run: pip install black nbdev pre-commit
run: pip install black 'nbdev<2.3.26' pre-commit

- name: Run pre-commit
run: pre-commit run --files statsforecast/*
run: pre-commit run --files python/statsforecast/*
78 changes: 65 additions & 13 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,77 @@
name: Upload Python Package

on:
release:
types: [published]
push:
tags: ["v*"]

jobs:
deploy:
build_wheels:
name: Build wheels for cp${{ matrix.python-version }}-${{ matrix.os-platform[1] }}
runs-on: ${{ matrix.os-platform[0] }}
strategy:
fail-fast: false
matrix:
python-version: [38, 39, 310, 311, 312]
os-platform:
[
[ubuntu-latest, manylinux_x86_64],
[ubuntu-latest, manylinux_aarch64],
[windows-latest, win_amd64],
[macos-12, macosx_x86_64],
[macos-14, macosx_arm64],
]
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
submodules: "true"

- name: Set up QEMU
if: matrix.os-platform[1] == 'manylinux_aarch64'
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0
with:
platforms: arm64

- name: Build wheels
uses: pypa/cibuildwheel@bd033a44476646b606efccdd5eed92d5ea1d77ad # v2.20.0
env:
CIBW_BUILD: cp${{ matrix.python-version }}-${{ matrix.os-platform[1] }}

- uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
with:
name: artifact-cp${{ matrix.python-version }}-${{ matrix.os-platform[1] }}
path: wheelhouse/*.whl
retention-days: 1

build_sdist:
name: Build sdist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1
with:
python-version: "3.10"

- name: Build sdist
run: |
python -m pip install build
python -m build --sdist --outdir dist
- uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
with:
path: dist/*.tar.gz

upload_to_pypi:
name: Upload to PyPI
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
permissions:
id-token: write

steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Set up Python
uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
python-version: '3.10'
- name: Install dependencies
run: python -m pip install build wheel
- name: Build package
run: python -m build -sw
- name: Publish package
name: artifact
path: dist

- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@ec4db0b4ddc65acdf4bff5fa45ac92d78b56bdf0 # v1.9.0
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ nbs/.last_checked
.idea
mlruns/
.luarc.json
*.so
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "external_libs/eigen"]
path = external_libs/eigen
url = https://gitlab.com/libeigen/eigen
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"editor.formatOnSave": true,
"C_Cpp.formatting": "clangFormat",
"C_Cpp.clang_format_sortIncludes": true,
"C_Cpp.default.cppStandard": "c++17"
}
Loading

0 comments on commit beb7fcf

Please sign in to comment.