It looks like you're just hosting the hostname of the machine. That
doesn't imply anything about which core/processor the actual MPI
process is running on.
You've told LAM to launch 2 processes on your machine (because you
listed the hostname twice in the hostfile and then launched with -np
2), and it did.
You need a program like htop (see http://htop.sf.net/) to determine
which core each process is running on.
FWIW, Open MPI has explicit processor affinity controls -- LAM/MPI
does not.
On Jul 7, 2009, at 4:32 PM, Rahul Nabar wrote:
> On Sun, Jul 5, 2009 at 7:10 AM, Jeff Squyres<jsquyres_at_[hidden]>
> wrote:
> > How did you determine that both processes are staying on a single
> core?
>
> I was using this very simple mpi code in C. It prints only the same
> cpu but twice. On "correctly running" machines it loops over all cpus.
>
> ##################################
>
> #include "stdio.h"
> #include <stdlib.h>
>
> #include <mpi.h>
> int main(int argc, char *argv[])
> {
> int tid,nthreads;
> char *cpu_name, fn[512];
> FILE *fid;
>
> /* add in MPI startup routines */
> /* 1st: launch the MPI processes on each node */
> MPI_Init(&argc,&argv);
>
> /* 2nd: request a thread id, sometimes called a "rank" from
> the MPI master process, which has rank or tid == 0
> */
> MPI_Comm_rank(MPI_COMM_WORLD, &tid);
>
> /* 3rd: this is often useful, get the number of threads
> or processes launched by MPI, this should be NCPUs-1
> */
> MPI_Comm_size(MPI_COMM_WORLD, &nthreads);
>
> /* on EVERY process, allocate space for the machine name */
> cpu_name = (char *)calloc(80,sizeof(char));
>
> /* get the machine name of this particular host ... well
> at least the first 80 characters of it ... */
> gethostname(cpu_name,80);
> sprintf(fn, "%s.log", argv[0]);
> fid = fopen(fn, "w");
> if(fid==NULL)
> { exit(1);
> }
>
>
> fprintf(stdout, "hello MPI user: from process = %i on machine=%s, of
> NCPU=%i processors\n",
> tid, cpu_name, nthreads);
> MPI_Finalize();
> return(0);
>
> ###############################################################################
>
--
Jeff Squyres
Cisco Systems
|