This comprehensive guide walks you through the process of installing JAX on Ubuntu, including setting up Python, creating a virtual environment, and installing JAX with both CPU and GPU support. JAX enables high-performance machine learning models with accelerated computation, perfect for researchers and developers.
10 min
Edited:12-10-2024
JAX is a high-performance machine learning library that allows for accelerated numerical computing using both CPU and GPU. Below is a guide to install JAX on Ubuntu.
Start by updating your system to ensure all packages are up to date:
1. sudo apt update && sudo apt upgrade -y
Ensure that Python 3.x is installed on your system:
1. python3 --version
If Python isn’t installed, you can install it using:
1. sudo apt install python3 python3-pip python3-venv -y
It’s best to use a virtual environment to isolate JAX and its dependencies:
1. python3 -m venv jax-env
2. source jax-env/bin/activate
To install JAX with CPU support, you can use pip:
1. pip install jax
If you want to use JAX with GPU acceleration, you’ll need to install the version of JAX that works with NVIDIA’s CUDA toolkit:
After setting up CUDA, install JAX with GPU support:
1. pip install --upgrade "jax[cuda11_cudnn86]" -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html
To check if JAX is installed correctly, run the following Python script:
1. import jax
2. import jax.numpy as jnp
3.
4. # Simple operation
5. x = jnp.array([1.0, 2.0, 3.0])
6. print(jax.device_put(x * 2))
If you have installed the GPU version, you can check if JAX is utilizing the GPU with this script:
1. import jax
2. from jax import random
3.
4. # Ensure that JAX uses the GPU
5. key = random.PRNGKey(0)
6. x = random.normal(key, (1000, 1000))
7. print(jax.devices())
You should see the GPU listed in the output if JAX is using it.
After following these steps, you should have JAX successfully installed on your Ubuntu system. Whether you use CPU or GPU, JAX is now ready to help you with high-performance numerical computing and machine learning tasks!
14-10-2024
This article offers a detailed guide on installing and configuring IPTables on an Ubuntu VPS. IPTables is a powerful firewall tool that helps secure your server by controlling inbound and outbound traffic. Learn how to set up rules for traffic filtering, configure basic security policies, and apply custom rules to protect your VPS.
IPtables
security
12 min
This article offers a comprehensive guide on installing and configuring ModSecurity, a powerful web application firewall (WAF), on an Ubuntu VPS. Learn how to secure your server by filtering and monitoring HTTP requests, set up ModSecurity with Nginx or Apache, and apply rules to protect against common web attacks.
Modsecurity
security
10 min
14-10-2024
This article provides a comprehensive guide on installing and configuring PHP-FPM (FastCGI Process Manager) on an Ubuntu VPS. Learn how to optimize PHP performance for your web applications by configuring PHP-FPM with Nginx or Apache, managing pools, and fine-tuning settings for efficient processing of PHP scripts.
PHP-FPM
speed
optimise
12 min