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

feat: allow explicitly disabling CUDA step #1588

Merged
merged 3 commits into from
Mar 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions exla/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,27 +36,29 @@ else
CFLAGS += -O3
endif

NVCC := $(CXX)
NVCCFLAGS = $(CFLAGS)
LDFLAGS = -L$(XLA_EXTENSION_LIB) -lxla_extension -shared -fvisibility=hidden

ifeq ($(CROSSCOMPILE),)
# Interrogate the system for local compilation
UNAME_S = $(shell uname -s)

ifdef ($(EXLA_CPU_ONLY),)
$(info EXLA_CPU_ONLY is not set, checking for nvcc availability)
NVCC_RESULT := $(shell which nvcc 2> /dev/null)
NVCC_TEST := $(notdir $(NVCC_RESULT))

ifeq ($(NVCC_TEST),nvcc)
NVCC := nvcc
NVCCFLAGS += -DCUDA_ENABLED
ifeq ($(NVCC_TEST),nvcc)
NVCC := nvcc
NVCCFLAGS += -DCUDA_ENABLED
endif
else
NVCC := $(CXX)
NVCCFLAGS = $(CFLAGS)
$(info EXLA_CPU_ONLY is set, skipping nvcc step)
endif
else
# Determine settings for cross-compiled builds like for Nerves
UNAME_S = Linux
NVCC := $(CXX)
NVCCFLAGS = $(CFLAGS)
endif

ifeq ($(UNAME_S), Darwin)
Expand Down
2 changes: 2 additions & 0 deletions exla/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ EXLA relies on the [XLA](https://github.com/elixir-nx/xla) package to provide th
* Incompatible protocol buffer versions
* Error message: "this file was generated by an older version of protoc which is incompatible with your Protocol Buffer headers".
* If you have `protoc` installed on your machine, it may conflict with the `protoc` precompiled inside XLA. Uninstall, unlink, or remove `protoc` from your path to continue.
* Missing CUDA symbols
* In some cases, you might be compiling a CPU-only version of `:xla` in an environment that has CUDA available. For these cases, you can set the `EXLA_CPU_ONLY` environment variable to any value to disable custom CUDA functionality in EXLA.

### Usage with Nerves

Expand Down