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

Problems in Mac OS X #13

Open
amherag opened this issue Mar 1, 2018 · 20 comments
Open

Problems in Mac OS X #13

amherag opened this issue Mar 1, 2018 · 20 comments

Comments

@amherag
Copy link

amherag commented Mar 1, 2018

Hello!

Hopefully it's just a dumb error on my part.

I cloned CLBlast, JOCLCommon and JOCLBlast inside an empty directory:

git clone https://github.com/CNugteren/CLBlast.git
git clone https://github.com/gpu/JOCLCommon.git
git clone https://github.com/gpu/JOCLBlast.git

I go to CLBlast, I create a build directory and cd to it, then I cmake .., make and finally sudo make install without any problem.

Then I go to the JOCLBlast directory and I create a nativeLibraries/apple/x86_64 directory. I copy the libclblast.dylib library from CLBlast/build/ to this directory.

Then I run these commands, which I've been using for the past builds:

cmake -DCLBlast_LIBRARY:FILEPATH=/usr/local/lib/libclblast.dylib -DCLBLAST_INSTALL_DIR:FILEPATH=/usr/local/lib/
cmake --build .
mvn clean install

And, finally, I get these errors after running cmake --build .:

[ 75%] Built target JOCLCommon
[ 87%] Building CXX object CMakeFiles/JOCLBlast_1_3_0-apple-x86_64.dir/src/main/native/JOCLBlast.cpp.o
In file included from /Users/Amherag/jocl/JOCLBlast/src/main/native/JOCLBlast.cpp:37:
In file included from /Users/Amherag/jocl/JOCLCommon/src/main/native/JOCLCommon.hpp:42:
In file included from /Users/Amherag/jocl/JOCLCommon/src/main/include/CL/opencl.h:41:
/Users/Amherag/jocl/JOCLCommon/src/main/include/CL/cl_ext.h:150:95: warning: 'weak_import'
      attribute only applies to variables and functions [-Wignored-attributes]
  ...cl_int (CL_API_CALL *clTerminateContextKHR_fn)(cl_context /* context */) CL_EXT_SUFFIX__VER...
                                                                              ^
/Users/Amherag/jocl/JOCLCommon/src/main/include/CL/cl_platform.h:73:57: note: expanded from macro
      'CL_EXT_SUFFIX__VERSION_1_2'
        #define CL_EXT_SUFFIX__VERSION_1_2              CL_EXTENSION_WEAK_LINK AVAILABLE_MA...
                                                        ^
/Users/Amherag/jocl/JOCLCommon/src/main/include/CL/cl_platform.h:62:57: note: expanded from macro
      'CL_EXTENSION_WEAK_LINK'
    #define CL_EXTENSION_WEAK_LINK       __attribute__((weak_import))
                                                        ^
