Eye RCS 51 wrote:

Hi,

In an effort to make a Qt gui using MPI, I have the following:

1. Gui started in master node.

2. In Gui, through a pushbutton, a global variable x is assigned some value; let say, x=1000;

3. I want this value to be know to all nodes. So I used broadcast in the function assigning it on the master node and all other nodes.

4. I printed values of x, which prints all 1000 in all nodes.

5. Now control has reached to MPI_Finalize in all nodes except master.

Now If I want to reassign value of x using pushbutton in master node and again broadcast to and print in all nodes, can it be done??

Not with MPI if MPI_Finalize has been called.

I mean, can I have an MPI function which through GUI is called many times and assigns and prints WHILE program is running.

You can call an MPI function like MPI_Bcast many times.  E.g.,

MPI_Init();
MPI_Comm_rank(...,&myrank);
while (...) {
  if ( myrank == MASTER ) x = ...;
  MPI_Bcast(&x,...);
}
MPI_Finalize();

There are many helpful MPI tutorials that can be found on the internet.


OR simply can I have a print function which is printing noderank value in all nodes whenever pushbutton is pressed while program is running.

command i used is "mpirun -np 3 ./a.out".

Reply via email to