Tuesday, September 12, 2006

Identify processor with share memory

Subject: Identify processor with share memory
Previous thread Next thread: None Close
Reply Quote Download
Message no. 280
Author: Luis Gabriel Jaimes (luis_gj)
Date: Friday, October 28, 2005 10:38am

I had worked some time ego in a cluster, now I have machine with 8 processor with
share memory, but I am confuising in some things for example:
In a cluster a program like this:
#include
#include

int main(int argc, char *argv[])
{
char nombre[100];
int rank, size, len;

MPI_Init(&argc, &argv);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Comm_size(MPI_COMM_WORLD, &size);

MPI_Get_processor_name(nombre, &len);
printf("The processes %d/%d is on the machine %s\n", rank, size, nombre);
MPI_Finalize();
return 0;
}

answer:
The processes 0/2 is on the machine penguin1.uprh.edu
The processes 1/2 is on the machine penguin2.uprh.edu

This answer let me know that each processes run on a differnet processor, because each
machine penguin1 an penguin2 have their own processors.

But know, how I don't now if every process run on a diferent processor?

The answer now is:
The processes 0/2 is on the machine mymachine.uprh.edu
The processes 1/2 is on the machine mymachine.uprh.edu

the question is how to identify the processor in machine with share memory?
Thanks.

Reply Quote Download
Message no. 283
Author: PACS Training Group (MPI)
Date: Monday, October 31, 2005 12:07pm

As you have already figured out the machine name is the same for all
the processors on a shared memory machine. There is one thing you could
try. Use the C system() function to run a Unix command while your
program is running. Have system() run the ps command with the option
that shows which processor a certain process is running on. This is the
how I confirm that the separate MPI processes are actually running on
different processors.

Reply Quote Download
Message no. 313
Author: Ashok Verma (ashokv)
Date: Tuesday, June 6, 2006 9:19am

You can also use popen(). This has one advantage over system() function.
With popen() the output goes to a user declared file, while system()
command sends the output to stdout.

Previous thread Next thread: None Close

No comments: