0

Are there any packages specifically to let R run faster via parallel computing? I have made a very large IP that needs to run for a while, so I was wondering if there was a specific package in R that could help me run my IP. Currently, I have a function that returns the solution of an IP and the primary line that R gets stuck on (for a very...very long time) is when I use lp (....all.int = TRUE). My CPU is around 12.5% (8 cores) on my Windows computer, and I want it to near 100

Edit: I tried using the doParallel package,

library('doParallel')
cl <- makeCluster(8)
registerDoParallel(cl)

But my CPU usage is still not at 100%. What else do i need to do? Is there a specific package that makes optimization problems run faster? Most parallel packages help with simulation, and foreach seems to only work for iterative structures/ apply functions. I just want R to use all my CPU usage

Timothy
  • 49
  • 1
  • 4
  • 1
    Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it. –  Aug 07 '15 at 01:35
  • What OS are you running? What type of processor? The Intel MKL when present, will automatically parallelize mathematical operations. – scribbles Aug 07 '15 at 01:37
  • I agree with @Pascal, but have you looked at the results from googling "R parallel"? One of the first few is the [CRAN Task View for High Performance Computing](https://cran.r-project.org/web/views/HighPerformanceComputing.html), maintained by Dirk Eddelbuettel. This list is rather daunting, admittedly. Two of the other top returns from Google reference the `parallel`, `doParallel`, and `foreach` packages. I suggest you experiment with each and, if you still have questions, ask something a little more specific. – r2evans Aug 07 '15 at 02:17
  • I would like to echo others that this question is off-topic for Stack Overflow. Some solvers make parallel MIP solving rather easy; for instance, the [Gurobi R Api](http://www.gurobi.com/documentation/6.0/refman/r_api_overview.html), which is not free unless you're in academia, enables you to use multiple cores through the `Threads` parameter. – josliber Aug 07 '15 at 03:00
  • Sorry, I am new to this. I tried looking up a lot of parallel packages and most of them have to do with clustering/simulations, which I am not sure is what I want. Currently, my CPU is at 12.5% (I have 8 cores), and I want it to max out at 100. – Timothy Aug 07 '15 at 06:29
  • Can you say more about your "Integer Program"? As @josilber says, if it is like a linear or possibly quadratic integer program (i.e. MILP, MIQP or similar) and if it is non-trivial you would be crazy to solve it with your own solver implementation other than as an exercise to understand how such solvers work. Solvers like Gurobi, Xpress and CPLEX will be probably orders of magnitude faster than any home-brewed code unless you are lucky or have a special case with inside knowledge about the solutions that you are looking for. – TimChippingtonDerrick Aug 07 '15 at 18:29
  • I'm definitely trying to solve in a MILP fashion. I want all my solutions to be integers, and I am using lp() from the linprog package in R – Timothy Aug 07 '15 at 21:21
  • Hi @Timothy, Read the answers on these two posts: [One](http://stackoverflow.com/questions/8091674/how-to-let-r-use-all-the-cores-of-the-computer?rq=1), [Two](http://stackoverflow.com/questions/31900708/how-can-i-get-r-to-use-more-cpu-usage/33996564#33996564) – Bas Nov 30 '15 at 10:42

0 Answers0