Skip to content

Commit

Permalink
Add CLBlast support
Browse files Browse the repository at this point in the history
  • Loading branch information
yingted committed Oct 11, 2016
1 parent 13c5ab3 commit 8694101
Show file tree
Hide file tree
Showing 5 changed files with 531 additions and 8 deletions.
35 changes: 35 additions & 0 deletions CMakeModules/FindCLBlast.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# - Try to find CLBlast
# Once done this will define
#
# CLBLAST_FOUND - system has CLBlast
# CLBLAST_INCLUDE_DIRS - location of CLBlast.h
# CLBLAST_LIBRARIES - location of libCLBlast

IF(CLBLAST_INCLUDE_DIRS)
# Already in cache, be silent
set (CLBLAST_FIND_QUIETLY TRUE)
ENDIF (CLBLAST_INCLUDE_DIRS)

FIND_PATH(CLBLAST_ROOT_DIR
NAMES include/clblast_c.h
HINTS /usr/local/ $ENV{CLBLAST_ROOT}
DOC "CLBlast root directory.")

FIND_PATH(_CLBLAST_INCLUDE_DIRS
NAMES clblast_c.h
HINTS ${CLBLAST_ROOT_DIR}/include
DOC "CLBlast Include directory")

FIND_LIBRARY(_CLBLAST_LIBRARY
NAMES libclblast.so
HINTS ${CLBLAST_ROOT_DIR}/lib ${CLBLAST_ROOT_DIR}/lib64 ${CLBLAST_ROOT_DIR}/lib32
DOC "CLBlast lib directory")

SET(CLBLAST_INCLUDE_DIRS ${_CLBLAST_INCLUDE_DIRS})
SET(CLBLAST_LIBRARIES ${_CLBLAST_LIBRARY})

# handle the QUIETLY and REQUIRED arguments and set CLBLAST_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE (FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(CLBLAST DEFAULT_MSG CLBLAST_LIBRARIES CLBLAST_INCLUDE_DIRS)
MARK_AS_ADVANCED(CLBLAST_LIBRARIES CLBLAST_INCLUDE_DIRS)
8 changes: 8 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ find_package(CUDA)
find_package(OpenCL)
if(OpenCL_FOUND)
find_package(clBLAS)
if(NOT CLBLAS_FOUND)
find_package(CLBlast)
endif()
endif()
if(CUDA_FOUND)
find_package(NCCL)
Expand Down Expand Up @@ -144,6 +147,11 @@ if(OpenCL_FOUND)
list(APPEND _GPUARRAY_SRC gpuarray_blas_opencl_clblas.c)
add_definitions(-DWITH_OPENCL_CLBLAS)
include_directories(${CLBLAS_INCLUDE_DIRS})
elseif(CLBLAS_FOUND)
message(STATUS "Building with CLBLAST")
list(APPEND _GPUARRAY_SRC gpuarray_blas_opencl_clblast.c)
add_definitions(-DWITH_OPENCL_CLBLAST)
include_directories(${CLBLAST_INCLUDE_DIRS})
endif()
endif()

Expand Down
Loading

0 comments on commit 8694101

Please sign in to comment.