clMathLibraries / clBLAS

a software library containing BLAS functions written in OpenCL
Apache License 2.0
843 stars 237 forks source link

Segmentation fault of sample code in readme.md on mac #34

Closed ghost closed 10 years ago

ghost commented 10 years ago

When I try to run the sample code in readme.md on my mac, it gives segmentation fault, which is for the function clblasSgemm.

kknox commented 10 years ago

Hi @yjuboiler I have a ~2011 macbook pro (with a discrete Radeon HD 6750M), and Mavericks installed. I compiled the library from source, and then linked the example code to the dylib. It runs to completion for me.

We may need more information about your setup. Do you have a GPU device?

kknox commented 10 years ago

I'm going to close this issue soon due to inactivity.

jhjin commented 10 years ago

Hi @kknox I have the same issue here. clblasSgemm gives segmentation fault on 2013 mac pro with Yosemite + Intel Iris. I modified the code in the readme and checked that it actually found GPU device info. Could you help me figure out this issue?

This is what I printed out in the sample code

char buffer[30];
cl_bool param;
clGetDeviceInfo(device, CL_DEVICE_NAME, sizeof(buffer), buffer, NULL);
printf("device: %s\n", buffer);
clGetDeviceInfo(device, CL_DEVICE_VERSION, sizeof(buffer), buffer, NULL);
printf("device_version: %s\n", buffer);
clGetDeviceInfo(device, CL_DEVICE_COMPILER_AVAILABLE, sizeof(param), &param, NULL);
printf("device_compiler_available: %u\n", param);
clGetDeviceInfo(device, CL_DRIVER_VERSION, sizeof(buffer), buffer, NULL);
printf("driver_version: %s\n", buffer);

gives

device: Iris
device_version: OpenCL 1.2 
device_compiler_available: 1
driver_version: 1.2(Sep 25 2014 22:25:51)

and clblasSetup() does not complain anything. I attached cmake log since I am not sure if I did correctly.. (I only built runtime library though)