In file included from /Users/Amherag/jocl/JOCLBlast/src/main/native/JOCLBlast.cpp:37:
In file included from /Users/Amherag/jocl/JOCLCommon/src/main/native/JOCLCommon.hpp:42:
In file included from /Users/Amherag/jocl/JOCLCommon/src/main/include/CL/opencl.h:41:
/Users/Amherag/jocl/JOCLCommon/src/main/include/CL/cl_ext.h:197:69: warning: 'weak_import'
      attribute only applies to variables and functions [-Wignored-attributes]
    (CL_API_CALL *clReleaseDeviceEXT_fn)( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1;
                                                                    ^
/Users/Amherag/jocl/JOCLCommon/src/main/include/CL/cl_platform.h:67:57: note: expanded from macro
      'CL_EXT_SUFFIX__VERSION_1_1'
    #define CL_EXT_SUFFIX__VERSION_1_1                  CL_EXTENSION_WEAK_LINK AVAILABLE_MA...
                                                        ^
/Users/Amherag/jocl/JOCLCommon/src/main/include/CL/cl_platform.h:62:57: note: expanded from macro
      'CL_EXTENSION_WEAK_LINK'
    #define CL_EXTENSION_WEAK_LINK       __attribute__((weak_import))
                                                        ^
In file included from /Users/Amherag/jocl/JOCLBlast/src/main/native/JOCLBlast.cpp:37:
In file included from /Users/Amherag/jocl/JOCLCommon/src/main/native/JOCLCommon.hpp:42:
In file included from /Users/Amherag/jocl/JOCLCommon/src/main/include/CL/opencl.h:41:
/Users/Amherag/jocl/JOCLCommon/src/main/include/CL/cl_ext.h:203:68: warning: 'weak_import'
      attribute only applies to variables and functions [-Wignored-attributes]
    (CL_API_CALL *clRetainDeviceEXT_fn)( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1;
                                                                   ^
/Users/Amherag/jocl/JOCLCommon/src/main/include/CL/cl_platform.h:67:57: note: expanded from macro
      'CL_EXT_SUFFIX__VERSION_1_1'
    #define CL_EXT_SUFFIX__VERSION_1_1                  CL_EXTENSION_WEAK_LINK AVAILABLE_MA...
                                                        ^
/Users/Amherag/jocl/JOCLCommon/src/main/include/CL/cl_platform.h:62:57: note: expanded from macro
      'CL_EXTENSION_WEAK_LINK'
    #define CL_EXTENSION_WEAK_LINK       __attribute__((weak_import))
                                                        ^
In file included from /Users/Amherag/jocl/JOCLBlast/src/main/native/JOCLBlast.cpp:37:
In file included from /Users/Amherag/jocl/JOCLCommon/src/main/native/JOCLCommon.hpp:42:
In file included from /Users/Amherag/jocl/JOCLCommon/src/main/include/CL/opencl.h:41:
/Users/Amherag/jocl/JOCLCommon/src/main/include/CL/cl_ext.h:218:77: warning: 'weak_import'
      attribute only applies to variables and functions [-Wignored-attributes]
                                                cl_uint * /*num_devices*/ ) CL_EXT_SUFFIX__...
                                                                            ^
/Users/Amherag/jocl/JOCLCommon/src/main/include/CL/cl_platform.h:67:57: note: expanded from macro
      'CL_EXT_SUFFIX__VERSION_1_1'
    #define CL_EXT_SUFFIX__VERSION_1_1                  CL_EXTENSION_WEAK_LINK AVAILABLE_MA...
                                                        ^
/Users/Amherag/jocl/JOCLCommon/src/main/include/CL/cl_platform.h:62:57: note: expanded from macro
      'CL_EXTENSION_WEAK_LINK'
    #define CL_EXTENSION_WEAK_LINK       __attribute__((weak_import))
                                                        ^
In file included from /Users/Amherag/jocl/JOCLBlast/src/main/native/JOCLBlast.cpp:37:
In file included from /Users/Amherag/jocl/JOCLCommon/src/main/native/JOCLCommon.hpp:42:
In file included from /Users/Amherag/jocl/JOCLCommon/src/main/include/CL/opencl.h:41:
/Users/Amherag/jocl/JOCLCommon/src/main/include/CL/cl_ext.h:342:48: warning: 'weak_import'
      attribute only applies to variables and functions [-Wignored-attributes]
  ...size_t* /*param_value_size_ret*/ ) CL_EXT_SUFFIX__VERSION_2_0;
                                        ^
/Users/Amherag/jocl/JOCLCommon/src/main/include/CL/cl_platform.h:84:57: note: expanded from macro
      'CL_EXT_SUFFIX__VERSION_2_0'
        #define CL_EXT_SUFFIX__VERSION_2_0              CL_EXTENSION_WEAK_LINK AVAILABLE_MA...
                                                        ^
/Users/Amherag/jocl/JOCLCommon/src/main/include/CL/cl_platform.h:62:57: note: expanded from macro
      'CL_EXTENSION_WEAK_LINK'
    #define CL_EXTENSION_WEAK_LINK       __attribute__((weak_import))
                                                        ^
/Users/Amherag/jocl/JOCLBlast/src/main/native/JOCLBlast.cpp:42:10: fatal error: 'clblast_c.h' file
      not found
#include <clblast_c.h>
         ^~~~~~~~~~~~~
