Skip to content

Instantly share code, notes, and snippets.

@SteveBronder
Created March 18, 2020 18:25
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SteveBronder/318844e588b7f9243bfaa5d595ee7980 to your computer and use it in GitHub Desktop.
Save SteveBronder/318844e588b7f9243bfaa5d595ee7980 to your computer and use it in GitHub Desktop.
USER_OPTIM_FLAGS= -pipe -fPIC -O3 -mtune=native -march=native
# I couldn't tell whether the opencl headers we use existed in `StanHeaders` on cran
# So I do a
# git clone --recursive https://github.com/stan-dev/rstan
# and then include the OpenCL headers
USER_OPENCL_FLAGS= -I"/path_to_rstan/rstan/StanHeaders/inst/include/mathlib/lib/opencl_2.1.0"
# You can get these with clinfo -l
USER_OPENCL_FLAGS+= -DSTAN_OPENCL=1 -DOPENCL_DEVICE_ID=1 -DOPENCL_PLATFORM_ID=2 -lOpenCL
# Some extra bits we need
USER_OPENCL_FLAGS+= -DCL_HPP_TARGET_OPENCL_VERSION=120 -DCL_HPP_MINIMUM_OPENCL_VERSION=120 -DCL_HPP_ENABLE_EXCEPTIONS -Wno-ignored-attributes
PKG_CPPFLAGS+= $(USER_OPENCL_FLAGS) $(USER_OPTIM_FLAGS)
CXXFLAGS+= $(USER_OPENCL_FLAGS) $(USER_OPTIM_FLAGS)
CXX14FLAGS+= $(USER_OPENCL_FLAGS) $(USER_OPTIM_FLAGS)
CXX11FLAGS+= $(USER_OPENCL_FLAGS) $(USER_OPTIM_FLAGS)
PKG_LDLIBS+=-lOpenCL
LDLIBS+=-lOpenCL
PKG_LIBS+=-lOpenCL
LD_LIBRARY_PATH+=-lOpenCL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment