1

I am using mpiexec to run a couple of hello world executables. They each run, but the number of processes is always 1 where it looks like there should be 4 processes. Does someone understand why? Also I'm not sure why stty is giving me an invalid argument. Thanks!

Here is the output:

   /bin/stty: standard input: invalid argument
   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

Here is the c file:

#include <stdio.h>
#include <mpi.h>

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);
  fflush(stdout);
  MPI_Finalize();
  return 0;
}

Here is the submission script:

#!/bin/bash

#PBS -N helloWorld
#PBS -l select=4:ncpus=2
#PBS -j oe
#PBS -o output
#PBS -l walltime=3:00
cd $PBS_O_WORKDIR


mpiexec ./helloWorld
László Papp
  • 51,870
  • 39
  • 111
  • 135
Steven Wexler
  • 16,589
  • 8
  • 53
  • 80
  • possible duplicate of [MPI\_Rank return same process number for all process](http://stackoverflow.com/questions/20287564/mpi-rank-return-same-process-number-for-all-process) – Jonathan Dursi Jun 16 '14 at 15:32

1 Answers1

4

Steven:

The above should work; it looks like something along the line (PBS <-> MPI library <-> mpiexec) is misconfigured.

The first, most obvious guess -- is the mpiexec the same mpi launching program that corresponds to the library you compiled with? If you do a which mpiexec in your script, do you get something that corresponds to the which mpicc when you compile the program? Do you have to do anything like a "module load [mpi package]" before you compile?

Similarly, is your mpiexec PBS-aware? If not, you might have to specify a hostfile (${PBS_NODEFILE}) somehow, and the number of processors.

What mpi are you using, and what system are you running on -- is it a publically available system with documentation we can look at?

Jonathan Dursi
  • 50,107
  • 9
  • 127
  • 158
  • When I run which mpiexec mpicc I get /usr/bin/mpicc /usr/bin/mpiexec. So that looks good. I'm not sure what a "module load" is. I'm guessing I don't have one? I think the problem may be that my mpiexec isn't PBS aware. I'm not sure how to specify a host file, however. The system I'm running on is private, but the man pages point to this website for documentation: http://www.mcs.anl.gov/mpi/www – Steven Wexler Oct 11 '10 at 18:16
  • Ok. The module load stuff is often used at big computing sites where they have several MPIs installed; you'd know about it if you needed to use it. If you're using OpenMPI (mpiexec -V will give you version information), the syntax is `mpiexec -np 8 --hostfile $PBS_NODEFILE ./helloWorld`. If you're using MPICH2 (mpich2version will give you a bunch of information) the syntax should be `mpiexec -f $PBS_NODEFILE -np 8 ./helloWorld`. See if either of those give better results. – Jonathan Dursi Oct 11 '10 at 19:14
  • when running mpiexec -version i get: Version 0.83, configure options: '--prefix=/usr' '--with-default-comm=mpich2-pmi' '--with-pbs=/usr/pbs' Version 0.83, configure options: '--prefix=/usr' '--with-default-comm=mpich2-pmi' '--with-pbs=/usr/pbs' (when I run mpiexec -V or mpich2version I get nothing. -V is not a recognized tag. mpich2version command is not found. When i 'locate mpich2version' I also get nothing.) Neither command is of the correct syntax. Also, when I echo $PBS_NODEFILE I get nothing. I'm not sure if I should get something. – Steven Wexler Oct 11 '10 at 19:43
  • Great. Ok, so you are running mpich2 (http://www.mcs.anl.gov/research/projects/mpich2/), and it should be pbs-aware. So normally I'd expect it to pick up on the PBS_NODEFILE stuff at runtime, but it obviously isn't. $PBS_NODEFILE is an environment variable set by PBS when the job runs; just typing at the shell it won't be set. So in your pbs script, try a line `echo $PBS_NODEFILE; cat $PBS_NODEFILE` before the mpiexec command, and a `which mpiexec` just to be sure the environment is the same, & run mpiexec specifying everything manually `mpiexec -f $PBS_NODEFILE -np 8 ./helloWorld`. – Jonathan Dursi Oct 11 '10 at 22:42
  • I inserted: echo $PBS_NODEFILE; cat $PBS_NODEFILE mpiexec -f $PBS_NODEFILE -np 8 ./helloWorld I get a syntax error with the -f tag. I also get when using the tag -mpich-p4-noshmem: mpiexec: Warning: parse_args: argument "-mpich-p4-[no-]shmem" ignored since communication library not MPICH/P4. – Steven Wexler Oct 12 '10 at 23:02
  • What did you get for $PBS_NODEFILE output? Was the error due to the -f because of the -f tag (And do you have a which mpiexec in the script itself? I'd still like to confirm that the mpiexec of the script is the same as in the interactive enironment) or because it was followed by -np ( unable to open host file: -np) -- that, is, $PBS_NODEFILE isn't being filled in? – Jonathan Dursi Oct 13 '10 at 10:50
  • From the error message, I suspect you may be running OSU's mpiexec - which is fine, and should be PBS aware,but I think is probably not configured properly with the mpi library you're using. Is there a sysadmin you can talk to about this, or can you rebuild the mpiexec (or just use the mpich2 one?) – Jonathan Dursi Oct 13 '10 at 11:06