Where to install libcudart.dylib for deploying CUDA on Mac OS?
I want to ship libcudart.dylib with my software, but I am facing trouble for deciding where I have to install it. The library is having the following path
Quote:
@rpath/libcudart.dylib
That I believe that the linker is going to search for this in the usual library path. But according to me it is really a bad idea for me to install cudart in my system. What will happen if I ship the 2.3 runtime, and few other applications that come along and then installs the 2.2 runtime, or vice versa?
I just need to have any one effectively ship a cuda application to the end user on Mac or libcudart.dylib install location.
Re: How to ship CUDA on Mac OS X?
You can put that in application directory, and then add the path to the DYLD_LIBRARY_PATH. But you have to take care because it is fragile, especially when you software is a plug-in. The host application will do thing to the library path that you have to control over. If anyone install cudart in /usr/lib then it can be easily found before you copy, can create any problem.
Re: How to ship CUDA on Mac OS X?
If you are using third party libs, then you can do the following thing for ensuring that your copy will use the private copy of the library.
1. First you have to create a copy of the library in application directory.
2. Make sure to use the install_name_tool for changing the baked in path, hence it also point to application directory.
3. Do not forget to link against the copy in place of the original
Re: How to ship CUDA on Mac OS X?
Shipping libcudart.dylib from the cuda toolkit with the help of your application is obviously is the perfect method. You must install them into a place that is related to your application’s installation directory rather than to any complete path in the system for the perfect reason that you have given. I will suggest linking with these libraries in this manner that the application binary contains references in the application bundle that look like this.
Quote:
@executable_path/../Library/libcudart.dylib
@executable_path/../Library/libcufft.dylib
Re: How to ship CUDA on Mac OS X?
According to me you are absolutely correct on the install_name_tools is the technique to set this up, through install_name_tool for changing the LC_ID_DYLIB for the libraries for redistributing purpose. The whole process will look like this.
For changing this for libcudart.dylib after copying this to a new place.
Quote:
> install_name_tool -id "@executable_path/../Library/libcudart.dylib" libcudart.dylib
For verifying that this will work and you have use the otool –D command.
Quote:
> otool -D libcudart.dylib
libcudart.dylib:
@executable_path/../Library/libcudart.dylib