5 warnings and 1 error generated.
make[2]: *** [CMakeFiles/JOCLBlast_1_3_0-apple-x86_64.dir/src/main/native/JOCLBlast.cpp.o] Error 1
make[1]: *** [CMakeFiles/JOCLBlast_1_3_0-apple-x86_64.dir/all] Error 2
make: *** [all] Error 2
Skynet-2:JOCLBlast Amherag$ cmake --build . > error.log
In file included from /Users/Amherag/jocl/JOCLBlast/src/main/native/JOCLBlast.cpp:37:
In file included from /Users/Amherag/jocl/JOCLCommon/src/main/native/JOCLCommon.hpp:42:
In file included from /Users/Amherag/jocl/JOCLCommon/src/main/include/CL/opencl.h:41:
/Users/Amherag/jocl/JOCLCommon/src/main/include/CL/cl_ext.h:150:95: warning: 'weak_import'
      attribute only applies to variables and functions [-Wignored-attributes]
  ...cl_int (CL_API_CALL *clTerminateContextKHR_fn)(cl_context /* context */) CL_EXT_SUFFIX__VER...
                                                                              ^
/Users/Amherag/jocl/JOCLCommon/src/main/include/CL/cl_platform.h:73:57: note: expanded from macro
      'CL_EXT_SUFFIX__VERSION_1_2'
        #define CL_EXT_SUFFIX__VERSION_1_2              CL_EXTENSION_WEAK_LINK AVAILABLE_MA...
                                                        ^
/Users/Amherag/jocl/JOCLCommon/src/main/include/CL/cl_platform.h:62:57: note: expanded from macro
      'CL_EXTENSION_WEAK_LINK'
    #define CL_EXTENSION_WEAK_LINK       __attribute__((weak_import))
                                                        ^
In file included from /Users/Amherag/jocl/JOCLBlast/src/main/native/JOCLBlast.cpp:37:
In file included from /Users/Amherag/jocl/JOCLCommon/src/main/native/JOCLCommon.hpp:42:
In file included from /Users/Amherag/jocl/JOCLCommon/src/main/include/CL/opencl.h:41:
/Users/Amherag/jocl/JOCLCommon/src/main/include/CL/cl_ext.h:197:69: warning: 'weak_import'
      attribute only applies to variables and functions [-Wignored-attributes]
    (CL_API_CALL *clReleaseDeviceEXT_fn)( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1;
                                                                    ^
/Users/Amherag/jocl/JOCLCommon/src/main/include/CL/cl_platform.h:67:57: note: expanded from macro
      'CL_EXT_SUFFIX__VERSION_1_1'
    #define CL_EXT_SUFFIX__VERSION_1_1                  CL_EXTENSION_WEAK_LINK AVAILABLE_MA...
                                                        ^
/Users/Amherag/jocl/JOCLCommon/src/main/include/CL/cl_platform.h:62:57: note: expanded from macro
      'CL_EXTENSION_WEAK_LINK'
    #define CL_EXTENSION_WEAK_LINK       __attribute__((weak_import))
                                                        ^
In file included from /Users/Amherag/jocl/JOCLBlast/src/main/native/JOCLBlast.cpp:37:
In file included from /Users/Amherag/jocl/JOCLCommon/src/main/native/JOCLCommon.hpp:42:
In file included from /Users/Amherag/jocl/JOCLCommon/src/main/include/CL/opencl.h:41:
/Users/Amherag/jocl/JOCLCommon/src/main/include/CL/cl_ext.h:203:68: warning: 'weak_import'
      attribute only applies to variables and functions [-Wignored-attributes]
    (CL_API_CALL *clRetainDeviceEXT_fn)( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1;
                                                                   ^
/Users/Amherag/jocl/JOCLCommon/src/main/include/CL/cl_platform.h:67:57: note: expanded from macro
      'CL_EXT_SUFFIX__VERSION_1_1'
    #define CL_EXT_SUFFIX__VERSION_1_1                  CL_EXTENSION_WEAK_LINK AVAILABLE_MA...
                                                        ^
/Users/Amherag/jocl/JOCLCommon/src/main/include/CL/cl_platform.h:62:57: note: expanded from macro
      'CL_EXTENSION_WEAK_LINK'
    #define CL_EXTENSION_WEAK_LINK       __attribute__((weak_import))
                                                        ^
In file included from /Users/Amherag/jocl/JOCLBlast/src/main/native/JOCLBlast.cpp:37:
In file included from /Users/Amherag/jocl/JOCLCommon/src/main/native/JOCLCommon.hpp:42:
In file included from /Users/Amherag/jocl/JOCLCommon/src/main/include/CL/opencl.h:41:
/Users/Amherag/jocl/JOCLCommon/src/main/include/CL/cl_ext.h:218:77: warning: 'weak_import'
      attribute only applies to variables and functions [-Wignored-attributes]
                                                cl_uint * /*num_devices*/ ) CL_EXT_SUFFIX__...
                                                                            ^
/Users/Amherag/jocl/JOCLCommon/src/main/include/CL/cl_platform.h:67:57: note: expanded from macro
      'CL_EXT_SUFFIX__VERSION_1_1'
    #define CL_EXT_SUFFIX__VERSION_1_1                  CL_EXTENSION_WEAK_LINK AVAILABLE_MA...
                                                        ^
/Users/Amherag/jocl/JOCLCommon/src/main/include/CL/cl_platform.h:62:57: note: expanded from macro
      'CL_EXTENSION_WEAK_LINK'
    #define CL_EXTENSION_WEAK_LINK       __attribute__((weak_import))
                                                        ^
In file included from /Users/Amherag/jocl/JOCLBlast/src/main/native/JOCLBlast.cpp:37:
In file included from /Users/Amherag/jocl/JOCLCommon/src/main/native/JOCLCommon.hpp:42:
In file included from /Users/Amherag/jocl/JOCLCommon/src/main/include/CL/opencl.h:41:
/Users/Amherag/jocl/JOCLCommon/src/main/include/CL/cl_ext.h:342:48: warning: 'weak_import'
      attribute only applies to variables and functions [-Wignored-attributes]
  ...size_t* /*param_value_size_ret*/ ) CL_EXT_SUFFIX__VERSION_2_0;
                                        ^
