lwang-astro / PeTar

PeTar is a high-performance N-body code for modelling the evolution of star clusters and tidal streams, including the effect of galactic potential, dynamics of binary and hierarchical system, single and binary stellar evolution.
MIT License
71 stars 19 forks source link

find.dt: nmpi defaults to 0 when -m is not set; no mpiexec when set -m 0 explicitly #36

Closed kaiwu-astro closed 1 year ago

kaiwu-astro commented 1 year ago

Dear Long,

When I try PeTar on my local workstation, I was in this trouble.

  1. I run it on my single workstation, so I do ./configure --with-mpi=no
  2. When I type petar.find.dt -h, I see this line -m: number of MPI processors (default: 1). And I think, ohh it defaults to 1, so I need to set -m 0 because I did not configure MPI
  3. And then petar.find.dt runs with ... mpiexec -n 0 petar .... Because I did not install mpich or openmpi on my workstation, it stops with error.

Then I go to the code and find this line in tools/find_dt.sh: [ -z $nmpi ] || prefix=$prefix' mpiexec -n '$nmpi, which actually does not set mpiexec when -m is not specified. I think this is a bit in conflict with the help message, which says it defaults to -m 1.

So I open this PR to suggest an update:

  1. when -m 0 is explicitly set, do not apply mpiexec
  2. edit the help message to match the code: by default if -m is not set (mpi is disabled), so I say -m defaults to 0

Hope it helps PeTar users.

Best, Kai Wu [吴开]

lwang-astro commented 1 year ago

Now I have commit a new version with modified help message for -m option

kaiwu-astro commented 1 year ago

Thank you. It is indeed more clear now, although default: A or B sounds a bit ambiguous to me as a new user. Some more explanations here like -m: number of MPI processors (default: if PeTar compiled with MPI: 1 processor; otherwise: without MPI) may better help the user. But nevermind, this version is already better.

lwang-astro commented 1 year ago

I commit a new version. Now I explicitly explain that this option is used for setting "mpiexec -n" and in the default case MPI is not used. -m: number of MPI processors used for "mpiexec -n " (default: MPI is not used)

kaiwu-astro commented 1 year ago

Thank you! This version looks perfect to me.