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

Optimisations for Apple Silicon #3606

Closed
danbricedatascience opened this issue Nov 28, 2020 · 8 comments
Closed

Optimisations for Apple Silicon #3606

danbricedatascience opened this issue Nov 28, 2020 · 8 comments

Comments

@danbricedatascience
Copy link

When does LightGBM is (roughly) expected to support Apple Silicon ?

@StrikerRUS
Copy link
Collaborator

What do you mean by "support"?

I believe LightGBM can be compiled on Apple Silicon. If compilation fails, could you kindly provide any logs from your machine?

@danbricedatascience
Copy link
Author

Hi, by support I mean not only compiling it but enable using every ML capabilities, so the 8 cores GPU, the two neural accelerators and the 16 cores Neural Engine for model training, so not using Cuda but a totally different approach. Tensorflow already has an alpha version available for testing but seems far to be working perfectly in any situation for the moment, and Apple helps google on this task so it doesn't seem trivial.

Anyway recompiling it for CPU is a first step. Not sure if can be done as for instance numpy cannot be recompiled like this, it totally fails. Anyway I will try.

@StrikerRUS
Copy link
Collaborator

Thanks a lot for your fast response! To be honest, I don't think that this kind of support (Mac-optimized version actually) will be implemented in the near future. At least, not by our small maintaining team without any help from the outside.

Our current GPU implementation is far from perfect in terms of GPU utilization #768 (comment) and new CUDA implementation kindly contributed by IBM folks has some bugs that don't allow us even to announce it. So, I think this "general" GPU issues have more priority. Also, please note that Mac-optimized TensorFlow version are developing by Apple and Tensorflow-team is planing just adding that version as community-supported:

In the near future, we’ll be making updates like this even easier for users to get these performance numbers by integrating the forked version into the TensorFlow master branch.

@StrikerRUS
Copy link
Collaborator

Linking dmlc/xgboost#6408 here.

@danbricedatascience
Copy link
Author

@StrikerRUS Thanks for your answer. Anyway if it can at least work in standard CPU mode it could already be great. I will try to compile when I will have time and let you know.

@guolinke
Copy link
Collaborator

@danbricedatascience I think the "ML engine" is better for neural networks, not for decision trees.

@danbricedatascience
Copy link
Author

danbricedatascience commented Nov 30, 2020

@guolinke yes maybe it's a pure linear algebra unit, like a TPU, but this is the same for GPUs, it's pure SIMD units mostly used for vector computing in ML. I don't know how LightGBM or the others Gradient Boosting are using GPUs but they are, so at least if it cannot use the M1 Neural Engine, it can maybe use its GPU ? This 2.2 TFlops unit that has nothing to do with Intel integrated GPUs, check benchmarks.

Apple says here:

"Until now, TensorFlow has only utilized the CPU for training on Mac. The new tensorflow_macos fork of TensorFlow 2.4 leverages ML Compute to enable machine learning libraries to take full advantage of not only the CPU, but also the GPU in both M1- and Intel-powered Macs for dramatically faster training performance. This starts by applying higher-level optimizations such as fusing layers, selecting the appropriate device type and compiling and executing the graph as primitives that are accelerated by BNNS on the CPU and Metal Performance Shaders on the GPU."

Again, this is for Tensors computing as used in TF, but it could be interesting to check if the type of GPU acceleration used in Gradient Boosting packages like LightGBM can also be applied here.

@StrikerRUS
Copy link
Collaborator

Closed in favor of being in #2302. We decided to keep all feature requests in one place.

Welcome to contribute this feature! Please re-open this issue (or post a comment if you are not a topic starter) if you are actively working on implementing this feature.

@StrikerRUS StrikerRUS changed the title Support for Apple Silicon Optimisations for Apple Silicon Jan 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants