Closed wuxianliang closed 8 years ago
Hi,
So do you say that the actual dynamic library file is OpenCL
in the directory of /System/Library/Frameworks/OpenCL.framework
? Is it in the PATH
?
Actually I do not understand the file or path, I just use Nooocl with npm package in Meteor project. If I did not change anything, I receive a error
Dynamic Linking Error: dlopen(OpenCL.dylib, 2): image not found
Then I found opencl-ruby had such problem too. The way to fix is adding the path in an appropriate place. I found
this._handle = dlopen('/System/Library/Frameworks/OpenCL.framework/OpenCL', mode);
this one works. In my understanding, the problem is
this.libName = /^win/.test(process.platform) ? "OpenCL" : "libOpenCL.so";
this line in cl11.js did not make Nooocl find the correct OpenCL in OSX. OSX case should be different from Linux's, I think.
Could you test it with:
this.libName = (process.platform === "win32" || process.platform === "darwin") ? "OpenCL" : "libOpenCL.so";
it does not work.
And with:
this.libName = process.platform === "win32" ? "OpenCL" : (process.platform === "darwin" ? "/System/Library/Frameworks/OpenCL.framework/OpenCL" : "libOpenCL.so");
it does not work, because there are codes that append .dylib to the string of path.
in ffi.library.js
just modify library.EXT is ok, in darwin case we do not need append anything.
Well, then NOOOCL side, we gotta go with:
this.libName = (process.platform === "win32" || process.platform === "darwin") ? "OpenCL" : "libOpenCL.so";
But we need and ffi PR to make this work. Will look into this.
As temporary solution I create symlink in current folder of my nodejs code:
ln -s /System/Library/Frameworks/OpenCL.framework/OpenCL ./libOpenCL.so.dylib
As of 0.12.0, the is no more library path tampering anymore.
In OSX, OpenCL's path is
When I modify the 41th line of dynamic_library.js in ffi.lib
it works. Similar problem happens in opencl-ruby too. https://github.com/Nanosim-LIG/opencl-ruby/issues/1