/Users/Amherag/jocl/JOCLCommon/src/main/include/CL/cl_platform.h:84:57: note: expanded from macro
      'CL_EXT_SUFFIX__VERSION_2_0'
        #define CL_EXT_SUFFIX__VERSION_2_0              CL_EXTENSION_WEAK_LINK AVAILABLE_MA...
                                                        ^
/Users/Amherag/jocl/JOCLCommon/src/main/include/CL/cl_platform.h:62:57: note: expanded from macro
      'CL_EXTENSION_WEAK_LINK'
    #define CL_EXTENSION_WEAK_LINK       __attribute__((weak_import))
                                                        ^
/Users/Amherag/jocl/JOCLBlast/src/main/native/JOCLBlast.cpp:42:10: fatal error: 'clblast_c.h' file
      not found
#include <clblast_c.h>
         ^~~~~~~~~~~~~
5 warnings and 1 error generated.
make[2]: *** [CMakeFiles/JOCLBlast_1_3_0-apple-x86_64.dir/src/main/native/JOCLBlast.cpp.o] Error 1
make[1]: *** [CMakeFiles/JOCLBlast_1_3_0-apple-x86_64.dir/all] Error 2
make: *** [all] Error 2
Skynet-2:JOCLBlast Amherag$
Skynet-2:JOCLBlast Amherag$
Skynet-2:JOCLBlast Amherag$ ls
CMakeCache.txt		LICENSE			error.log		target
CMakeFiles		Makefile		nativeLibraries
CMakeLists.txt		README.md		pom.xml
JOCLCommon		cmake_install.cmake	src
Skynet-2:JOCLBlast Amherag$ cmake --build . > error.log
In file included from /Users/Amherag/jocl/JOCLBlast/src/main/native/JOCLBlast.cpp:37:
In file included from /Users/Amherag/jocl/JOCLCommon/src/main/native/JOCLCommon.hpp:42:
In file included from /Users/Amherag/jocl/JOCLCommon/src/main/include/CL/opencl.h:41:
/Users/Amherag/jocl/JOCLCommon/src/main/include/CL/cl_ext.h:150:95: warning: 'weak_import'
      attribute only applies to variables and functions [-Wignored-attributes]
  ...cl_int (CL_API_CALL *clTerminateContextKHR_fn)(cl_context /* context */) CL_EXT_SUFFIX__VER...
                                                                              ^
/Users/Amherag/jocl/JOCLCommon/src/main/include/CL/cl_platform.h:73:57: note: expanded from macro
      'CL_EXT_SUFFIX__VERSION_1_2'
        #define CL_EXT_SUFFIX__VERSION_1_2              CL_EXTENSION_WEAK_LINK AVAILABLE_MA...
                                                        ^
