cannot find libdevice
See original GitHub issueHi
Jax cannot find libdevice. I’m running Python 3.7 with cuda 10.0 on my personal laptop qwith a GeForce RTX 2080. I installed jax using pip.
I made a little test script shown below
import os
os.environ["XLA_FLAGS"]="--xla_gpu_cuda_data_dir=/home/murphyk/miniconda3/lib"
os.environ["CUDA_HOME"]="/usr"
import jax
import jax.numpy as np
print("jax version {}".format(jax.__version__))
from jax.lib import xla_bridge
print("jax backend {}".format(xla_bridge.get_backend().platform))
from jax import random
key = random.PRNGKey(0)
x = random.normal(key, (5,5))
print(x)
The output is shown below.
jax version 0.1.39
jax backend gpu
2019-07-07 16:44:03.905071: W external/org_tensorflow/tensorflow/compiler/xla/service/gpu/llvm_gpu_backend/nvptx_backend_lib.cc:105] Unknown compute capability (7, 5) .Defaulting to libdevice for compute_20
Traceback (most recent call last):
File "<ipython-input-15-e39e42274024>", line 1, in <module>
runfile('/home/murphyk/github/pyprobml/scripts/jax_debug.py', wdir='/home/murphyk/github/pyprobml/scripts')
File "/home/murphyk/miniconda3/lib/python3.7/site-packages/spyder_kernels/customize/spydercustomize.py", line 827, in runfile
execfile(filename, namespace)
File "/home/murphyk/miniconda3/lib/python3.7/site-packages/spyder_kernels/customize/spydercustomize.py", line 110, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)
File "/home/murphyk/github/pyprobml/scripts/jax_debug.py", line 18, in <module>
x = random.normal(key, (5,5))
File "/home/murphyk/miniconda3/lib/python3.7/site-packages/jax/random.py", line 389, in normal
return _normal(key, shape, dtype)
File "/home/murphyk/miniconda3/lib/python3.7/site-packages/jax/api.py", line 123, in f_jitted
out = xla.xla_call(flat_fun, *args_flat, device_values=device_values)
File "/home/murphyk/miniconda3/lib/python3.7/site-packages/jax/core.py", line 663, in call_bind
ans = primitive.impl(f, *args, **params)
File "/home/murphyk/miniconda3/lib/python3.7/site-packages/jax/interpreters/xla.py", line 606, in xla_call_impl
compiled_fun = xla_callable(fun, device_values, *map(abstractify, args))
File "/home/murphyk/miniconda3/lib/python3.7/site-packages/jax/linear_util.py", line 208, in memoized_fun
ans = call(f, *args)
File "/home/murphyk/miniconda3/lib/python3.7/site-packages/jax/interpreters/xla.py", line 621, in xla_callable
compiled, result_shape = compile_jaxpr(jaxpr, consts, *abstract_args)
File "/home/murphyk/miniconda3/lib/python3.7/site-packages/jax/interpreters/xla.py", line 207, in compile_jaxpr
backend=xb.get_backend()), result_shape
File "/home/murphyk/miniconda3/lib/python3.7/site-packages/jaxlib/xla_client.py", line 535, in Compile
return backend.compile(self.computation, compile_options)
File "/home/murphyk/miniconda3/lib/python3.7/site-packages/jaxlib/xla_client.py", line 118, in compile
compile_options.device_assignment)
RuntimeError: Not found: ./libdevice.compute_20.10.bc not found
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:35 (4 by maintainers)
Top Results From Across the Web
error: Can't find libdevice directory ${CUDA_DIR}/nvvm/ ...
in windows CMD. It is worth noting that I'm working with a virtual environment in miniconda3, it may be that this solution doesn't...
Read more >i got an error about error: Can't find libdevice directory ...
The only solution I was able to find is just copying the required files. Steps for a quick fix: Find where your CUDA...
Read more >Libdevice not found. Why is it not found in the searched path?
Question Since TF says it is searching this location for this file and the file exists there, what is wrong and how do...
Read more >[llvm-dev] "cannot find libdevice for sm_" - Mailing Lists
Hi Jost, most probably the compiler cannot correctly find CUDA installation or cannot detect its version correctly.
Read more >clang: error: cannot find libdevice for sm_75. Provide path ...
clang: error: cannot find libdevice for sm_75. Provide path to different CUDA installation via --cuda-path, or pass -nocudalib to build without linking with ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
The folks at Lambda (maker of my TensorBook laptop) looked at the source code and suggested this fix:
This actually works 😃
Maybe worth updating the set of locations that JAX searches for libdevice.10.bc?
On Mon, Jul 8, 2019 at 10:41 AM Kevin Murphy murphyk@gmail.com wrote:
Here’s my understanding of this issue:
jax depends on XLA, which is built as part of TF and bundled up into the
jaxlib
package. By default, TF is compiled to look for cuda and cudnn in/usr/local/cuda
: https://github.com/tensorflow/tensorflow/blob/master/third_party/gpus/cuda_configure.bzl#L14So symlinking your cuda install to
/usr/local/cuda
should work. Make surelibdevice
actually exists… I always have a hard time figuring out which Nvidia downloads contain libraries, but I think libdevice is shipped as part of https://developer.nvidia.com/cuda-toolkit.Alternatively, setting the environment variable
XLA_FLAGS=--xla_gpu_cuda_data_dir=/path/to/cuda
should work. I recommend exporting this outside the Python interpreter to be sure it’s being picked up when jaxlib is loaded (there’s probably a more targeted way to do it, but this will limit mistakes).Is anyone still having problems after trying these methods?
We should also potentially make a jax-specific environment variable to set a custom cuda install path, or at least document the XLA_FLAGS one more clearly… I can do that once we verify this actually works.