[mpich-discuss] MPICH2 + QT4 Try to run GUI program on several hosts

Андрей Лопатин andrei.lav at mail.ru
Fri Apr 18 20:06:59 CDT 2008


Hi.

There is program code (main.cpp):

#include <QApplication>
#include <QtGui>
#include <QTextCodec>
#include "mainwindow.h"
#include "ui_Login.h"
#include <stdio.h>

#undef SEEK_SET
#undef SEEK_END
#undef SEEK_CUR

#include "mpi.h"
//

void loadModules(QSplashScreen* psplash)
{
   ///
}

int main(int argc, char ** argv)
{
	
	fprintf(stdout,"start1 ");
	int rank,size;
	
	MPI_Init(&argc,&argv);
	
	MPI_Comm_size(MPI_COMM_WORLD,&size);
	MPI_Comm_rank(MPI_COMM_WORLD,&rank);
	fprintf(stdout,"start2  ");
	
	if(rank==0){
	QApplication app( argc, argv );
	QTextCodec *codec = QTextCodec::codecForName("utf8");
	QTextCodec::setCodecForTr(codec);
	fprintf(stdout,"QT Main");
    fprintf(stdout,"QT: %d of %d ", rank, size);
	QSplashScreen *splash = new QSplashScreen;
	splash->setPixmap(QPixmap("images/mysplash.png"));
	splash->show();
	splash->showMessage(QMainWindow::tr(""));
	MainWindow win;
	loadModules(splash);
	splash->finish(&win);
	win.show(); 
	app.connect( &app, SIGNAL( lastWindowClosed() ), &app, SLOT( quit() ) );
	return app.exec();
	}
	else{
		fprintf(stdout,"not main");
	}
	 fprintf(stdout,"I'm OK");
	 MPI_Finalize();
	 return 0;
} 

Andrey.




More information about the mpich-discuss mailing list