1

If I have 10,000 instances of a quadratic program, what is the fastest way to solve these programs?

  1. For loop

  2. Parallelizing over CPU threads

  • Does this even do anything?

GPU parallelization as far as I can tell, is not available.

HoliInn
  • 169
  • 6
  • Mosek V10 has an a feature called optimizebatch which is build to do what you want. Drake may not support V10 yet though. – ErlingMOSEK Jul 22 '22 at 08:30

1 Answers1

1

Parallelizing over CPU threads

This will work. Also depends on the license you have. I think Mosek's license supports multiple Mosek instances on the same machine. For Gurobi, if you have a standalone Gurobi license then it also supports CPU parallelization.

Hongkai Dai
  • 2,546
  • 11
  • 12
  • Note that individual solves are parallel by default. You will have to run an experiment to test different levels of parallel threads inside a single solve vs solving multiple models in parallel. – Greg Glockner Jul 22 '22 at 17:59
  • @Hongkai Dai It looks like Mosek V10 supports this feature explicitly. But V10 is a beta. Is there any way to use this with Drake? – HoliInn Jul 22 '22 at 19:58
  • 1
    I launched many CPU thread, each thread construct a MathematicalProgram object and then solve it. One example is here https://github.com/AlexandreAmice/drake/blob/93085371c27573b4f57bd97c42c29e71f5864cdc/multibody/rational_forward_kinematics/cspace_free_region.cc#L1264-L1321 – Hongkai Dai Jul 23 '22 at 05:36
  • @HongkaiDai So this is with old Mosek? Did you ever benchmark how much speedup, is it 1:1 speedup of problems_solved:threads? – user3180 Jul 24 '22 at 05:29
  • @user3180 This was with Mosek 9. The motivation for doing the parallel computation in this example was that I have thousands of optimization problems, but the problem size changes a lot. If any of these optimization problem is infeasible, then I can terminate the process. If I run them sequentially I might need to wait a while until I find any infeasible problem, but if I run them in parallel then I can detect infeasibility in the early stage. Because the problem have very different size, so it is not a 1 : 1 speedup (the thread for the large program can be the bottleneck). – Hongkai Dai Jul 24 '22 at 15:42