question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Doesn't work if cuda is not installed in usr/local

See original GitHub issue

If cuda is not installed in ‘usr/local’, it does not run correctly. This is due to lines 42 and 46 in ops.py

Note also that lines 37-40 are not used in ops.py, and therefore neither is line 17 in config.ini.

My simple fix to this was to replace lines 37 to 46 in ops.py with the following:

    out, err = subprocess.Popen(['which', 'nvcc'], stdout=subprocess.PIPE).communicate()
    cuda_dir = out.decode().split('/cuda')[0]

    nvcc_cmd = "nvcc -std=c++11 -c -o {} {} {} -D GOOGLE_CUDA=1 -x cu -Xcompiler -fPIC -I " + cuda_dir + " --expt-relaxed-constexpr"
    nvcc_cmd = nvcc_cmd.format(" ".join([fn_cu_o, fn_cu_cc]),
                               tf_inc, tf_lib)
    subprocess.check_output(nvcc_cmd, shell=True)
    gcc_cmd = "{} -std=c++11 -shared -o {} {} -fPIC -L " + cuda_dir + "/cuda/lib64 -lcudart {} -O2 -D GOOGLE_CUDA=1"

I also removed line 17 from config.ini

Finally, I know this is a custom config file, but I would also suggest perhaps changing line 15 in config.ini to

g++ = g++

I have tested on 3 different machines, all with different versions of linux, tensorflow, and cuda. With these small changes, your code runs immediately following a clone from this repo on all of them (after copying over the config.ini file of course.)

Just a few small suggestions to make things as out-the-box as possible! 😃

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:4
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
bragileecommented, Aug 22, 2019

Hi @DeckerDai ,

sorry about late. It has been a long time since I did not work on this problem. Previously I tried to run this repo then I moved to other projects. For my case, I only make the cuda version+cudnn version compatible with this repo. I am not quite sure about what other factors will have effects on compilation, for example, gcc. I suggest you can start to follow exactly the same versions used in this repo.

Thank you.

1reaction
simonmeistercommented, Jul 24, 2018

Many thanks! I changed the code as suggested. Sorry for taking so long to respond - I am very busy with new projects.

Read more comments on GitHub >

github_iconTop Results From Across the Web

No /usr/local/cuda/ directory after Cuda installation
I am using lubuntu 21.04 and an NVIDIA GeForce GT 720M GPU with a legacy 390 driver. So if you could tell me...
Read more >
Where did CUDA get installed on Ubuntu 14.04 on my ...
Usually, it is /usr/local/cuda . If this is not the case, you can try to locate cuda . If you want to find...
Read more >
CUDA Installation Guide for Linux
The installation instructions for the CUDA Toolkit on Linux.
Read more >
Where is /usr/local/cuda? - Technical Help
Another program I'm trying to compile is looking for libraries in /usr/local/cuda which now doesn't exist when I installed CUDA using lambda stack....
Read more >
/usr/local/cuda/version.txt does not match with /usr/lib/cuda ...
1 Answer 1 · /usr/lib/cuda/version.txt belongs to the version installed as part of your Linux distribution; · /usr/local/cuda has the version of ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found