Skip to main content

Solving different models in parallel (C++/OpenMP)

Answered

Comments

4 comments

  • Official comment
    Simranjit Kaur
    • Gurobi Staff
    This post is more than three years old. Some information may not be up to date. For current information, please check the Gurobi Documentation or Knowledge Base. If you need more help, please create a new post in the community forum. Or why not try our AI Gurobot?.
  • Silke Horn
    • Gurobi Staff

    Yes, with Gurobi it is possible to solve multiple models in parallel. (It actually depends on the license type, but with an academic license, this is allowed.)

    Please use a different environment for each thread. (Within one thread, you can reuse the environment.)

    2
  • Yauhen Yakimenka
    • Gurobi-versary
    • First Comment
    • First Question

    Great, thanks!

    0
  • Carlos Martin
    • Gurobi-versary
    • First Question
    • Conversationalist

    Silke Horn Under the C API, I get a segfault whenever I call GRBnewmodel inside an OMP parallel for loop, e.g.

    #pragma omp parallel for // works when this line alone is commented
    for (long batch = 0; batch < n_batch; ++batch)
    {
    printf("hello from batch %ld\n", batch);
    GRBenv* env;
    GRBemptyenv(&env);
    GRBsetintparam(env, GRB_INT_PAR_OUTPUTFLAG, 0);
    GRBstartenv(env);
    GRBmodel* model;
    GRBnewmodel(env, &model, NULL, 1, NULL, NULL, NULL, NULL, NULL); // works when this line alone is commented
    GRBfreemodel(model);
    GRBfreeenv(env);
    }

    What might be causing this?

    0

Post is closed for comments.