[Ipopt] MPI error using Ipopt

max leo correa cordova max-leo-19 at hotmail.com
Tue Oct 20 05:15:36 EDT 2015

Hello! I am new using Ipopt and have tested some example problems with c++ interface. I want to use MPI for solving in parallel multiple NLP, but when runnning with MPI I get an error message. My cpp main file is:

#include "IpIpoptApplication.hpp"
#include "IpSolveStatistics.hpp"
#include "MyNLP.hpp"
#include "mpi.h"
#include <iostream>

using namespace Ipopt;
using namespace std;

int main(int argc, char** argv)
    int size, rank;
    int i; double begin, end;
    ApplicationReturnStatus status;
    MPI_Init(&argc, &argv); 
     MPI_Comm_size(MPI_COMM_WORLD, &size); 
    MPI_Comm_rank(MPI_COMM_WORLD, &rank);
    begin = MPI_Wtime();
    if(rank == 0){
        SmartPtr<IpoptApplication> app = IpoptApplicationFactory();
        status = app->Initialize();
        SmartPtr<TNLP> mynlp = new MyNLP();
        status = app->OptimizeTNLP(mynlp);

    end = MPI_Wtime();
    cout<< end-begin<<endl;
    return (int) status;

I compiles fine with:
mpic++ -O3 -o example example.cpp -I/home/max/CoinIpopt/build/include/coin -L/home/max/CoinIpopt/build/lib -lipopt -llapack -ldl -lcoinmumps -lblas -lgfortran -lm -lquadmath -lcoinhsl -lcoinmetis

and run with:
mpirun -np 3 ./example

but i get this message error
*** The MPI_comm_size() function was called before MPI_INIT was invoked.
*** This is disallowed by the MPI standard.
*** Your MPI job will now abort.
[master:4655] Local abort before MPI_INIT completed successfully; not able to aggregate error messages, and not able to guarantee that all other processes were killed!

I am not sure why this error exists. It seems that using the ipopt linkers produce this error. Could you help me please?? Is there something wrong in the compilation step or how can I make ipopt run using MPI? I'll be grateful for your help.
Thanks in advance 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.coin-or.org/pipermail/ipopt/attachments/20151020/e4876ae6/attachment.html>

More information about the Ipopt mailing list