Open amherag opened 6 years ago
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
.
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.
@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.
Thanks @milikicn for your contribution. We'll track this further in https://github.com/gpu/JOCLBlast/issues/12
@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.
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)
Presumably, it will result in the same error, but I'll write a few more words about that at https://github.com/uncomplicate/neanderthal/issues/44
@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).
@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.
@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 https://github.com/CNugteren/CLBlast/commit/7a7873d5527e7819249f80ba9abceb9d2d9c41cb , which seemed to resolve the issue last time, still seem to be there). We'll have to dig a bit deeper here...
@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
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.
@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?
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...)
@gpu It seems we've been bitten by #3 again :)
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) ...
I meant to point to your last comment in that thread.
@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-x8664.dylib, and _libJOCLBlast_1_3_0-apple-x8664.dylibm and also a folder _JOCLBlast_1_3_0-apple-x86_64dependents with the following folder structure:
- JOCLBlast_1_3_0-apple-x86_64_dependents
-- apple
--- x86_64
---- libclblast.dylib
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...)
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.
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....
Hello!
Hopefully it's just a dumb error on my part.
I cloned CLBlast, JOCLCommon and JOCLBlast inside an empty directory:
I go to CLBlast, I create a
build
directory andcd
to it, then Icmake ..
,make
and finallysudo make install
without any problem.Then I go to the JOCLBlast directory and I create a
nativeLibraries/apple/x86_64
directory. I copy thelibclblast.dylib
library fromCLBlast/build/
to this directory.Then I run these commands, which I've been using for the past builds:
And, finally, I get these errors after running
cmake --build .
: