Adding path to CUDA libraries without sudo access - linux

I used a library (the library is called cublas) in my CUDA code which I 'm writing in linux, I can compile my code successfully using nvcc but when I run the code I get this error:
error while loading shared libraries: libcublas.so.7.5: cannot open shared object file: No such file or directory
I found This link as a solution which suggests to run some commands in order to solve the issue. one solution based on this link is running the following command:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib
The system which gpu locates in it and I am using to run my code on it is shared between me and other people, I am not a sudo user in that system. I am wondering if running this command is safe and does not affect other settings of the system
Can anyone please help me to know that>
Thank you so much

I am wondering if running this command is safe and does not affect other settings of the system
Yes, you'll be fine.
This command:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib
only affects the process you execute it in.
It will not affect any other user's process, or any other process of yours.
Furthermore, if you log out and log in again, you will have to execute that command again. It is not "sticky"

Related

environment variable LD_LIBRARY_PATH is not working until I reassign it

I have a strange behavior on an embedded linux system. It is created from an image file and has been used on many system for about a year without any issues. But a new system that I installed just now fail to work.
I have an app that is started by one of the boot scripts, and is dependent on a library foo.so in a special path.
So the script sets LD_LIBRARY_PATH to foopath.
LD_LIBRARY_PATH=foopath \
foo.app
But after boot I can see that the app was never started and if I try to start it manually it complains that it can't find the library.
The strange thing is that I can get it to work by setting the same path again by just copying the path using the clipboard, like this:
$ echo $LD_LIBRARY_PATH
foopath
$ export LD_LIBRARY_PATH=foopath
After this my app will find the library and executes correct.
But if I reboot the system the problem is of course back again.
What could be wrong, and what can I do to solve the issue?
As seen in the comments I got it to work by changing my script like this, but I still can't understand why it works on some systems, but not all.
export LD_LIBRARY_PATH=foopath
foo.app

How can we generate MCE(machine check errors)

As much I know that mcelog is used to check the memory errors in the hardware. I want to simulate the same case. I don't have any machine which is having the issue with hardware where I can simulate this case. Can anybody suggest me some simulator or any other way through which I can generate these errors. Because my main aim is to display the Uncorrectable Memory errors. Thanks.
You can use the tool mce-inject, but you'll need to load the mce_inject kernel module. This kernel module is available on Ubuntu 12.04 (the only system I have access to) and should be available on newer Ubuntus, as well.
First, you need to load the module:
$ sudo modprobe mce_inject
Next, you need to download the source for the mce_inject tool, install the dependencies, and compile it:
$ git clone https://github.com/andikleen/mce-inject.git
$ sudo apt-get install flex bison
$ cd mce-inject
$ make
Next, you need to create a file that simulates the error you want. You should check the mce-inject man page (included in the source) for more information on the structure. You can find some examples in the test/ directory in the [mce-inject source](
Injecting a FATAL error can destabilize and crash the system; doing this is not recommended.
Once you've decided which example file to use (or have created your own) you can inject it with mce-inject. For example, injecting the test/corrected example error included with mce-inject:
$ sudo ./mce-inject test/corrected
You can now check your logs and find that the error has been injected.

Starting a program in a chroot environment returns immediately

I am working in a virtual environment, trying to start open vm tools in a chroot environment.
I tested with bash and it seems to work fine.
I used ./configure --options --prefix=/home/chroot_env to install the program, then using ldd on vmtoolsd, i copied the corresponding libraries to the /lib directory.
Now when I start chroot /home/chroot_env /bin/vmtoolsd, nothing happens, the chroot returns directly. Launching the same binary in the normal environment does work.
Does someone have an idea why it isn't working, the correct libraries are there, and it works with bash.
EDIT : strace showed that vmtoolsd is trying to access /dev/console, I added mount --bind /dev/ /home/chroot_env/dev/ but it is still failing.
EDIT2 : another strace showed it was looking for another plugin loaded dynamically, i added it and it worked, conclusion strace is great for debugging such issue!
When you run a program and nothing happens, you can always run it with strace in order to see which syscalls are made. This is an easy way to obtain the list of the files (regular or not) that are opened. In your case, check that your program doesn't try to access a file that is not in the chroot.

Matlab Libopencv error using Linux

I am running into errors with opencv. I downloaded a package online and compiled each of the folders by cd into them and running make through the command line. But when I try using one of the functions, I run into this error: libopencv_core.so.2.3: cannot open shared object file: No such file or directory
The file its trying to reach is indeed there, since I checked this, but for some reason its saying its not. I am pretty bad at figuring out path problems but I think this is one of them. Can anyone tell me how to fix this? Thanks

cppcms - Shared library - Linux

I am trying to use the cppcms framework on Linux(Debian distribution).
I followed the steps described in the Build tutorial on the site and then tried to build the hello world application.
I have successfully compiled the source, but when I try to run it I get the following error:
./hello: error while loading shared libraries: libcppcms.so.1: cannot open shared object file: No such file or directory
I am relatively new to Linux so I had to a little research and come across these things called Shared Libraries. As I understood, these *.so files are exactly what I was needing to create.
I also read that the base folder for libraries was /home/usr/lib so I tried copying the file onto that folder, but it didn't help.
I would really appreciate any help that might get me through this problem.
Thank you!
I was able to recover from this problem by executing "sudo ldconfig"
Also this worked out for me:
export LD_LIBRARY_PATH=/path/to/library/
./hello -c config.js
where "/path/to/library/" is the actual directory where libcppcms.so.1
lives. (mine was /usr/local/lib/)
[got it from http://comments.gmane.org/gmane.comp.lib.cppcms.user/764 ]
Instead of building CppCMS on your own, install ready to use deb: http://cppcms.com/wikipp/en/page/apt#Apt-Get.Repositories
You can use the troubleshooting guide that the problem you are talking about was mentioned: http://cppcms.com/wikipp/en/page/cppcms_1x_build_troubleshooting#My.sample.application.does.not.find.the.shared.object..code.libcppcms.so..code..when.I.try.to.run.it.

Resources