/Users/Amherag/jocl/JOCLCommon/src/main/include/CL/cl_platform.h:62:57: note: expanded from macro
      'CL_EXTENSION_WEAK_LINK'
    #define CL_EXTENSION_WEAK_LINK       __attribute__((weak_import))
                                                        ^
In file included from /Users/Amherag/jocl/JOCLBlast/src/main/native/JOCLBlast.cpp:37:
In file included from /Users/Amherag/jocl/JOCLCommon/src/main/native/JOCLCommon.hpp:42:
In file included from /Users/Amherag/jocl/JOCLCommon/src/main/include/CL/opencl.h:41:
/Users/Amherag/jocl/JOCLCommon/src/main/include/CL/cl_ext.h:197:69: warning: 'weak_import'
      attribute only applies to variables and functions [-Wignored-attributes]
    (CL_API_CALL *clReleaseDeviceEXT_fn)( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1;
                                                                    ^
/Users/Amherag/jocl/JOCLCommon/src/main/include/CL/cl_platform.h:67:57: note: expanded from macro
      'CL_EXT_SUFFIX__VERSION_1_1'
    #define CL_EXT_SUFFIX__VERSION_1_1                  CL_EXTENSION_WEAK_LINK AVAILABLE_MA...
                                                        ^
/Users/Amherag/jocl/JOCLCommon/src/main/include/CL/cl_platform.h:62:57: note: expanded from macro
      'CL_EXTENSION_WEAK_LINK'
    #define CL_EXTENSION_WEAK_LINK       __attribute__((weak_import))
                                                        ^
In file included from /Users/Amherag/jocl/JOCLBlast/src/main/native/JOCLBlast.cpp:37:
In file included from /Users/Amherag/jocl/JOCLCommon/src/main/native/JOCLCommon.hpp:42:
In file included from /Users/Amherag/jocl/JOCLCommon/src/main/include/CL/opencl.h:41:
/Users/Amherag/jocl/JOCLCommon/src/main/include/CL/cl_ext.h:203:68: warning: 'weak_import'
      attribute only applies to variables and functions [-Wignored-attributes]
    (CL_API_CALL *clRetainDeviceEXT_fn)( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1;
                                                                   ^
/Users/Amherag/jocl/JOCLCommon/src/main/include/CL/cl_platform.h:67:57: note: expanded from macro
      'CL_EXT_SUFFIX__VERSION_1_1'
    #define CL_EXT_SUFFIX__VERSION_1_1                  CL_EXTENSION_WEAK_LINK AVAILABLE_MA...
                                                        ^
/Users/Amherag/jocl/JOCLCommon/src/main/include/CL/cl_platform.h:62:57: note: expanded from macro
      'CL_EXTENSION_WEAK_LINK'
    #define CL_EXTENSION_WEAK_LINK       __attribute__((weak_import))
                                                        ^
In file included from /Users/Amherag/jocl/JOCLBlast/src/main/native/JOCLBlast.cpp:37:
In file included from /Users/Amherag/jocl/JOCLCommon/src/main/native/JOCLCommon.hpp:42:
In file included from /Users/Amherag/jocl/JOCLCommon/src/main/include/CL/opencl.h:41:
/Users/Amherag/jocl/JOCLCommon/src/main/include/CL/cl_ext.h:218:77: warning: 'weak_import'
      attribute only applies to variables and functions [-Wignored-attributes]
                                                cl_uint * /*num_devices*/ ) CL_EXT_SUFFIX__...
                                                                            ^
/Users/Amherag/jocl/JOCLCommon/src/main/include/CL/cl_platform.h:67:57: note: expanded from macro
      'CL_EXT_SUFFIX__VERSION_1_1'
    #define CL_EXT_SUFFIX__VERSION_1_1                  CL_EXTENSION_WEAK_LINK AVAILABLE_MA...
                                                        ^
/Users/Amherag/jocl/JOCLCommon/src/main/include/CL/cl_platform.h:62:57: note: expanded from macro
      'CL_EXTENSION_WEAK_LINK'
    #define CL_EXTENSION_WEAK_LINK       __attribute__((weak_import))
                                                        ^
In file included from /Users/Amherag/jocl/JOCLBlast/src/main/native/JOCLBlast.cpp:37:
In file included from /Users/Amherag/jocl/JOCLCommon/src/main/native/JOCLCommon.hpp:42:
In file included from /Users/Amherag/jocl/JOCLCommon/src/main/include/CL/opencl.h:41:
/Users/Amherag/jocl/JOCLCommon/src/main/include/CL/cl_ext.h:342:48: warning: 'weak_import'
      attribute only applies to variables and functions [-Wignored-attributes]
  ...size_t* /*param_value_size_ret*/ ) CL_EXT_SUFFIX__VERSION_2_0;
                                        ^
