Results 1 to 11 of 11

Thread: Qprocess and mpi not finishing

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Qprocess and mpi not finishing

    Quote Originally Posted by Spifffers View Post
    Sounds more like QT signals are somehow hijacking the mpi functionality.
    This is very unlikely. A parent process can't intercept its child's signals. Especially that QProcess is cross-platform so it is very unlikely it uses unix signals at all.

    IF i manually kill mpiexec, the QProcess does send the finished() signal.
    This also suggests mpiexec just doesn't want to die on its own. If Qt hijacked its signals, it would also have hijacked the one you had sent.

    Since the QProcesses maintains a connection, it always thinks it needs to stay alive and therefore never exits.
    No, because if that was true, mpiexec would never die when ran from a terminal as the shell maintains a similar connection to its file descriptors as Qt does. It's the parent process that creates descriptors for its child before calling execve() or equivalent and it usually "attaches" those descriptors to itself. mpiexec must be detecting it's not the owner of its own process group and doesn't terminate. It probably sends some signal to the group leader, at least that could be the case on Unix. I don't know how processes are groupped in Windows.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  2. #2

    Default Re: Qprocess and mpi not finishing

    Currently I'm facing the same problem with mpiexec, did you found a solution for this problem then?

  3. #3
    Join Date
    Jan 2014
    Posts
    2
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: Qprocess and mpi not finishing

    Exactly the same problem : still no solution (6 years after !)

    Working with Qt 4.8, Windows

  4. #4
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Qprocess and mpi not finishing

    Rather than post "Me too!" Perhaps you could put some effort in to write a small, self-contained example that demonstrates the problem. The problem almost certainly has nothing to do with Qt but you never know what the process of distilling and sharing the problem might show you.

    You could also capture any standard output/error output from mpiexec, which I am sure could be useful in conjunction with other MPI log.

    BTW: Mar 2009 to Jan 2014 is a long way short of 6 years.
    "We can't solve problems by using the same kind of thinking we used when we created them." -- Einstein
    If you are posting code then please use [code] [/code] tags around it - makes addressing the problem easier.

  5. #5
    Join Date
    Jan 2014
    Posts
    2
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: Qprocess and mpi not finishing

    Ok i was a bit frustrated ... and you are right 2009 to 2014 is a bit less than 6 years !

    The solution i found is to use the command "system" rather than qprocess

    My first idea was to use QProcess like this :
    QProcess process;
    process.setWorkingDirectory( "xxxx" );
    process.setProcessChannelMode(QProcess::MergedChan nels);
    process.setStandardOutputFile("logfile");
    process.start(commandProcess,argumentsProcess);
    process.waitForFinished(-1);

    But as i mentionned, the qprocess never sends a finish signal (why, this is the question and that's maybe mpiexec problem ??)

    Solution i did is (using command system) :
    QString command = commandProcess+" "+argumentsProcess.join(" ")+ " > "+logProcessFilePath;
    command = QDir::toNativeSeparators(command);
    command.replace(":\\",":\\\\");
    int returnCode = system(command.toStdString().c_str());

  6. #6
    Join Date
    Apr 2016
    Posts
    1
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Re: Qprocess and mpi not finishing

    I am sorry to post in a very old thread, but I figured that it might help others looking for an answer in a search engine...

    I just had the very same problem, which might be due to this bug, at least according to my research.
    According to that message, OpenMPI is catching the SIGCHLD signal, which is necessary for QProcess "finished" signal to work correctly (and thus for QProcess::waitForFinished()).

    The message says that this was changed in OpenMPI series 1.6 and 1.7.
    As of today, the latest Ubuntu 15.10 ships with OpenMPI 1.6.5, which apparently is still affected by this (mis-)behaviour.

    Upgrading to a later OpenMPI version should therefore fix the problem.
    I did this by installing OpenMPI 1.10.2 from source, which is very easily done by following these instructions, and I can confirm that the problem is solved.

    Hope this helps...

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.