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

Mac M1/M2/M? support #13

Open
yossibokorbleile opened this issue Jul 5, 2024 · 3 comments
Open

Mac M1/M2/M? support #13

yossibokorbleile opened this issue Jul 5, 2024 · 3 comments

Comments

@yossibokorbleile
Copy link

Hiya! Mac M1/M2/... are not compatible with CUDA, and so KeOps does not work. I keep getting

[KeOps] Warning : Cuda libraries were not detected on the system or could not be loaded ; using cpu only mode
[pyKeOps] Compiling pykeops cpp 25c52bb6f5 module ... 
[KeOps] Warning : There were warnings or errors :
g++: error: unrecognized command-line option '-Xclang'

OK

when I run

points = mp.data.three_annulus(5000,5000)
grades = - KDE(bandwidth=.1, return_log=True).fit(points).score_samples(points)

in the function_delaunay_test.ipynb notebook.

@DavidLapous
Copy link
Owner

Hey @yossibokorbleile, thanks for pointing that out;

First (unrelated) thing, I'm not really maintaining the notebooks in the tutorial folder anymore, as IIRC, they are all in the documentation in the docs/notebooks folder. I'm planning to remove this folder after checking that everything is in the doc.

For PyKeops on ARM + macOS, this is not linked with cuda and should work fine, but I opened an issue for a very similar problem (cf getkeops/keops#332) which was solved then, I hope what's in there helps you fix this.
Otherwise, feel free to open an issue there, I don't own a mac anymore, so it's hard for me to debug this.

You can also try to launch this with the conda install cxx-compiler installed.

In the meantime, the KDE can be completely replaced by

from sklearn.neighbors import KernelDensity as KDE

This will be slower and not pytorch-auto-differentiable, but should work fine otherwise.

@yossibokorbleile
Copy link
Author

Thanks!

Replacing KDE worked initially, until I tried

(simplextree,), = mmp.PointCloud2SimplexTree(expand_dim=2,bandwidths=[0.2], num_collapses="full", threshold=2, complex='rips').fit_transform([X])

in multipers_intro.ipynb.

I will just continue with testing functionality, and ignore anything KeOps related.

@DavidLapous
Copy link
Owner

DavidLapous commented Jul 5, 2024

Yes, this specific pipeline doesn't really have a non-keops alternative, but you can replace bandwidths by masses, which doesn't require keops, and should produce somehow similar pictures. This basically replaces a Gaussian Kernel Density Estimation (KDE) by the Distance To Measure (DTM), c.f., e.g., this tda paper.

I also forgot to mention that the GitHub workflow tests this pipeline on a mac with an M1 chip, and works fine with pykeops, with the default apple clang compiler. Can you try using the default compiler instead of gcc ?

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

No branches or pull requests

2 participants