D
D
Daniil Miroshnichenko2014-04-28 05:57:47
Parallel Computing
Daniil Miroshnichenko, 2014-04-28 05:57:47

MPI. Is everything running on the same thread?

At the university, they set a laboratory for parallelizing a program using OpenMPI. First, I tried to run "Hello World" and judging by the output, everything is running in one process...

int main (int argc, char **argv) {
        int rank, size;
  	MPI_Init (&argc, &argv);	
 	MPI_Comm_rank(MPI_COMM_WORLD, &rank);
 	MPI_Comm_size(MPI_COMM_WORLD, &size);

  	printf( "Hello world from process %d of %d\n", rank, size );
  	MPI_Finalize();
  	
  	return 0;
}

The output to the console is:
Hello world from process 0 of 1
Hello world from process 0 of 1
Hello world from process 0 of 1
Hello world from process 0 of 1
Compile and run with the following commands:
mpicc lab3.c -o lab3
mpirun -np 4 . /lab3
Please tell me what is the problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Daniil Miroshnichenko, 2014-04-29
@miroshnik

Problem solved. The reason was in crooked hands)
At the beginning I installed mpich2 and it didn’t work (although everything started up fine for a friend), then I installed openmpi and it all worked)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question