dmlc / xgboost

Scalable, Portable and Distributed Gradient Boosting (GBDT, GBRT or GBM) Library, for Python, R, Java, Scala, C++ and more. Runs on single machine, Hadoop, Spark, Dask, Flink and DataFlow
https://xgboost.readthedocs.io/en/stable/
Apache License 2.0
26.3k stars 8.73k forks source link

Apple Silicon Compatibility #8054

Closed trivialfis closed 1 year ago

trivialfis commented 2 years ago

An issue tracking compatibility with Apple silicon. Continuation of https://github.com/dmlc/xgboost/issues/6408 .

Background

XGBoost works fine on Apple Silicon and there's no need for any special modification. The issue is pre-built binary package uses x86-specific instructions like cache prefetch. So if you are willing to build XGBoost from the source then everything works as usual. This issue is for tracking the pre-built binary packages that are available on maven and pip etc.

Current status

kameronlightheart14 commented 2 years ago

Is there an update to Maven package (jvm) support? Or a workaround? I haven't been able to use xgboost in my maven java project.

hcho3 commented 2 years ago

No not yet. This is difficult since we don't have access to testing platforms that uses Apple Silicon. The workaround is to build XGBoost4J from the source. See the instructions in https://xgboost.readthedocs.io/en/stable/build.html#building-jvm-packages.

Roh-codeur commented 1 year ago

@hcho3 : is there a reason there is no plan to support Apple GPU please? is it something the community can help with? for instance, is it the availability of machines? is it time?

thanks!

hcho3 commented 1 year ago

@Roh-codeur Mainly we (XGBoost developers) don't have time. Supporting Apple GPU requires us to rewrite the acceleration logic to fit the new hardware.

Roh-codeur commented 1 year ago

@hcho3 thanks, I understand. Given that the new Apple Sillicon promises new capabilities, hopefully, someone finds time to work on porting it to Apple Sillicon, ta!

drnguyen commented 1 year ago

I managed to compile and made the lib works on my Apple Silicon mac. Here are the steps that I did, probably it is useful for the community:

Once done, xgboost4j is available on your local mvn repo and ready to be used.

mmaloney007 commented 1 year ago

Are you saying this works for native apple silicon gpu support?

hcho3 commented 1 year ago

Are you saying this works for native apple silicon gpu support?

No. The support is for the CPU only.

dycasxe101 commented 1 year ago

I managed to compile and made the lib works on my Apple Silicon mac. Here are the steps that I did, probably it is useful for the community:

  • install brew (ARM Apple Silicon native)
  • brew install cmake, maven
  • download and install Java JDK 11, for example jdk-11.0.18_macos-aarch64_bin.dmg
  • clone the xgboost version that you need
  • go to the folder xgboost/jvm-packages
  • run the following
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-11.jdk/Contents/Home
export PATH=$JAVA_HOME/bin:$PATH
mvn -DskipTests install

Once done, xgboost4j is available on your local mvn repo and ready to be used.

still not success on my laptop

hcho3 commented 1 year ago

Hi everyone, we are seeking donations to rent a Mac Mini (M2) from MacStadium. If we reach our goal of raising 110 USD/month, we will be able to natively support JVM packages on Apple Silicon. Please consider making donations at https://opencollective.com/xgboost/projects/ci-for-apple-silicon?slug=ci-for-apple-silicon.

See #9570 for more details.

brndnsy commented 1 year ago

Hi everyone, we are seeking donations to rent a Mac Mini (M2) from MacStadium. If we reach our goal of raising 110 USD/month, we will be able to natively support JVM packages on Apple Silicon. Please consider making donations at https://opencollective.com/xgboost/projects/ci-for-apple-silicon?slug=ci-for-apple-silicon.

See #9570 for more details.

Would this mean that XGBoost would work with the GPU of Apple Silicon devices in Python e.g. the M2 Max?

hcho3 commented 1 year ago

@brndnsy No, XGBoost will use only the CPU. I added a disclaimer to clarify this point. Also, the funding is for adding support for the JVM package.

hcho3 commented 1 year ago

Closing. Now the JVM package for XGBoost 2.0.1 contains the native binary targeting Apple Silicon.