A CUDA-based implementation of the Alternating Direction Method of Multipliers (ADMM) algorithm to solve Semi-Definite Programming (SDP) problems.
cuADMM solves multi-block SDP problems of the form:
where
The following dependencies are required to build and run the project:
CMake
CUDA
BLAS
(for basic linear algebra operations)SuiteSparse
(forCHOLMOD
)MATLAB
(for the bindings)
This project has been tested on Linux.
Build the project using CMake:
mkdir build
cmake -S . -B build
cmake --build build
Run the project:
./build/cuadmm_exe [dir_name]
where dir_name
is the directory containing the input files. See below for the expected input format.
When using the executable, you need to provide a directory containing the input files, in a format close to SDPT3. The expected files are:
At.txt
: the transpose of the constraint matrix in sparsesvec
COO formatb.txt
: the right-hand side constraint vector in sparse COO formatblk.txt
: a file containing the size of the blocks; if a line contains both a character and a number (e.g.s 3
), the block is interpreted using the table below; if it contains only a number (e.g.2
), it indicates a PSD block (identical tos 2
)C.txt
: the cost matrix in sparsesvec
COO formatcon_num.txt
: a file containing the number of constraints (which cannot be inferred from the other files)
Additionally, the following optional files can be provided:
X.txt
: an initial guess for the primal variable in sparsesvec
COO formaty.txt
: an initial guess for the dual variable in sparsesvec
COO formatS.txt
: an initial guess for the dual variable in sparsesvec
COO format
X
, C
and A
use the svec
version of the multi-block matrices, obtained by stacking the upper triangular part of each block in a vector, where non-diagonal elements are multiplied by svec
vector by storing the row indices, column indices, and values on the same line, separated by spaces.
Examples files are provided in the examples
directory, in the TXT
subfolders. See for instance this example.
The blk.txt
file can contain the following block types:
Character | Description |
---|---|
s |
PSD matrix of size n by n |
u |
WIP: Unconstrained vector of size n |
Warning
The support of unconstrained variables (u
) is currently a work in progress.
We provide in examples
a few MATLAB scripts to convert from other formats to the expected TXT
format:
mosek_to_txt.m
: converts a problem in MOSEK format to theTXT
formatsedumi_to_txt.m
: converts a problem in SeDuMi format to theTXT
format
In the MATLAB
directory, you can find the bindings to use cuADMM from MATLAB. To use them, you need to compile the MEX files:
cd MATLAB
mkdir build
cmake -S . -B build
cmake --build build
The signature of the MEX function is the following:
cuadmm_MATLAB(eig_stream_num_per_gpu,...
max_iter, stop_tol,...
At_stack, b, C_stack, blk_vec,...
X_new, y_new, S_new, sig_new,...
sig_update_threshold, sig_update_stage_1, sig_update_stage_2,...
switch_admm,switch_proj_iter,switch_proj_tol,...
sigscale);
The file cuadmm_MATLAB.cu
defines the MEX function, and can be used as a reference for the input format when interfacing with other languages or libraries.
A few examples of how to use the bindings are also provided, such as example_mosek.m
which shows how to solve a problem in MOSEK format.
After building, you can execute the unit tests:
cd build && ctest
Note
Some tests require the CUADMM_SOLVER_TEST_PATH
environment variable to be set to the path of some test data. You can export it in your terminal session using export CUADMM_SOLVER_TEST_PATH="/path/to/test/data"
. If the environment variable is not set, the tests will be skipped.