PDA

View Full Version : Qt + MPI



zeeb100
12th February 2009, 16:27
Hi guy i have a question
can i use Qt creator and library of Open-MPI ???:confused:

talk2amulya
12th February 2009, 17:34
why would u wanna use QT creator for open MPI..does it have any QT connection? if not anything else, its at least a C++ editor i think

zeeb100
12th February 2009, 17:42
i do a program for my thesis

i make it in c++ for the interface i use qt and now the teacher saying me for operation in parallel use MPI ....

talk2amulya
12th February 2009, 18:21
well, QT creator should be usable for that purpose, u'll be programming rest in C++, u'd just hv to add ur open mpi libraries in the project settings and all..usual c++ stuff

zeeb100
12th February 2009, 23:40
thank for all :)

zeeb100
13th February 2009, 14:20
ok ... now i install MPI ...

how to configure qtcreator for compile my file the example is:



#include "mpi.h"
#include <iostream>

int main(int argc, char **argv)
{
int rank, size;

MPI::Init();
rank = MPI::COMM_WORLD.Get_rank();
size = MPI::COMM_WORLD.Get_size();
std::cout << "Hello, world! I am " << rank << " of " << size << std::endl;
MPI::Finalize();

return 0;
}

talk2amulya
13th February 2009, 14:24
u should include the corresponding paths of include directories and the lib directories in the project to resolve all linking issues

zeeb100
13th February 2009, 14:51
i write in my project.pro this



LIBS += -L/usr/lib/openmpi/

INCLUDEPATH += /usr/include/openmpi/ompi/mpi/cxx


but don't work ... sorry for my low capacity :(

i read that for compiling mpi program the command is...




shell$ mpic++ hello.cpp



but in qt:confused:

talk2amulya
13th February 2009, 17:17
does that mean mpi uses a different compiler??if so, then u'll have to make some changes in the makefile of ur project

zeeb100
13th February 2009, 17:28
can i compile file1.cpp use MPI library and file2.cpp use Qt library and merge file1.o and file2.o in compiling???


and you can help me to configure the section qmake of qCreator to do this... ???

sorry for my english :)

fullmetalcoder
14th February 2009, 12:18
This page explains what OpenMPI requires : http://www.open-mpi.org/faq/?category=mpi-apps

And qmake docs (http://doc.trolltech.com/4.4/qmake-manual.html) will show you how to get it working in a qmake project file.

I see two possible (and hopefully simple) ways of getting this to work :

* changing the compiler (recommended by OpenMPI docs) using QMAKE_CC, QMAKE_CXX variables :

QMAKE_CC = mpicc
QMAKE_CXX = mpic++

* adjusting flags using QMAKE_CFLAGS, QMAKE_CXX_FLAGS and QMAKE_LFLAGS variables :

QMAKE_CC = $$system(mpicc --showme:compile)
QMAKE_CXX = $$system(mpic++ --showme:compile)
QMAKE_LFLAGS = $$system(mpic++ --showme:link)

zeeb100
16th February 2009, 16:48
thanks for help

fullmetalcoder
16th February 2009, 17:04
There is a typo in my previous post (and I cannot edit it anymore...), shouldn't be hard to figure out how to correct it but just in case :

QMAKE_CFLAGS = $$system(mpicc --showme:compile)
QMAKE_CXXFLAGS = $$system(mpic++ --showme:compile)
QMAKE_LFLAGS = $$system(mpic++ --showme:link)

zeeb100
16th February 2009, 21:54
i do it thanks

wjxylazypig
15th January 2011, 14:08
i have add my open mpi libraries in the project settings ,but i have got the message: mpi.h , no such file or directory, who can help me ?

wysota
16th January 2011, 10:14
How did you add the libraries to the project settings?

SixDegrees
16th January 2011, 14:47
Also, where did you install mpi? If you look on your include path and can't find mpi.h yourself, you may have installed it somewhere else.