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

No CPU option for binary minimization #1105

Merged
merged 3 commits into from
May 13, 2024
Merged

No CPU option for binary minimization #1105

merged 3 commits into from
May 13, 2024

Conversation

awni
Copy link
Member

@awni awni commented May 12, 2024

Proposed changes

Adds the option to disable building the CPU backend for GPU only programs.

One can produce a much C++ binary with the following:

cmake .. \
  -DCMAKE_BUILD_TYPE=MinSizeRel \
  -DBUILD_SHARED_LIBS=ON \
  -DMLX_BUILD_CPU=ON \
  -DMLX_BUILD_SAFETENSORS=OFF \
  -DMLX_BUILD_GGUF=OFF

Produces libmlx.dylib which is just 2.0 MB, compared to the default libmlx.a which is 17.0 MB

Copy link
Member

@angeloskath angeloskath left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@awni awni merged commit 7178ac0 into main May 13, 2024
3 checks passed
@awni awni deleted the no_cpu branch May 13, 2024 23:08
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