This repository contains the ReLU-QP solver proposed in "Improved GPU acceleration for embedded MPC" by Alberto Zaupa, Pedro Roque, Zachary Manchester and Mikael Johansson. The solver is implemented in C++ and CUDA, and is compared against OSQP and Relu-QP. The repository also contains a benchmark for the quadrotor stabilization problem as well as for several random QPs.
This setup intructions assume that the user has an CUDA-capable GPU installed in the system, along with the correct drivers and the CUDA Toolkit. The code was tested with CUDA 11.6 on machines with Ubuntu 24.04 and Ubuntu 22.04, using Intel CPUs paired with an RTX 3060M and RTX 5000 Ada Gen GPUs, respectively. The solver was also tested running natively on an Nvidia Jetson Xavier 16GB.
After installing the NVIDIA Container Toolkit, make sure to configure the docker runtime and restart the Docker service by running:
sudo nvidia-ctk runtime configure --runtime=docker
sudo systemctl restart dockerTo build the Docker image, run:
docker build -t cuda-admm .To start the container with GPU support and mount the results directory, use:
docker run --gpus all -it --rm -v ./examples/results:/shared cuda-admm bashOnce inside the container, you can run the following benchmarks:
Run the following command:
python3 quadrotor_stabilization.py --solver SOLVER --plot PLOTWhere:
SOLVERspecifies the solver. Must be one of:cppsolverreluqpreluqp_warmosqp
PLOTdetermines whether to generate plots of the system's response:0: No plots- Any other integer: Generate plots
Example:
python3 quadrotor_stabilization.py --solver cppsolver --plot 1To run the random QPs benchmark, execute:
python3 random_qps.pyThe results of the benchmarks will be stored in the results directory. The quadrotor stabilization benchmark will generate plots of the system's response, while the random QPs benchmark will generate a CSV file with the data.