Skip to content
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

chore: use torch.index_add to compute new centroids, to improve training performance on MPS #1371

Merged
merged 4 commits into from
Oct 7, 2023

Conversation

eddyxu
Copy link
Contributor

@eddyxu eddyxu commented Oct 7, 2023

No description provided.

@eddyxu
Copy link
Contributor Author

eddyxu commented Oct 7, 2023

On Macbook M2 Max, MPS delivers about 18x speed up

--------------------------------------------------------------------------- benchmark 'kmeans': 2 tests ----------------------------------------------------------------------------
Name (time in s)          Min                Max               Mean            StdDev             Median               IQR            Outliers     OPS            Rounds  Iterations
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
test_kmeans_torch      1.7747 (1.0)       1.8892 (1.0)       1.8184 (1.0)      0.0430 (1.0)       1.8113 (1.0)      0.0447 (1.0)           2;0  0.5499 (1.0)           5           1
test_kmeans           31.0650 (17.50)    33.9675 (17.98)    32.4824 (17.86)    1.1904 (27.67)    32.0705 (17.71)    1.8994 (42.46)         2;0  0.0308 (0.06)          5           1
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

@eddyxu eddyxu merged commit 9a56cff into main Oct 7, 2023
10 checks passed
@eddyxu eddyxu deleted the lei/mps_perf branch October 7, 2023 04:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants