# Installation
## System requirements
We recommend using an NVIDIA GPU for faster compiles with qubee, but it is not necessary. Currently, the CPU-only version of qubee is also supported.

### Reference System
- [Ubuntu 22.04.4 LTS](https://ubuntu.com/)
- [NVIDIA Graphics Driver 545.29.06](https://www.nvidia.com/en-us/drivers/)

### Requirements and Recommended Packages
- [Ubuntu 20.04.6 LTS or Above](https://ubuntu.com/)
- [NVIDIA Graphics Driver 535.183.01 or Above](https://www.nvidia.com/en-us/drivers/)
- [Docker](https://www.docker.com/)
- [NVIDIA Container Toolkit](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/index.html#)
 
## SDK Installation
We recommend installing the qubee compiler using Mobilint’s official Docker container images. Starting with qubee compiler v0.10.0.0, the first two digits of the compiler version must match the first two digits of the Docker image tag. For example, if you use qubee compiler v0.12.0.0, choose an image whose tag starts with 0.12. In addition, from qubee Docker 0.11 and later, the images are based on CUDA 12.8.1, which requires an NVIDIA driver from the R570 branch or newer. For best compatibility, we recommend updating your NVIDIA driver to the latest available version.

- Docker image: `mobilint/qbcompiler:0.12-cuda12.8.1-ubuntu22.04`
- Link: [https://hub.docker.com/r/mobilint/qbcompiler](https://hub.docker.com/r/mobilint/qbcompiler)

### Building Docker Container
Run the following commands to build the docker container.
```bash
# Download Docker Image
docker pull mobilint/qbcompiler:0.12-cuda12.8.1-ubuntu22.04
# mkdir {WORKING DIRECTORY} (if needed)
cd {WORKING DIRECTORY}
# Build the Docker container
docker run -it --gpus all --ipc=host --name {YOUR_CONTAINER_NAME} -v $(pwd):/workspace mobilint/qbcompiler:0.12-cuda12.8.1-ubuntu22.04 /bin/bash
```
(Recommended) If the trained models and datasets are stored in different directories, you can mount them to the docker container as follows:
```bash
docker run -it --gpus all --ipc=host --name {YOUR_CONTAINER_NAME} -v $(pwd):/workspace -v {PATH TO MODEL DIR}:/models -v {PATH TO DATASET DIR}:/datasets mobilint/qbcompiler:0.12-cuda12.8.1-ubuntu22.04 /bin/bash
```
To run the NPU inside the Docker container, add `--device /dev/aries0:/dev/aries0` when creating the Docker container.
(Optional) By building the Docker container with the CPU-only version image, users may run the Mobilint Compiler on computers without GPUs.
```bash
# Download Docker Image
docker pull mobilint/qbcompiler:0.12-cpu-ubuntu22.04
cd {WORKING DIRECTORY}
# Build the Docker container
docker run -it --ipc=host --name {YOUR_CONTAINER_NAME} -v $(pwd):/workspace mobilint/qbcompiler:0.12-cpu-ubuntu22.04 /bin/bash
```
### Installation of qubee
qubee compiler packages are available in [Mobilint® Software Development Kit (SDK)](https://dl.mobilint.com/view.php). After entering the page, choose the device you are using and download the corresponding qubee compiler package. The package is in the form of a Python wheel file, which can be installed using pip.

Run the following commands to install qubee on the docker container.
```bash
# Download qubee-0.12.0.0+aries-py3-none-any.whl file
# Copy qubee whl file to Docker
docker cp {Path to qubee-0.12.0.0+aries-py3-none-any.whl} {YOUR_CONTAINER_NAME}:/
# Start Docker
docker start {YOUR_CONTAINER_NAME}
# Attach to Docker container
docker exec -it {YOUR_CONTAINER_NAME} /bin/bash
# Install qubee compiler
cd /
python -m pip install qubee-0.12.0.0+aries-py3-none-any.whl
```
The `.whl` file includes the name of the required npu device, so make sure to check it before installation. Currently, we provide support for devices such as ARIES and REGULUS.