/Users/Amherag/jocl/JOCLCommon/src/main/include/CL/cl_platform.h:84:57: note: expanded from macro
      'CL_EXT_SUFFIX__VERSION_2_0'
        #define CL_EXT_SUFFIX__VERSION_2_0              CL_EXTENSION_WEAK_LINK AVAILABLE_MA...
                                                        ^
/Users/Amherag/jocl/JOCLCommon/src/main/include/CL/cl_platform.h:62:57: note: expanded from macro
      'CL_EXTENSION_WEAK_LINK'
    #define CL_EXTENSION_WEAK_LINK       __attribute__((weak_import))
                                                        ^
/Users/Amherag/jocl/JOCLBlast/src/main/native/JOCLBlast.cpp:42:10: fatal error: 'clblast_c.h' file
      not found
#include <clblast_c.h>
         ^~~~~~~~~~~~~
5 warnings and 1 error generated.
make[2]: *** [CMakeFiles/JOCLBlast_1_3_0-apple-x86_64.dir/src/main/native/JOCLBlast.cpp.o] Error 1
make[1]: *** [CMakeFiles/JOCLBlast_1_3_0-apple-x86_64.dir/all] Error 2
make: *** [all] Error 2
@blueberry
Copy link

blueberry commented Mar 1, 2018

FWIW, on linux I run cmake-gui, and after it is done, I just call make (NOT Cmake) to build the native library, before continuing with mvn clean install.

@gpu
Copy link
Owner

gpu commented Mar 4, 2018

From a quick look at the log messages, it seems like

fatal error: 'clblast_c.h' file not found

is the only real error. This may be just due to the -DCLBLAST_INSTALL_DIR:FILEPATH=/usr/local/lib/ part not being right. Maybe it's better to start cmake-gui. After using "Configure", it should spill out a message for the missing CLBLAST_INSTALL_DIR, but in the cmake-gui, you can directly select it via a file chooser - this may be less error prone.

@milikicn
Copy link

@gpu I'am sending you the compiled library for Mac OS X. I followed the instructions by @amherag but CLBlast was installed by homebrew, and console cmake worked for me.

jocl-blast-1.2.1-SNAPSHOT.zip

@blueberry blueberry mentioned this issue Mar 30, 2018
@gpu
Copy link
Owner

gpu commented Mar 30, 2018

Thanks @milikicn for your contribution. We'll track this further in #12

@milikicn
Copy link

milikicn commented May 8, 2018

@gpu Can you please check whether the archive I have previously provided is properly packaged? If I remove CLBlast binary from brew, I get the following error:

java.lang.UnsatisfiedLinkError: no JOCLBlast_1_3_0-apple-x86_64 in java.library.path

Probably I didn't build this properly, TBH I don't have much experience with it. Maybe after you prepare 1.3.1 I can try building it again for Mac OS X if you don't have means to build it for this OS.

@gpu
Copy link
Owner

gpu commented May 8, 2018

After having another look at the JAR, it seems like everything should be OK there.

Here's a package for a quick test, without any Maven/Brew/... or other build tool. It's just the current JARs and a small sample. (The runTest.bat just compiles and starts the sample, which can also be done manually at the command line)

JOCLBlastTest_2018-05-08.zip

Presumably, it will result in the same error, but I'll write a few more words about that at uncomplicate/neanderthal#44

@blueberry
Copy link

@gpu @milikicn However, the other user that first noticed this issue with 1.3.0 mentioned that 1.2.0 worked for him, so we can first try to isolate the problem to changes after 1.2.0 in CLBlas (or JOCLBlas).

@milikicn
Copy link

milikicn commented May 8, 2018

