Difference between revisions of "Matlab, CUDA, and GPU Computing"
Line 4: | Line 4: | ||
On July 2nd of 2018, Chenyu Yang, the original code author of the above main project, requested me to have "an implementation of LP on GPU", and Ed seconded this idea. I henceforth started exploring the possibility of such an endeavor. What is more important, such "an implementation of LP on GPU" should beat our current solver (Gurobi or Matlab's linprog). After some research, my conclusion is that we cannot beat performance of Gurobi on solving a single LP, and we should continued to use Gurobi instead of linprog. However, we might be still able to speed up our code by task-parallelising on CPU cores. | On July 2nd of 2018, Chenyu Yang, the original code author of the above main project, requested me to have "an implementation of LP on GPU", and Ed seconded this idea. I henceforth started exploring the possibility of such an endeavor. What is more important, such "an implementation of LP on GPU" should beat our current solver (Gurobi or Matlab's linprog). After some research, my conclusion is that we cannot beat performance of Gurobi on solving a single LP, and we should continued to use Gurobi instead of linprog. However, we might be still able to speed up our code by task-parallelising on CPU cores. | ||
− | ==Getting Started== | + | ==Getting Started with our GPU== |
We are running remotely on the Database Server via VNC. The VNC service on DB Server was configured by Wei during Summer 2018. Matlab, CUDA, and the Titan GPU were installed/configured by Office of Information Technology(OIT). | We are running remotely on the Database Server via VNC. The VNC service on DB Server was configured by Wei during Summer 2018. Matlab, CUDA, and the Titan GPU were installed/configured by Office of Information Technology(OIT). |
Revision as of 11:28, 9 July 2018
Main Project here: Estimating Unobserved Complementarities between Entrepreneurs and Venture Capitalists Matlab Code
Contents
Synposis
On July 2nd of 2018, Chenyu Yang, the original code author of the above main project, requested me to have "an implementation of LP on GPU", and Ed seconded this idea. I henceforth started exploring the possibility of such an endeavor. What is more important, such "an implementation of LP on GPU" should beat our current solver (Gurobi or Matlab's linprog). After some research, my conclusion is that we cannot beat performance of Gurobi on solving a single LP, and we should continued to use Gurobi instead of linprog. However, we might be still able to speed up our code by task-parallelising on CPU cores.
Getting Started with our GPU
We are running remotely on the Database Server via VNC. The VNC service on DB Server was configured by Wei during Summer 2018. Matlab, CUDA, and the Titan GPU were installed/configured by Office of Information Technology(OIT).
- To start/configure the VNC service on DB Server and to get connected remotely, see the documentation here.
- Once you are connected to DB Server through VNC, open a terminal on DB Server and type
matlab
This will bring up the Matlab GUI.
- To check if Matlab is working with our Nvidia graphics card, in the Matlab command window, type
gpuDevice.
What Works, and What Doesn't
- GPU computing does not work well for linear programming. The biggest reason is that GPUs don't work well for sparse linear algebra used for most LP solver. Another case study published 3 years ago shows that "the overhead of communication between CPU and GPU grows faster than the benefit of parallelizing matrix operations via CUDA." In another technical report, it is confirmed that "all algorithms (for solving LP and MIP problems)... do not fit to the SIMT paradigm".
- For the above reason, Gurobi does not support GPU computing.
- Matlab does not have GPU-based linprog or ga.
- Gurobi does support CPU parallelism.
- In general, individual threads of GPU only perform well with simple arithmetic tasks. Task-parallelizing toolboxes/libraries/packages onto threads of GPU is NO GO.
Deliverable
Week July 2 - 6
In Matlab, use parfor for both CPU and GPU to solve a set of LPs. Profile and compare. Just try to do CPU instead. Figure out how to do CPU-based parallel computing with Gurobi. I cannot find a way to run Gurobi solvers inside a parfor. I believe Matlab's linprog can, but linprog is much slower than Gurobi. There will be some trade off. I need to test this.
It is too hard to test this using the code written by Chenyu. Instead I will write my small piece of code to test this.
Reference
1. MATLAB GPU Computing Support for NVIDIA CUDA-Enabled GPUs
2. Getting Started with Parallel Computing Toolbox
3. Speeding Up Algorithms: When Parallel Computing and GPUs Do and Don't Accelerate