# mpirun limit on number of processors

**URL:** <https://forums.developer.nvidia.com/t/mpirun-limit-on-number-of-processors/133863>\
**Category:** Legacy PGI Compilers (archived)\
**Created:** [December 12, 2013, 4:34pm UTC](https://forums.developer.nvidia.com/t/mpirun-limit-on-number-of-processors/133863 "2013-12-12T16:34:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Larry\_Young](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@Larry\_Young](https://forums.developer.nvidia.com/u/Larry_Young)\
**Post date:** [December 12, 2013, 4:34pm UTC](https://forums.developer.nvidia.com/t/mpirun-limit-on-number-of-processors/133863/1 "2013-12-12T16:34:43Z")

</div>

I am using the CDK on Linux redhat 5.9.

When I execute mpirun -np 3 mpihello (compiled in C++ with mpich1) it works fine.

Any number of processors about 3 results in a hang up and I have to terminate the mpirun command. I can see that each processor is getting contacted (by the splash screen info we have) but none of the outputs I have are being executed.

Any suggestions?

---

<div class="post-metadata">

**Author:** ![MatColgrove](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/matcolgrove/32/14047_2.png) [@MatColgrove](https://forums.developer.nvidia.com/u/MatColgrove)\
**Post date:** [December 12, 2013, 5:30pm UTC](https://forums.developer.nvidia.com/t/mpirun-limit-on-number-of-processors/133863/2 "2013-12-12T17:30:00Z")

</div>

Hi Larry,

There’s no limit on the number of MPI process you can use.

Has this program working in the past? My first guess is that there’s program error where the processes are blocked at some synchronization point (like a SEND/RECIEVE).

Try running your program in the PGI Debugger, PGDBG (See Chapter 11 of [PGDBG User’s Guide](https://www.pgroup.com/doc/pgdbgug.pdf) for details), and see where the hang occurs.

Also, are all the processes on the same node? If not, could there be a network issue or a problem with one of the nodes?

- Mat

---

<div class="post-metadata">

**Author:** ![Larry\_Young](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@Larry\_Young](https://forums.developer.nvidia.com/u/Larry_Young)\
**Post date:** [December 12, 2013, 6:28pm UTC](https://forums.developer.nvidia.com/t/mpirun-limit-on-number-of-processors/133863/3 "2013-12-12T18:28:11Z")

</div>

It has worked in the past.

The program hangs at MPI\_Init.

Here is the code:  
int main(int argc, char \*argv)  
{  
int numproc=1; // number of processors in group  
int rank=0; // rank of calling process  
int rc = 0; // return variable for MPI\_INIT

rc= MPI\_Init(&argc,&argv);  
if (rc != 0 )  
{  
cout \<\<" Error starting MPI program. Terminating. " \<\< endl;  
MPI\_Abort(MPI\_COMM\_WORLD, rc);  
}

//Function which gives the rank of each process (ID)  
rc = MPI\_Comm\_rank(MPI\_COMM\_WORLD, &rank);  
if (rc != 0 )  
{  
cout \<\< "Error at Comm\_rank. " \<\< endl;  
}

//Function which indicates the number of processes  
rc = MPI\_Comm\_size(MPI\_COMM\_WORLD, &numproc);  
if (rc != 0 )  
{  
cout \<\< "Error at Comm\_size. " \<\< endl;  
}

int namelen;  
char processor\_name[256];  
MPI\_Get\_processor\_name(processor\_name, &namelen);  
  
  
cout \<\< “Hello! - P” \<\< rank \<\< " Processor " \<\< processor\_name \<\< endl;

rc = MPI\_Finalize();

return 0;  
}

---

<div class="post-metadata">

**Author:** ![MatColgrove](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/matcolgrove/32/14047_2.png) [@MatColgrove](https://forums.developer.nvidia.com/u/MatColgrove)\
**Post date:** [December 12, 2013, 7:18pm UTC](https://forums.developer.nvidia.com/t/mpirun-limit-on-number-of-processors/133863/4 "2013-12-12T19:18:54Z")

</div>

Hi Larry,

It works for me. What’s changed between the last time you built/ran the program? Are you using a single or multiple nodes? What version of the CDK are you using? What flags are you using?

- Mat