@blueberry You are right. If I use neanderthal v0.18.0 that is referencing JOCLBlast v1.2.0 I don't have this problem. I have previously deleted the jocl libraries from my maven repo so that the jars will be pulled in again.

@gpu
Copy link
Owner

gpu commented May 8, 2018

@milikicn Just to confirm: I assume that the same error appears when you try the test package that I uploaded, right? (I.e. it prints a looong stack trace that somewhere contains the "image not found" message)

A quick glance over the history of the CLBlast CMakeFile.txt did not reveal any obvious changes that might cause the trouble here (particularly, the changes in the commit at CNugteren/CLBlast@7a7873d , which seemed to resolve the issue last time, still seem to be there). We'll have to dig a bit deeper here...

@milikicn
Copy link

milikicn commented May 8, 2018

@gpu Yes, it yielded the same error:

Exception in thread "main" java.lang.UnsatisfiedLinkError: Error while loading native library "JOCLBlast_1_3_0-apple-x86_64"
Operating system name: Mac OS X
Architecture         : x86_64
Architecture bit size: 64
---(start of nested stack traces)---
Stack trace from the attempt to load the library as a file:
java.lang.UnsatisfiedLinkError: no JOCLBlast_1_3_0-apple-x86_64 in java.library.path
	at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1867)
	at java.lang.Runtime.loadLibrary0(Runtime.java:870)
	at java.lang.System.loadLibrary(System.java:1122)
	at org.jocl.LibUtils.loadLibrary(LibUtils.java:136)
	at org.jocl.blast.CLBlast.<clinit>(CLBlast.java:53)
	at JOCLBlastSample.main(JOCLBlastSample.java:26)
Stack trace from the attempt to load the library as a resource:
java.lang.UnsatisfiedLinkError: /private/var/folders/p5/fq4hp8m11js2p0cvkn0kpwgw0000gn/T/libJOCLBlast_1_3_0-apple-x86_64.dylib: dlopen(/private/var/folders/p5/fq4hp8m11js2p0cvkn0kpwgw0000gn/T/libJOCLBlast_1_3_0-apple-x86_64.dylib, 1): Library not loaded: /usr/local/opt/clblast/lib/libclblast.dylib
  Referenced from: /private/var/folders/p5/fq4hp8m11js2p0cvkn0kpwgw0000gn/T/libJOCLBlast_1_3_0-apple-x86_64.dylib
  Reason: image not found
	at java.lang.ClassLoader$NativeLibrary.load(Native Method)
	at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941)
	at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1824)
	at java.lang.Runtime.load0(Runtime.java:809)
	at java.lang.System.load(System.java:1086)
	at org.jocl.LibUtils.loadLibraryResource(LibUtils.java:269)
	at org.jocl.LibUtils.loadLibrary(LibUtils.java:151)
	at org.jocl.blast.CLBlast.<clinit>(CLBlast.java:53)
	at JOCLBlastSample.main(JOCLBlastSample.java:26)
---(end of nested stack traces)---
	at org.jocl.LibUtils.loadLibrary(LibUtils.java:185)
	at org.jocl.blast.CLBlast.<clinit>(CLBlast.java:53)
	at JOCLBlastSample.main(JOCLBlastSample.java:26)

If I run the same code with jocl-blast-1.2.0, the program finishes without any problems:

CL_DEVICE_NAME: Intel(R) Core(TM) i5-4278U CPU @ 2.60GHz
Event is cl_event[0x7fe8b4200ed0]
A:
 11.0  12.0  13.0  14.0  15.0 
 21.0  22.0  23.0  24.0  25.0 
 31.0  32.0  33.0  34.0  35.0 
 41.0  42.0  43.0  44.0  45.0 
B:
 11.0  12.0  13.0 
 21.0  22.0  23.0 
 31.0  32.0  33.0 
 41.0  42.0  43.0 
 51.0  52.0  53.0 
C:
 11.0  12.0  13.0 
 21.0  22.0  23.0 
 31.0  32.0  33.0 
 41.0  42.0  43.0 
Result of C = 10.0 * A * B + 20.0 * C:
21370.0 22040.0 22710.0 
37070.0 38240.0 39410.0 
52770.0 54440.0 56110.0 
68470.0 70640.0 72810.0 

@milikicn
Copy link

milikicn commented May 8, 2018