-- The C compiler identification is GNU 4.9.1
-- The CXX compiler identification is GNU 4.9.1
-- Checking whether C compiler has -isysroot
-- Checking whether C compiler has -isysroot - yes
-- Checking whether C compiler supports OSX deployment target flag
-- Checking whether C compiler supports OSX deployment target flag - yes
-- Check for working C compiler: /usr/local/bin/gcc-4.9
-- Check for working C compiler: /usr/local/bin/gcc-4.9 -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Checking whether CXX compiler has -isysroot
-- Checking whether CXX compiler has -isysroot - yes
-- Checking whether CXX compiler supports OSX deployment target flag
-- Checking whether CXX compiler supports OSX deployment target flag - yes
-- Check for working CXX compiler: /usr/local/bin/g++-4.9
-- Check for working CXX compiler: /usr/local/bin/g++-4.9 -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Target platform: 64-bit
-- Found OPENCL: /System/Library/Frameworks/OpenCL.framework  
-- Could NOT find GTest (missing:  GTEST_INCLUDE_DIR) 
-- [ /usr/local/Cellar/cmake/3.0.2/share/cmake/Modules/FindBoost.cmake:513 ] _boost_TEST_VERSIONS = 1.44.0;1.44;1.47.0;1.47;1.56.0;1.56;1.55.0;1.55;1.54.0;1.54;1.53.0;1.53;1.52.0;1.52;1.51.0;1.51;1.50.0;1.50;1.49.0;1.49;1.48.0;1.48;1.47.0
;1.47;1.46.1;1.46.0;1.46;1.45.0;1.45;1.44.0;1.44;1.43.0;1.43;1.42.0;1.42;1.41.0;1.41;1.40.0;1.40;1.39.0;1.39;1.38.0;1.38;1.37.0;1.37;1.36.1;1.36.0;1.36;1.35.1;1.35.0;1.35;1.34.1;1.34.0;1.34;1.33.1;1.33.0;1.33
-- [ /usr/local/Cellar/cmake/3.0.2/share/cmake/Modules/FindBoost.cmake:515 ] Boost_USE_MULTITHREADED = ON
-- [ /usr/local/Cellar/cmake/3.0.2/share/cmake/Modules/FindBoost.cmake:517 ] Boost_USE_STATIC_LIBS = ON
-- [ /usr/local/Cellar/cmake/3.0.2/share/cmake/Modules/FindBoost.cmake:519 ] Boost_USE_STATIC_RUNTIME = 
-- [ /usr/local/Cellar/cmake/3.0.2/share/cmake/Modules/FindBoost.cmake:521 ] Boost_ADDITIONAL_VERSIONS = 1.44.0;1.44;1.47.0;1.47
-- [ /usr/local/Cellar/cmake/3.0.2/share/cmake/Modules/FindBoost.cmake:523 ] Boost_NO_SYSTEM_PATHS = 
-- [ /usr/local/Cellar/cmake/3.0.2/share/cmake/Modules/FindBoost.cmake:575 ] Declared as CMake or Environmental Variables:
-- [ /usr/local/Cellar/cmake/3.0.2/share/cmake/Modules/FindBoost.cmake:577 ]   BOOST_ROOT = /usr/local/Cellar/boost/1.56.0
-- [ /usr/local/Cellar/cmake/3.0.2/share/cmake/Modules/FindBoost.cmake:579 ]   BOOST_INCLUDEDIR = /usr/local/Cellar/boost/1.56.0/include
-- [ /usr/local/Cellar/cmake/3.0.2/share/cmake/Modules/FindBoost.cmake:581 ]   BOOST_LIBRARYDIR = /usr/local/Cellar/boost/1.56.0/lib
-- [ /usr/local/Cellar/cmake/3.0.2/share/cmake/Modules/FindBoost.cmake:583 ] _boost_TEST_VERSIONS = 1.44.0;1.44;1.47.0;1.47;1.56.0;1.56;1.55.0;1.55;1.54.0;1.54;1.53.0;1.53;1.52.0;1.52;1.51.0;1.51;1.50.0;1.50;1.49.0;1.49;1.48.0;1.48;1.47.0
;1.47;1.46.1;1.46.0;1.46;1.45.0;1.45;1.44.0;1.44;1.43.0;1.43;1.42.0;1.42;1.41.0;1.41;1.40.0;1.40;1.39.0;1.39;1.38.0;1.38;1.37.0;1.37;1.36.1;1.36.0;1.36;1.35.1;1.35.0;1.35;1.34.1;1.34.0;1.34;1.33.1;1.33.0;1.33
-- [ /usr/local/Cellar/cmake/3.0.2/share/cmake/Modules/FindBoost.cmake:652 ] Include debugging info:
-- [ /usr/local/Cellar/cmake/3.0.2/share/cmake/Modules/FindBoost.cmake:654 ]   _boost_INCLUDE_SEARCH_DIRS = /usr/local/Cellar/boost/1.56.0/include;/usr/local/Cellar/boost/1.56.0/include;/usr/local/Cellar/boost/1.56.0;PATHS;C:/boost/includ
e;C:/boost;/sw/local/include
-- [ /usr/local/Cellar/cmake/3.0.2/share/cmake/Modules/FindBoost.cmake:656 ]   _boost_PATH_SUFFIXES = boost-1_44_0;boost_1_44_0;boost/boost-1_44_0;boost/boost_1_44_0;boost-1_44;boost_1_44;boost/boost-1_44;boost/boost_1_44;boost-1_47_0;boo
st_1_47_0;boost/boost-1_47_0;boost/boost_1_47_0;boost-1_47;boost_1_47;boost/boost-1_47;boost/boost_1_47;boost-1_56_0;boost_1_56_0;boost/boost-1_56_0;boost/boost_1_56_0;boost-1_56;boost_1_56;boost/boost-1_56;boost/boost_1_56;boost-1_55_0;b
oost_1_55_0;boost/boost-1_55_0;boost/boost_1_55_0;boost-1_55;boost_1_55;boost/boost-1_55;boost/boost_1_55;boost-1_54_0;boost_1_54_0;boost/boost-1_54_0;boost/boost_1_54_0;boost-1_54;boost_1_54;boost/boost-1_54;boost/boost_1_54;boost-1_53_0
;boost_1_53_0;boost/boost-1_53_0;boost/boost_1_53_0;boost-1_53;boost_1_53;boost/boost-1_53;boost/boost_1_53;boost-1_52_0;boost_1_52_0;boost/boost-1_52_0;boost/boost_1_52_0;boost-1_52;boost_1_52;boost/boost-1_52;boost/boost_1_52;boost-1_51
_0;boost_1_51_0;boost/boost-1_51_0;boost/boost_1_51_0;boost-1_51;boost_1_51;boost/boost-1_51;boost/boost_1_51;boost-1_50_0;boost_1_50_0;boost/boost-1_50_0;boost/boost_1_50_0;boost-1_50;boost_1_50;boost/boost-1_50;boost/boost_1_50;boost-1_
49_0;boost_1_49_0;boost/boost-1_49_0;boost/boost_1_49_0;boost-1_49;boost_1_49;boost/boost-1_49;boost/boost_1_49;boost-1_48_0;boost_1_48_0;boost/boost-1_48_0;boost/boost_1_48_0;boost-1_48;boost_1_48;boost/boost-1_48;boost/boost_1_48;boost-
1_47_0;boost_1_47_0;boost/boost-1_47_0;boost/boost_1_47_0;boost-1_47;boost_1_47;boost/boost-1_47;boost/boost_1_47;boost-1_46_1;boost_1_46_1;boost/boost-1_46_1;boost/boost_1_46_1;boost-1_46_0;boost_1_46_0;boost/boost-1_46_0;boost/boost_1_4
6_0;boost-1_46;boost_1_46;boost/boost-1_46;boost/boost_1_46;boost-1_45_0;boost_1_45_0;boost/boost-1_45_0;boost/boost_1_45_0;boost-1_45;boost_1_45;boost/boost-1_45;boost/boost_1_45;boost-1_44_0;boost_1_44_0;boost/boost-1_44_0;boost/boost_1
_44_0;boost-1_44;boost_1_44;boost/boost-1_44;boost/boost_1_44;boost-1_43_0;boost_1_43_0;boost/boost-1_43_0;boost/boost_1_43_0;boost-1_43;boost_1_43;boost/boost-1_43;boost/boost_1_43;boost-1_42_0;boost_1_42_0;boost/boost-1_42_0;boost/boost
_1_42_0;boost-1_42;boost_1_42;boost/boost-1_42;boost/boost_1_42;boost-1_41_0;boost_1_41_0;boost/boost-1_41_0;boost/boost_1_41_0;boost-1_41;boost_1_41;boost/boost-1_41;boost/boost_1_41;boost-1_40_0;boost_1_40_0;boost/boost-1_40_0;boost/boo
st_1_40_0;boost-1_40;boost_1_40;boost/boost-1_40;boost/boost_1_40;boost-1_39_0;boost_1_39_0;boost/boost-1_39_0;boost/boost_1_39_0;boost-1_39;boost_1_39;boost/boost-1_39;boost/boost_1_39;boost-1_38_0;boost_1_38_0;boost/boost-1_38_0;boost/b
oost_1_38_0;boost-1_38;boost_1_38;boost/boost-1_38;boost/boost_1_38;boost-1_37_0;boost_1_37_0;boost/boost-1_37_0;boost/boost_1_37_0;boost-1_37;boost_1_37;boost/boost-1_37;boost/boost_1_37;boost-1_36_1;boost_1_36_1;boost/boost-1_36_1;boost
/boost_1_36_1;boost-1_36_0;boost_1_36_0;boost/boost-1_36_0;boost/boost_1_36_0;boost-1_36;boost_1_36;boost/boost-1_36;boost/boost_1_36;boost-1_35_1;boost_1_35_1;boost/boost-1_35_1;boost/boost_1_35_1;boost-1_35_0;boost_1_35_0;boost/boost-1_
35_0;boost/boost_1_35_0;boost-1_35;boost_1_35;boost/boost-1_35;boost/boost_1_35;boost-1_34_1;boost_1_34_1;boost/boost-1_34_1;boost/boost_1_34_1;boost-1_34_0;boost_1_34_0;boost/boost-1_34_0;boost/boost_1_34_0;boost-1_34;boost_1_34;boost/bo
ost-1_34;boost/boost_1_34;boost-1_33_1;boost_1_33_1;boost/boost-1_33_1;boost/boost_1_33_1;boost-1_33_0;boost_1_33_0;boost/boost-1_33_0;boost/boost_1_33_0;boost-1_33;boost_1_33;boost/boost-1_33;boost/boost_1_33
-- [ /usr/local/Cellar/cmake/3.0.2/share/cmake/Modules/FindBoost.cmake:676 ] location of version.hpp: /usr/local/Cellar/boost/1.56.0/include/boost/version.hpp
-- [ /usr/local/Cellar/cmake/3.0.2/share/cmake/Modules/FindBoost.cmake:700 ] version.hpp reveals boost 1.56.0
-- [ /usr/local/Cellar/cmake/3.0.2/share/cmake/Modules/FindBoost.cmake:785 ] guessed _boost_COMPILER = -xgcc49
-- [ /usr/local/Cellar/cmake/3.0.2/share/cmake/Modules/FindBoost.cmake:795 ] _boost_MULTITHREADED = -mt
-- [ /usr/local/Cellar/cmake/3.0.2/share/cmake/Modules/FindBoost.cmake:838 ] _boost_RELEASE_ABI_TAG = -
-- [ /usr/local/Cellar/cmake/3.0.2/share/cmake/Modules/FindBoost.cmake:840 ] _boost_DEBUG_ABI_TAG = -d
-- [ /usr/local/Cellar/cmake/3.0.2/share/cmake/Modules/FindBoost.cmake:888 ] _boost_LIBRARY_SEARCH_DIRS = /usr/local/Cellar/boost/1.56.0/lib;/usr/local/Cellar/boost/1.56.0/lib;/usr/local/Cellar/boost/1.56.0/stage/lib;/usr/local/Cellar/boo
st/1.56.0/include/lib;/usr/local/Cellar/boost/1.56.0/include/../lib;/usr/local/Cellar/boost/1.56.0/include/stage/lib;PATHS;C:/boost/lib;C:/boost;/sw/local/lib
-- [ /usr/local/Cellar/cmake/3.0.2/share/cmake/Modules/FindBoost.cmake:998 ] Searching for PROGRAM_OPTIONS_LIBRARY_RELEASE: boost_program_options-xgcc49-mt-1_56;boost_program_options-xgcc49-mt;boost_program_options-mt-1_56;boost_program_o
ptions-mt;boost_program_options
-- [ /usr/local/Cellar/cmake/3.0.2/share/cmake/Modules/FindBoost.cmake:1034 ] Searching for PROGRAM_OPTIONS_LIBRARY_DEBUG: boost_program_options-xgcc49-mt-d-1_56;boost_program_options-xgcc49-mt-d;boost_program_options-mt-d-1_56;boost_prog
ram_options-mt-d;boost_program_options-mt;boost_program_options
-- [ /usr/local/Cellar/cmake/3.0.2/share/cmake/Modules/FindBoost.cmake:1085 ] Boost_FOUND = 1
-- Boost version: 1.56.0
-- Found the following Boost libraries:
--   program_options
-- Boost_PROGRAM_OPTIONS_LIBRARY: /usr/local/Cellar/boost/1.56.0/lib/libboost_program_options-mt.a
-- Configuring done
CMake Warning (dev):
  Policy CMP0042 is not set: MACOSX_RPATH is enabled by default.  Run "cmake
  --help-policy CMP0042" for policy details.  Use the cmake_policy command to
  set the policy and suppress this warning.

  MACOSX_RPATH is not specified for the following targets:

   clBLAS

This warning is for project developers.  Use -Wno-dev to suppress it.

-- Generating done

In the meanwhile, I ran sgemm.c sample code with double precision (and also with clblasDgemm function), then I got the CL_INVALID_DEVICE error:

gcc -Wall -g main.c -o main -I./include -L./lib64 -lclBLAS  -framework OpenCL
clblasDgemmEx() failed with -33