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

Sanity check for OpenCL Library #65

Merged
merged 3 commits into from
Sep 16, 2018
Merged
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
23 changes: 17 additions & 6 deletions mk/opencl.mk
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
# FIXME: perform sanity checks before compilation
OPENCL_LIB ?= /usr/local/cuda-9.1/lib64
# Default the path to the NVIDIA Run time Library
OPENCL_LIB_PATH ?= /usr/local/cuda/lib64

CFLAGS += \
-DENABLE_OPENCL \
-I$(OPENCL_PATH)/include
LDFLAGS += -L$(OPENCL_LIB) -lOpenCL
OPENCL_LIB_DIR := $(shell test -d $(OPENCL_LIB_PATH); echo $$?)

ifneq ($(OPENCL_LIB_DIR),0)
$(error "Please specify the path to your OpenCL library on your platform")
endif

OPENCL_LIB_AVAIL := $(shell ls $(OPENCL_LIB_PATH) | grep -oi libOpenCL.so > /dev/null; echo $$?)

ifneq ($(OPENCL_LIB_AVAIL),0)
$(error "Please check the availability of your OpenCL shared library in $(OPENCL_LIB_PATH)")
endif

CFLAGS += -DENABLE_OPENCL

LDFLAGS += -L$(OPENCL_LIB_PATH) -lOpenCL