-
Notifications
You must be signed in to change notification settings - Fork 41
ND, feature transform, tests, performance improvements #58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
kevinjohncutler
wants to merge
118
commits into
seung-lab:master
Choose a base branch
from
kevinjohncutler:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
118 commits
Select commit
Hold shift + click to select a range
45f524b
working feature trasnform
kevinjohncutler 9d710a1
faster expand labels
kevinjohncutler 42cd8ef
faster
kevinjohncutler dbadc5c
True ND
kevinjohncutler c2903a9
tuning
kevinjohncutler 597fe3b
parity
kevinjohncutler ecfa3c1
parallel tuning
kevinjohncutler 629d0ff
better performance
kevinjohncutler 24caea4
tests
kevinjohncutler 6d0dbd4
run tests
kevinjohncutler 8320f53
update test yaml
kevinjohncutler 21d73de
test yaml
kevinjohncutler ce1eff2
fix build on M3
kevinjohncutler babe06c
fix windows build
kevinjohncutler df4bb26
fix profile
kevinjohncutler 5a7c575
faster across the board depending on threads
kevinjohncutler 6e8f5ea
testing refactor
kevinjohncutler 6ff3bd6
faster across the board
kevinjohncutler 413590d
cleanup
kevinjohncutler 533b54c
cleanup
kevinjohncutler e1a0bc6
cleanup
kevinjohncutler e15fe81
CI
kevinjohncutler d88b94d
fix tests
kevinjohncutler 66c32f4
refactor
kevinjohncutler f8f7358
refacotr and tests
kevinjohncutler f45fe9c
tests
kevinjohncutler 061a269
tests
kevinjohncutler 07b814f
CI
kevinjohncutler 80001b3
CI
kevinjohncutler a4e8336
CI
kevinjohncutler 15275ee
Sync legacy with upstream and add feature transform tests
kevinjohncutler b01f628
Remove upstream snapshot
kevinjohncutler f952e19
Refactor dtype dispatch in edtsq_nd
kevinjohncutler 024600e
Checkpoint before fused dispatch refactor
kevinjohncutler 6074302
Fuse ND dispatch and align legacy build flags
kevinjohncutler f59382a
Fuse ND dispatch, align legacy flags, update wheel workflow
kevinjohncutler 0ade9d6
Fix wheel build version scheme
kevinjohncutler a2c349b
Rename ND APIs and clean threadpool join
kevinjohncutler 2ea2f14
Add legacy docstrings to ND functions
kevinjohncutler 1aa0b30
Fix wheel version scheme in CI
kevinjohncutler e81ddc3
Fix wheel version scheme
kevinjohncutler 7cb2008
Add voxel graph tests and debug utils
kevinjohncutler 2b4c4ec
Limit wheel arch targets
kevinjohncutler e143276
Refine ND batch pass and CI benchmarks
kevinjohncutler 3c0a2fa
Fix benchmark summary import
kevinjohncutler 7d2d495
Enable ND profile in benchmark workflow
kevinjohncutler d387e67
Sanitize benchmark summary titles
kevinjohncutler e05e718
Use median timing with 20 reps in benchmarks
kevinjohncutler e67af41
Strip literal newline escapes from benchmark summary
kevinjohncutler b4c01c4
Fix benchmark summary newlines
kevinjohncutler 3f28d82
updated test templates
kevinjohncutler d3020b7
barrier algorithm
kevinjohncutler 40e2976
memset confirm
kevinjohncutler 0f44c72
minor optim
kevinjohncutler f495073
filter_active_scanlines
kevinjohncutler c0b9f21
benchmarking
kevinjohncutler 523099c
numa
kevinjohncutler 434bd9b
closer to parity on AMD
kevinjohncutler 70ffb40
nd_v2 graph based
kevinjohncutler 8bb5c8c
cleanup, typos, readme
kevinjohncutler b405d0e
remove experimental extensions from CI build
kevinjohncutler 06caffb
remove edt_barrier dependency from tests
kevinjohncutler c6c8be8
use edt_legacy for sdf test comparison
kevinjohncutler 45bb7bf
dtypes, readme memory
kevinjohncutler 9c947d0
fix legacy module detection in benchmark scripts
kevinjohncutler 9d852d3
readme
kevinjohncutler 4c0cb01
readme
kevinjohncutler d2476b7
generalize voxel graph memory
kevinjohncutler 8fd4e69
scripts
kevinjohncutler 2a25aea
scripts
kevinjohncutler bf3a985
populate _nd_profile_last with parallel_used in edtsq/edtsq_graph
kevinjohncutler 46544ff
factor dimension handling
kevinjohncutler f3d391a
double
kevinjohncutler 978b456
sqrt allocation
kevinjohncutler 2d2d412
hedley
kevinjohncutler 38a6a25
env variables
kevinjohncutler 56497d4
scope contamination, special cases
kevinjohncutler e2c5274
fortran order support
kevinjohncutler ced2072
prefetch env vars
kevinjohncutler 50b67b5
remove prefetch
kevinjohncutler 9dadc11
view
kevinjohncutler b0b8af0
remove float casts
kevinjohncutler 6a8cf45
remove unneeded casts
kevinjohncutler d1b9328
docstrings, generalize build_graph
kevinjohncutler 7c74154
MSVC
kevinjohncutler 09fa3e2
MSVC
kevinjohncutler aec6c8f
address PR review comments
kevinjohncutler 33a7697
optimize build
kevinjohncutler e9706de
native arm
kevinjohncutler 130b21d
build tweaks
kevinjohncutler 0347c4e
foreground bit 0
kevinjohncutler bdf51f7
view, cdef
kevinjohncutler b502f97
build wheels
kevinjohncutler 6c17443
bools, remove features_dtype
kevinjohncutler 453e908
C++ implementation of expand_labels
kevinjohncutler a75364c
thread caps
kevinjohncutler 7aed682
cleanup
kevinjohncutler c5be4fd
cleanup
kevinjohncutler 3961a9c
cleanup
kevinjohncutler 541ac79
32D
kevinjohncutler d41c3d5
threadpool and cleanup
kevinjohncutler 4768bbf
cleanup
kevinjohncutler 99bee54
cleanup
kevinjohncutler c804253
cleanup
kevinjohncutler aae10e1
cleanup, refactor
kevinjohncutler b2122ca
cleanup, refactor
kevinjohncutler 94a36f8
cleanup, helpers
kevinjohncutler 52d5a34
cleanup, style
kevinjohncutler 88ffabf
namefix
kevinjohncutler 6caff12
clean
kevinjohncutler b9a7bb2
intel mac build
kevinjohncutler 80cd6ca
CI bench
kevinjohncutler 6a485e0
ForkJoinPool, buf cache, blocked transpose
kevinjohncutler e4428cd
setup.py
kevinjohncutler 75cc5ad
MSVC
kevinjohncutler a69bbcd
new thread caps
kevinjohncutler 99703a3
build
kevinjohncutler 21a691a
comments
kevinjohncutler File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,108 @@ | ||
| name: ND Benchmark Profile | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| bench: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: "3.11" | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| python -m pip install numpy | ||
|
|
||
| - name: Install package (editable) | ||
| run: python -m pip install -e . | ||
|
|
||
| - name: Run legacy vs ND benchmark | ||
| run: | | ||
| set -euo pipefail | ||
| # Dense (structured) templates | ||
| python scripts/bench_explicit_threads.py \ | ||
| --parallels 1,2,4,8 --reps 20 --dtype uint16 --profile \ | ||
| --shapes 128x128,512x512,1024x1024,2048x2048 --template structured --grid-base 8x8 \ | ||
| --output benchmarks/legacy_vs_nd_explicit_ci.template_structured_2d.csv | ||
| python scripts/bench_explicit_threads.py \ | ||
| --parallels 1,2,4,8 --reps 20 --dtype uint16 --profile \ | ||
| --shapes 96x96x96,192x192x192 --template structured --grid-base 8x8x8 \ | ||
| --output benchmarks/legacy_vs_nd_explicit_ci.template_structured_3d.csv | ||
|
|
||
| # Sparse (mod8) templates | ||
| python scripts/bench_explicit_threads.py \ | ||
| --parallels 1,2,4,8 --reps 20 --dtype uint16 --profile \ | ||
| --shapes 128x128,512x512,1024x1024,2048x2048 --template structured_mod8 --grid-base 8x8 \ | ||
| --output benchmarks/legacy_vs_nd_explicit_ci.template_structured_mod8_2d.csv | ||
| python scripts/bench_explicit_threads.py \ | ||
| --parallels 1,2,4,8 --reps 20 --dtype uint16 --profile \ | ||
| --shapes 96x96x96,192x192x192 --template structured_mod8 --grid-base 8x8x8 \ | ||
| --output benchmarks/legacy_vs_nd_explicit_ci.template_structured_mod8_3d.csv | ||
|
|
||
| # Circle templates (2D only) | ||
| python scripts/bench_explicit_threads.py \ | ||
| --parallels 1,2,4,8 --reps 20 --dtype uint16 --profile \ | ||
| --shapes 128x128,512x512,1024x1024,2048x2048 --template circles_small \ | ||
| --output benchmarks/legacy_vs_nd_explicit_ci.template_circles_small_2d.csv | ||
| python scripts/bench_explicit_threads.py \ | ||
| --parallels 1,2,4,8 --reps 20 --dtype uint16 --profile \ | ||
| --shapes 128x128,512x512,1024x1024,2048x2048 --template circles_large \ | ||
| --output benchmarks/legacy_vs_nd_explicit_ci.template_circles_large_2d.csv | ||
|
|
||
| - name: Summarize results | ||
| run: | | ||
| python - <<'PY' | ||
| import csv | ||
| import os | ||
| from pathlib import Path | ||
|
|
||
| header = [ | ||
| "shape", | ||
| "dims", | ||
| "parallel", | ||
| "legacy_ms", | ||
| "nd_ms", | ||
| "ratio", | ||
| "nd_parallel_used", | ||
| "max_abs_diff", | ||
| ] | ||
|
|
||
| def render_table(title, csv_path): | ||
| title = title.replace("\n", " ").strip() | ||
| if not csv_path.exists(): | ||
| return f"### {title}\n\nMissing CSV: `{csv_path}`\n" | ||
| with csv_path.open() as fp: | ||
| reader = csv.DictReader(fp) | ||
| rows = list(reader) | ||
| if not rows: | ||
| return f"### {title}\n\nNo benchmark rows captured.\n" | ||
| table = [f"### {title}\n", "| " + " | ".join(header) + " |"] | ||
| table.append("| " + " | ".join(["---"] * len(header)) + " |") | ||
| for row in rows: | ||
| table.append("| " + " | ".join(row[h] for h in header) + " |") | ||
| return "\n".join(table) + "\n" | ||
|
|
||
| sections = [] | ||
| sections.append(render_table("Structured (dense) 2D", Path("benchmarks/legacy_vs_nd_explicit_ci.template_structured_2d.csv"))) | ||
| sections.append(render_table("Structured (dense) 3D", Path("benchmarks/legacy_vs_nd_explicit_ci.template_structured_3d.csv"))) | ||
| sections.append(render_table("Structured mod8 (sparse) 2D", Path("benchmarks/legacy_vs_nd_explicit_ci.template_structured_mod8_2d.csv"))) | ||
| sections.append(render_table("Structured mod8 (sparse) 3D", Path("benchmarks/legacy_vs_nd_explicit_ci.template_structured_mod8_3d.csv"))) | ||
| sections.append(render_table("Circles small 2D", Path("benchmarks/legacy_vs_nd_explicit_ci.template_circles_small_2d.csv"))) | ||
| sections.append(render_table("Circles large 2D", Path("benchmarks/legacy_vs_nd_explicit_ci.template_circles_large_2d.csv"))) | ||
|
|
||
| summary_path = Path(os.environ["GITHUB_STEP_SUMMARY"]) | ||
| summary_path.write_text("## ND Benchmark Profile\n\n" + "\n".join(sections)) | ||
| PY | ||
|
|
||
| - name: Upload benchmark CSV | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: legacy-vs-nd-explicit-results | ||
| path: benchmarks/legacy_vs_nd_explicit_ci.template_*.csv | ||
| if-no-files-found: error |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,45 +1,54 @@ | ||
| name: Build Wheels | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| workflow_dispatch: {} | ||
| push: | ||
| tags: | ||
| - '*' | ||
| env: | ||
| CIBW_SKIP: pp38* pp39* pp310* *-musllinux* | ||
| # Supported stable CPython versions (adjust as versions EOL). | ||
| CIBW_BUILD: "cp310-* cp311-* cp312-* cp313-* cp314-*" | ||
| CIBW_SKIP: "*-musllinux*" | ||
|
|
||
| jobs: | ||
| build_wheels: | ||
| name: Build wheels on ${{matrix.arch}} for ${{ matrix.os }} | ||
| name: Build ${{ matrix.archs_linux }}${{ matrix.archs_windows }}${{ matrix.archs_macos }} on ${{ matrix.os }} | ||
| runs-on: ${{ matrix.os }} | ||
| strategy: | ||
| matrix: | ||
| os: [ubuntu-latest, windows-2019, macos-latest] | ||
| arch: [auto] | ||
| include: | ||
| - os: ubuntu-latest | ||
| arch: aarch64 | ||
| archs_linux: "x86_64" | ||
| - os: ubuntu-24.04-arm | ||
| archs_linux: "aarch64" | ||
| - os: windows-latest | ||
| archs_windows: "AMD64" | ||
| - os: windows-11-arm | ||
| archs_windows: "ARM64" | ||
| cibw_build: "cp311-* cp312-* cp313-* cp314-*" # cp310 lacks win_arm64 support | ||
| - os: macos-15-intel | ||
| archs_macos: "x86_64" | ||
| - os: macos-latest | ||
| archs_macos: "arm64" | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v2 | ||
|
|
||
| - name: Set up QEMU | ||
| if: ${{ matrix.arch == 'aarch64' }} | ||
| uses: docker/setup-qemu-action@v1 | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Build wheels | ||
| uses: pypa/cibuildwheel@v2.22.0 | ||
| uses: pypa/cibuildwheel@v3.3.1 | ||
| with: | ||
| output-dir: ./wheelhouse | ||
| # to supply options, put them in 'env', like: | ||
| env: | ||
| CIBW_ARCHS_LINUX: ${{matrix.arch}} | ||
| CIBW_BEFORE_BUILD: pip install numpy setuptools wheel | ||
| CIBW_ARCHS_MACOS: "x86_64 arm64" | ||
| CIBW_BUILD: ${{ matrix.cibw_build || env.CIBW_BUILD }} | ||
| CIBW_ARCHS_LINUX: ${{ matrix.archs_linux }} | ||
| CIBW_ARCHS_WINDOWS: ${{ matrix.archs_windows }} | ||
| CIBW_ARCHS_MACOS: ${{ matrix.archs_macos }} | ||
| # Avoid date-stamped local versions that can cause wheel filename mismatch. | ||
| CIBW_ENVIRONMENT: "SETUPTOOLS_SCM_LOCAL_SCHEME=no-local-version EDT_MARCH_NATIVE=0" | ||
|
|
||
| - name: Upload built wheels | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: built-wheels-${{ matrix.os }}-${{ matrix.arch }} | ||
| name: built-wheels-${{ matrix.os }}-${{ matrix.archs_linux }}${{ matrix.archs_windows }}${{ matrix.archs_macos }} | ||
| path: ./wheelhouse/*.whl | ||
| if-no-files-found: warn | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| Kevin Cutler <39454982+kevinjohncutler@users.noreply.github.com> | ||
| Pavlo Hilei <45758974+Pavlik1400@users.noreply.github.com> | ||
| William Silversmith <william.silversmith@gmail.com> | ||
| William Silversmith <ws9@princeton.edu> |
Empty file.
Empty file.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.