Skip to main content

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

Answered

Comments

3 comments

  • Silke Horn
    Gurobi Staff 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

Please sign in to leave a comment.