This article is about fixing No kernel image is available for execution on the device in Google JAX
  • 29-Jan-2023
Lightrun Team
Author Lightrun Team
This article is about fixing No kernel image is available for execution on the device in Google JAX

No kernel image is available for execution on the device in Google JAX

Lightrun Team
Lightrun Team

Explanation of the problem

Jax and Jaxlib were installed through pip3 and upgraded to version 0.1.61+cuda111, using a specific URL for the installation. It is also reported that the nvcc command shows that the NVIDIA Cuda compiler driver is installed and the version is 11.1.105.

RuntimeError is experienced when attempting to run a code example, stating that “no kernel image is available for execution on the device”. The error message includes a file path within the TensorFlow library, indicating that the issue may be related to TensorFlow’s CUDA integration.

The output of the nvidia-smi command is included, which shows that the user’s GPU is a GeForce GTX 1660 and that the GPU driver version is 450.102.04, which corresponds to CUDA version 11.0. The nvidia-smi output also shows the memory usage of various processes running on the GPU, indicating that the GPU may be running low on memory.

Code Blocks:

pip3 install --upgrade jax jaxlib==0.1.61+cuda111 -f
nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2020 NVIDIA Corporation
Built on Mon_Oct_12_20:09:46_PDT_2020
Cuda compilation tools, release 11.1, V11.1.105
Build cuda_11.1.TC455_06.29190527_0
CUDA 11.1 is at /usr/local/cuda-11.1
Tue Feb 16 21:26:58 2021       
| NVIDIA-SMI 450.102.04   Driver Version: 450.102.04   CUDA Version: 11.0     |
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|   0  GeForce GTX 166...  Off  | 00000000:01:00.0  On |                  N/A |
| N/A   53C    P8     6W /  N/A |    684MiB /  5944MiB |      2%      Default |
|                               |                      |                  N/A |
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|    0   N/A  N/A      1700      G   /usr/lib/xorg/Xorg                106MiB |
|    0   N/A  N/A      9639      G   /usr/lib

Troubleshooting with the Lightrun Developer Observability Platform

Getting a sense of what’s actually happening inside a live application is a frustrating experience, one that relies mostly on querying and observing whatever logs were written during development.
Lightrun is a Developer Observability Platform, allowing developers to add telemetry to live applications in real-time, on-demand, and right from the IDE.

  • Instantly add logs to, set metrics in, and take snapshots of live applications
  • Insights delivered straight to your IDE or CLI
  • Works where you do: dev, QA, staging, CI/CD, and production

Start for free today

Problem solution for No kernel image is available for execution on the device in Google JAX

The first solution to this problem is to set the XLA_FLAGS environment variable to “–xla_gpu_force_compilation_parallelism=1” to suppress the error. This is most likely caused by a problem with singularity, but it’s worth noting that this was encountered on an HPC where the user is not an admin.

Another possible solution is to use an older version of CUDA in combination with a newer version of the NVidia driver. This has been confirmed as the cause of the issue, and using this workaround can help to resolve the problem.

It’s worth noting that there may also be a future workaround available at the JAX level, so it’s worth keeping an eye on updates and new developments in this area.

Other popular problems with Google JAX

Problem: Memory Leak Issues

One of the most commonly reported problems with Google JAX is that of memory leaks. These occur when the program continues to hold on to memory resources even after they are no longer needed. This can lead to the program using up an excessive amount of memory and potentially crashing.


To resolve memory leak issues, it is important to identify where the leaks are occurring in the code and address them directly. This can be done by using memory profilers or other debugging tools to track down the specific lines of code that are causing the leaks. Additionally, best practices such as properly managing memory resources, such as closing file handles and releasing memory resources when they are no longer needed, can help to reduce the risk of leaks.

Problem: Performance Issues

Another common problem with Google JAX is that of poor performance. This can manifest in a number of ways, such as slow execution times or poor GPU utilization.


To improve performance, it is important to optimize the code and take advantage of the available hardware. This can include using JIT compilation, which can significantly improve the performance of the code. Additionally, taking advantage of hardware-specific features, such as multi-threading or GPU acceleration, can help to further improve performance.

Problem: Compatibility Issues

Google JAX is a relatively new library and as such, it may not be compatible with all existing libraries. This can lead to compatibility issues when trying to use JAX alongside other libraries, such as NumPy.


To resolve compatibility issues, it is important to thoroughly test the code and ensure that it works correctly with all of the libraries that it will be interacting with. Additionally, it may be necessary to update or rewrite certain portions of the code to ensure that it is compatible with JAX. Alternatively, using a version of JAX that is compatible with the other libraries can be considered.

A brief introduction to Google JAX

Google JAX is a numerical computation library for Python that allows for the use of hardware-accelerated computation, such as that provided by GPUs and TPUs. JAX is built on top of the popular numerical computation library, NumPy, and is designed to be a drop-in replacement for it.

JAX utilizes a technique called Automatic Differentiation (AD) to allow for efficient gradient computation in neural network training. This allows for the use of gradient-based optimization algorithms, such as stochastic gradient descent, to train neural networks. Additionally, JAX includes a number of other features such as JIT compilation, which can significantly improve the performance of the code and Device arrays that allows to perform computation on the GPU or TPU. JAX library allows to perform computation on the fly and it’s designed to be able to handle large amount of data efficiently with less memory consumption.

Most popular use cases for Google JAX

  1. Machine Learning: Google JAX can be used for machine learning tasks, such as training and evaluating neural networks. The library includes support for popular deep learning frameworks, such as PyTorch and TensorFlow, and can be used to train models on both CPUs and GPUs. Additionally, JAX’s Automatic Differentiation (AD) feature allows for efficient gradient computation, making it well-suited for use in gradient-based optimization algorithms.
  2. Numerical Computation: Google JAX can be used for a wide range of numerical computation tasks, such as linear algebra, optimization, and signal processing. The library is built on top of the popular numerical computation library, NumPy, and is designed to be a drop-in replacement for it. This means that existing code written in NumPy can easily be adapted to use JAX and take advantage of hardware acceleration.
  3. JIT Compilation: Google JAX provides Just-In-Time (JIT) compilation feature which allows to perform the computation on the fly. With JIT compilation, the JAX can generate machine code for a specific input and then cache it for future use. This can significantly improve the performance of the code, especially for computationally expensive operations such as matrix multiplications. This can be achieved using the following code block:
import jax.numpy as np
from jax import grad, jit

def f(x):
    return, x)

grad_f = jit(grad(f))

In this example, grad_f is a JIT-compiled version of the gradient of f that can be called multiple times with different input values and will be faster than calling grad(f) each time.


It’s Really not that Complicated.

You can actually understand what’s going on inside your live applications. It’s a registration form away.

Get Lightrun

Lets Talk!

Looking for more information about Lightrun and debugging?
We’d love to hear from you!
Drop us a line and we’ll get back to you shortly.

By submitting this form, I agree to Lightrun’s Privacy Policy and Terms of Use.