Skip to content

Enable CPU-only builds on macOS - #616

Open
tilmantroester wants to merge 3 commits into
traveller59:masterfrom
tilmantroester:macos_cpu_only
Open

Enable CPU-only builds on macOS#616
tilmantroester wants to merge 3 commits into
traveller59:masterfrom
tilmantroester:macos_cpu_only

Conversation

@tilmantroester

Copy link
Copy Markdown

This PR enables CPU-only builds on macOS. It in addition to the changes to spconv, this also requires some changes to ccimport and cumm. They are implemented at https://github.com/tilmantroester/ccimport/tree/macos_support and
https://github.com/tilmantroester/cumm/tree/macos_cpu_only. Let me know if you want PRs for those as well.

I've tested this on an arm64 mac, with both Apple and conda clang.
For development installs (pip install -e), both JIT and non-JIT work. Standard installs require the non-JIT build.

Compiling with OpenMP works but the results are unstable, so I disabled OpenMP on macOS.

tests/test_conv.py passes for the cases where CPU implementations are available (i.e. ConvAlgo.Native but not for example SparseGlobalMaxPool).

@bcecb

bcecb commented Nov 22, 2024

Copy link
Copy Markdown

Hello, thank you for contribution to macOS. I saw your branch for ccimport and cumm. I try to install ccimport, cumm and spconv.(I git clone all them and then use pip install -e . to install them.) Then I try to run tests/test_conv.py. Unfortunately, it seems that something is wrong in cumm.
Traceback (most recent call last): File "/Users/apple/Desktop/spconv/spconv/test/test_conv.py", line 28, in <module> from spconv.core import ConvAlgo File "/Users/apple/Desktop/spconv/spconv/spconv/__init__.py", line 15, in <module> from . import build as _build File "/Users/apple/Desktop/spconv/spconv/spconv/build.py", line 21, in <module> from .constants import PACKAGE_NAME, PACKAGE_ROOT, DISABLE_JIT, SPCONV_INT8_DEBUG File "/Users/apple/Desktop/spconv/spconv/spconv/constants.py", line 19, in <module> from cumm.gemm.constants import NVRTCMode File "/Users/apple/Desktop/spconv/cumm/cumm/__init__.py", line 28, in <module> pccm.builder.build_pybind([ArrayPtr(), TensorViewBind()], File "/opt/anaconda3/envs/spconv/lib/python3.10/site-packages/pccm/core/__init__.py", line 983, in wrapper func(self, *args, **kwargs) File "/Users/apple/Desktop/spconv/cumm/cumm/tensorview_bind.py", line 51, in __init__ cuda_ver = get_cuda_version_by_nvcc().split(".") File "/Users/apple/Desktop/spconv/cumm/cumm/common.py", line 224, in get_cuda_version_by_nvcc nvcc_version = subprocess.check_output(["nvcc", "--version" File "/opt/anaconda3/envs/spconv/lib/python3.10/subprocess.py", line 421, in check_output return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, File "/opt/anaconda3/envs/spconv/lib/python3.10/subprocess.py", line 503, in run with Popen(*popenargs, **kwargs) as process: File "/opt/anaconda3/envs/spconv/lib/python3.10/subprocess.py", line 971, in __init__ self._execute_child(args, executable, preexec_fn, close_fds, File "/opt/anaconda3/envs/spconv/lib/python3.10/subprocess.py", line 1863, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) FileNotFoundError: [Errno 2] No such file or directory: 'nvcc'

@haixuanTao

Copy link
Copy Markdown

So I was able to go a little further with export CPU_ONLY=0 but still struggling to make the demo work

@haixuanTao

Copy link
Copy Markdown

Ok, so I need to modify the build script but now I'm able to compile for macOS with:

export CPU_ONLY=1

git clone https://github.com/tilmantroester/cumm --branch macos_cpu_only
pip install cumm

git clone https://github.com/haixuantao/spconv --branch master

git clone https://github.com/tilmantroester/ccimport --branch macos_support
pip install ccimport

cd spconv
pip install -e .
python test/test_conv.py

For more https://github.com/haixuantao/spconv but this is experimental !

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.

3 participants