Again, I don't have anything in my brew repository (no packages at all). If I install clblast via brew, then your initial test (with version 1.3.0) will work for me.

@blueberry
Copy link

@gpu This hints to the source of the problem:

1): Library not loaded: /usr/local/opt/clblast/lib/libclblast.dylib Referenced from: /private/var/folders/p5/fq4hp8m11js2p0cvkn0kpwgw0000gn/T/libJOCLBlast_1_3_0-apple-x86_64.dylib 

Notice how libJOCLBlast is loaded from the temporary directory, while libclblast is looked for in /usr/local/opt/clblast/lib which I assume is the folder where brew installed it.

So, to find the solution we should find out why libclblast is not (attempted to be) loaded from the same temp folder libJOCLBlast is located.

@milikicn can you please uninstall the brew version, try to load the library via neanderthal, and, while the REPL's JVM is still on, look into the /private/var/folders/p5/fq4.........000gn folder and see whether libclblast is there?

@gpu
Copy link
Owner

gpu commented May 8, 2018

That may be the crucial hint, @blueberry : I didn't have the possible implications of brew/homebrew on the screen. But the symptoms now look as if (roughly!) the libJOCLBlast_1_3_0-apple-x86_64.dylib was somehow linked against the (locally installed) libclblast.dylib.

One might investigate the CMake settings for this, but it'll be hard to point at "THE" source for this behavior.

It may be worth mentioning that JOCLBlast will dedicatedly first load the libclblast.dylib from the temp-directory, and afterwards load the libJOCLBlast_1_3_0...dylib.

(The libclblast.dylib from the temp-directory and the one that is installed by homebrew should be the same, but maybe they are not identical for whatever reason. Additionally, MacOS might somehow mangle the installation path into the JOCLBlast library - I'll have to re-read what this RPATH thing actually did ... I only remember how relieved I was when the error suddenly disappeared back then...)

@blueberry
Copy link

@gpu It seems we've been bitten by #3 again :)

@gpu
Copy link
Owner

gpu commented May 8, 2018

Maybe I'll have to re-read this, but ... this doesn't seem to be related directly : The issue there was a missing library, but in the JAR that milikicn provided, the libclblast.dylib was contained (and it's also in the JOCLBlast JAR, so it should be unpacked into the temp directory and then loaded) ...

@blueberry
Copy link

I meant to point to your last comment in that thread.

@milikicn
Copy link

milikicn commented May 9, 2018

@blueberry I have removed all clblast and joclblast related files from my /private/var/folders/p5/.... temporary folder and ran the application. Two new files were added to the temp fodler: libJOCL_2_0_0-apple-x86_64.dylib, and libJOCLBlast_1_3_0-apple-x86_64.dylibm and also a folder JOCLBlast_1_3_0-apple-x86_64_dependents with the following folder structure:

- JOCLBlast_1_3_0-apple-x86_64_dependents
-- apple
--- x86_64
---- libclblast.dylib

@gpu
Copy link
Owner

gpu commented May 9, 2018

Maybe as a (small) debugging step: What does

otool -L  libJOCLBlast_1_3_0-apple-x86_64.dylib

print? (It should show the dependencies, ... but we actually went through this in the other issue, so it will not necessarily tell us how to fix it...)

@milikicn
Copy link

milikicn commented May 9, 2018

I am getting:

libJOCLBlast_1_3_0-apple-x86_64.dylib:
	/Users/nikola/Downloads/JOCL/JOCLBlast/nativeLibraries/libJOCLBlast_1_3_0-apple-x86_64.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/local/opt/clblast/lib/libclblast.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 400.9.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.0.0)

The strange thing is that it references a binary from my Downloads folder. But that folder has been deleted a couple of days ago.

@gpu
Copy link
Owner

gpu commented May 10, 2018

The oddest thing is that the library seems to refer to itself. I'll have to figure out more about this MacOS dependency and RPATH stuff. It might be that it somehow picked up the pre-installed libclblast.dylib as a dependency during the compilation, but that's only a wild guess. Unfortunately, I can't try things out without a MacOS machine. (E.g. I'd try out what happens when compiling the JOCLBlast lib without any pre-installed CLBlast lib). But I'll try to read more about the RPATH - maybe at least my guesses may become a bit more educated....

@milikicn milikicn mentioned this issue Aug 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants