Unsolved Can not open a xml with QFile in a MPI environment
-
I made a xml file as input file for fortran MPI app. Since fortran does not have a parser for xml file, I made a C interface for my fortran code to load the XML file. The interface works fine for node number is 1. If I increase the node number to more than one, the QFile can not open the XML file any more. It fails at QFile file(file_name); file.open() returns false; Any comments? Thanks.
-
The problem is gone when I recompiled the code. It is odd.
-
I compiled the code a few more times. The problem comes back. The file does exist since my MPI code runs fine with one node option. It is so weird.
The error message is no such file or directory and
QFileDevice error code is 5 -
@JoeCFD
It is simply impossible forQFile file(file_name); file.open();
to "fail" depending on what the content of the file is or is not.Who knows what is inside your C code? Look through it. Just maybe you leave the file open and that prevents a second open in your environment, I don't know.
-
@JonB Thanks for your reply. If I run the same code with one node mpirun -np 1 myapp, it runs immediately without any problem. If I execute it with mpirun -np 2 myapp, it fails right away becuase of the error above. And the C interface is called only in node 1. The code worked before sometimes, but not all the times.
-
@JoeCFD
Only you know whatever it is your code does. The code hasn't even got as far as doing any XML stuff when you gofile.open()
. -
@JonB right. I just rebooted my computer. My code works fine with 3 nodes. I am testing the code and stop it often. Is it possible that MPI resources are not cleaned up completely?
-
@JoeCFD QFile really doesn't care what is inside your file, whether it is XML and has one or two nodes, or whether it is something else. If it can't open the file, then most obvious reasons are: wrong path and missing access rights.
What could be the problem hereQFile file(file_name);
Does file_name contain only file name or absolute path to the file?
If it is only the file name then QFile will try to open this file from the current working directory. And if it is not there then it will fail. -
The input file is same for one node or two nodes run. I do not change the path and file name of the input file(file_name). If I type mpurun -np 1 myapp, my code runs fine. If I type mpirun -np 2 myapp on the same terminal, the input file can not be found. Nothig has been changed here. I tried both with and without absolute path.
-
@JoeCFD then it is something in your app...
Just debug -
agree. But the bug is odd.
-
The problem is solved after Qt plugin/platforms is copied to the dir of myapp. Some other people could hit this problem in the future. When Qt code has some weird behavior, try this copy
-
@JoeCFD Yes, if you want to use your app outside of QtCreator you need to deploy it.
Take a look at http://doc.qt.io/qt-5/deployment.html -
Sorry I have to reopen this case. Copy platforms to the dir of myapp does help a bit. However,the problem comes back after I tested my code for some time on any computer. I tried to compile the Qt code with mpicxx and it does not help either. I use QProcess from GUI to launch MPI myapp.