Skip to content

Mac M1/M2/M? support #13

Open
Open

Description

@yossibokorbleile

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.

Activity

  1. DavidLapous commented on Jul 5, 2024

    @DavidLapous
    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.

  2. yossibokorbleile commented on Jul 5, 2024

    @yossibokorbleile
    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.

  3. DavidLapous commented on Jul 5, 2024

    @DavidLapous
    Owner

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions