Closed c0g closed 9 years ago
As I don't have access to any Apple hardware, I unfortunately can't provide much help in this case. If you do discover a successful method to extract a dylib soname, feel free to submit a patch.
I understand. I have found this which appears to say the command on OSX is
otool -D
but I don't seem to get anything useful out of that (or gobjdump either). Is the below command useful? (I don't have access to a linux machine with CUDA so I don't know what the expected output of objdump is).
~ $ otool -L /usr/local/cuda/lib/libcublas.dylib
/usr/local/cuda/lib/libcublas.dylib:
@rpath/libcublas.dylib (compatibility version 1.1.0, current version 5.0.0)
@rpath/CUDA.framework/Versions/A/CUDA (compatibility version 1.1.0, current version 5.0.35)
@rpath/libcudart.dylib (compatibility version 1.1.0, current version 5.0.0)
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.9.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.0)
Running objdump -x path_to_lib/libcublas.so|grep SONAME
results in something like this:
SONAME libcublas.so.5.0
The output you sent seems like it might be useful. What do you get if you use the -D
option with otool?
p = subprocess.Popen(['otool','-L',filename],stdout=subprocess.PIPE)
out = p.communicate()[0]
value = re.search('^.*\s[0-9]',out.split(os.linesep)[1]).group(0)[-1]
Returns 5 when I have Cuda 5 installed, and 4 when I have Cuda 4. Is this the behaviour that we need? I'm having a look at integrating this with utils but it's going slowly :p
edit: I've forked to https://github.com/c0g/scikits.cuda.git. I have a version of utils.py there- it's a hack though, it just extract the 5 and puts it into libcublas.x.0 This still doesn't work, failing with a segfault if I try to run a BLAS function - here's the Mac's complaint: https://gist.github.com/c0g/5514690. This was caused by
result = cublas.cublasIsamax(self.cublas_handle, x_gpu.size, x_gpu.gpudata, 1)
in test_cublas.py. All of the other tests fail, mostly by segfaults except in the case of test_special.py which complains pycuda/pycuda-complex doesn't exist).
I am not certain, but I think that the problems are cause by the use of ctypes.c_int()
for the handle. I get crashes on my Macbook Pro with the following code:
import ctypes
_libcublas = ctypes.cdll.LoadLibrary('libcublas.dylib')
handle = ctypes.c_int()
status = _libcublas.cublasCreate_v2(ctypes.byref(handle))
_libcublas.cublasDestroy_v2(handle)
The following works however:
import ctypes
_libcublas = ctypes.cdll.LoadLibrary('libcublas.dylib')
handle = ctypes.c_void_p()
status = _libcublas.cublasCreate_v2(ctypes.byref(handle))
_libcublas.cublasDestroy_v2(handle)
Why are you using ints rather than pointers? Will try changing and then making a PR.
Okay. I added a Pull Request (see above) that fixes most of the issues I had on Mac OS X. (I have not installed CULA, so I did not check the tests that failed because it was not installed.) See the PR for details of what was wrong and how I fixed it.
Michael.
Thanks for all of the feedback and suggestions; I'll respond to the various items you addressed inline.
Hi,all. I still met the same error in my Mac OSX10.9. SCIKIT.CUDA is 0.43
WFMacBook-Pro:gpu wangfeng$ python gICLEAN.4.py
Traceback (most recent call last):
File "gICLEAN.4.py", line 17, in
Shall I install the gobjdump? mforbes, Do you have a revision of utils.py?? Thx
I integrated the updates from mforbes' pull request. Feel free to reopen this issue if the problem persists.
Yes, The problem is still exist. I have to download the full source from mforbes’ clone.
Dr Feng Wang Computer Technology Application Key Lab of Yunnan Province Kunming University of Science and Technology 650500 E-mail: wangfeng@acm.org
在 2014年1月8日 星期三,下午10:51,Lev Givon 写道:
I integrated the updates from mforbes' pull request. Feel free to reopen this issue if the problem persists.
— Reply to this email directly or view it on GitHub (https://github.com/lebedov/scikits.cuda/issues/29#issuecomment-31838615).
What do you observe when you run the following with the latest code in master
installed?
import scikits.cuda.utils as utils
lib_path = utils.find_lib_path('cublas')
print lib_path
print scikits.cuda.utils.get_soname(lib_path)
Python 2.7.5 (default, Aug 25 2013, 00:04:04)
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
import scikits.cuda.utils as utils lib_path = utils.find_lib_path('cublas') print lib_path None print scikits.cuda.utils.get_soname(lib_path) Traceback (most recent call last): File "
", line 1, in NameError: name 'scikits' is not defined
Dr Feng Wang Computer Technology Application Key Lab of Yunnan Province Kunming University of Science and Technology 650500 E-mail: wangfeng@acm.org
在 2014年1月8日 星期三,下午11:03,Lev Givon 写道:
What do you observe when you run the following with the latest code in master installed? import scikits.cuda.utils as utils lib_path = utils.find_lib_path('cublas') print lib_path print scikits.cuda.utils.get_soname(lib_path)
— Reply to this email directly or view it on GitHub (https://github.com/lebedov/scikits.cuda/issues/29#issuecomment-31840064).
Dear Lev, maybe this would help to find the bugs.
File "gClean.py", line 20, in
import scikits.cuda.fft as fft
File "/Library/Python/2.7/site-packages/scikits.cuda-0.043-py2.7.egg/scikits/cuda/fft.py", line 19, in
Dr Feng Wang Computer Technology Application Key Lab of Yunnan Province Kunming University of Science and Technology 650500 E-mail: wangfeng@acm.org
在 2014年1月8日 星期三,下午11:03,Lev Givon 写道:
What do you observe when you run the following with the latest code in master installed? import scikits.cuda.utils as utils lib_path = utils.find_lib_path('cublas') print lib_path print scikits.cuda.utils.get_soname(lib_path)
— Reply to this email directly or view it on GitHub (https://github.com/lebedov/scikits.cuda/issues/29#issuecomment-31840064).
You may need to install the Xcode Command Line Tools from Apple to get the otool
command (you don't need to install Xcode itself).
No. I have otool command .
WFMacBook-Pro:Downloads wangfeng$ otool
Usage: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/otool [-arch arch_type] [-fahlLDtdorSTMRIHGvVcXmqQj] [-mcpu=arg]
BTW: I can use the mforbes’s codes. If I install the clone codes of mforbes, it seems everything is OK. :)
Dr Feng Wang Computer Technology Application Key Lab of Yunnan Province Kunming University of Science and Technology 650500 E-mail: wangfeng@acm.org
在 2014年1月8日 星期三,下午11:23,Lev Givon 写道:
You may need to install the Xcode (https://developer.apple.com/xcode/index.php) Command Line Tools from Apple to get the otool command (you don't need to install Xcode itself).
— Reply to this email directly or view it on GitHub (https://github.com/lebedov/scikits.cuda/issues/29#issuecomment-31843190).
Closing - please reopen if the issue is still a problem.
I am trying to run scikits.cuda on my OS10.8.3 apple laptop. I modified utils.py to look for libdl.dylib rather than libdl.so, and used homebrew to install gobjdump (I believe) help find the cublas version. I also tried changing the objdump invocation to gobjdump/llvm-objdump.
I'm now stuck on line 227 in utils.py, above which it says:
This appears to have happened. I'll probably keep plugging away at this throughout the day, but any chance of help?