<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Hi Maksim,  in Intel® MPI Library</title>
    <link>https://community.intel.com/t5/Intel-MPI-Library/MPI-spawn-placement-of-processes/m-p/1126868#M5559</link>
    <description>&lt;P&gt;Hi Maksim,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the reply - where have you found the standard list of mpi_info keys for Intel mpi? I couldn't find it (add-hostfile is an openmpi key, which I was trying).&lt;/P&gt;&lt;P&gt;Cheers!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 12 Apr 2019 08:58:15 GMT</pubDate>
    <dc:creator>O_Rourke__Conn</dc:creator>
    <dc:date>2019-04-12T08:58:15Z</dc:date>
    <item>
      <title>MPI spawn placement of processes</title>
      <link>https://community.intel.com/t5/Intel-MPI-Library/MPI-spawn-placement-of-processes/m-p/1126866#M5557</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;I am trying to spawn processes across nodes using intel mpi with the following code:&lt;/P&gt;&lt;P&gt;testmanager.py:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE class="brush:python; class-name:dark;"&gt;from mpi4py import MPI
import mpi4py
import sys
import argparse
import os
import distutils.spawn

def check_mpi():
    mpiexec_path, _ = os.path.split(distutils.spawn.find_executable("mpiexec"))
    for executable, path in mpi4py.get_config().items():
        if executable not in ['mpicc', 'mpicxx', 'mpif77', 'mpif90', 'mpifort']:
             continue
        if mpiexec_path not in path:
             raise ImportError("mpi4py may not be configured against the same version of 'mpiexec' that you are using. The 'mpiexec' path is {mpiexec_path} and mpi4py.get_config() returns:\n{mpi4py_config}\n".format(mpiexec_path=mpiexec_path, mpi4py_config=mpi4py.get_config()))
#        if 'Open MPI' not in MPI.get_vendor():
#           raise ImportError("mpi4py must have been installed against Open MPI in order for StructOpt to function correctly.")
        vendor_number = ".".join([str(x) for x in MPI.get_vendor()[1]])
        if vendor_number not in mpiexec_path:
           print(MPI.get_vendor(), mpiexec_path)
        print(MPI.get_vendor(), mpiexec_path)

           #raise ImportError("The MPI version that mpi4py was compiled against does not match the version of 'mpiexec'. mpi4py's version number is {}, and mpiexec's path is {}".format(MPI.get_vendor(), mpiexec_path))



def main():
#    parser = argparse.ArgumentParser()
#    parser.add_argument('worker_count', type=int)
    worker_count = 20
#    args = parser.parse_args()
    check_mpi()
    mpi_info = MPI.Info.Create()
    mpi_info.Set("add-hostfile", "slurm.hosts")
    mpi_info.Set("host", "slurm.hosts")

    #print("about to spawn")
    comm = MPI.COMM_SELF.Spawn(sys.executable,
                               args=['testworker.py'], maxprocs=worker_count,
                               info=mpi_info).Merge()
    process_rank = comm.Get_rank()
    process_count = comm.Get_size()
    process_host = MPI.Get_processor_name()
    print('manager',process_rank, process_count, process_host)

main()
&lt;/PRE&gt;

&lt;P&gt;testworker.py:&lt;/P&gt;

&lt;PRE class="brush:python; class-name:dark;"&gt;from mpi4py import MPI

def main():
    print("Spawned")
    comm = MPI.Comm.Get_parent().Merge()

    process_rank = comm.Get_rank()
    process_count = comm.Get_size()
    process_host = MPI.Get_processor_name()

    print('worker', process_rank,process_count,process_host)

main()
&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would like to know how to distribute the spawned processes, as when I run the job as:&lt;/P&gt;
&lt;P&gt;mpirun -hostfile slurm.hosts -np 1 python3 ./testmanager.py&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;with, for example, the following slurm.hosts:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;PRE class="brush:plain; class-name:dark;"&gt;node-105:16
node-114:16
node-127:16
&lt;/PRE&gt;

&lt;P&gt;I end up with the manager running on a single process on node-105, and the workers running on the other nodes. If I increase the number of workers beyond that of the total number of slots in the non-manager nodes then the job hangs. I want to be able to run on all available slots on the three nodes.&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Apr 2019 10:06:11 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-MPI-Library/MPI-spawn-placement-of-processes/m-p/1126866#M5557</guid>
      <dc:creator>O_Rourke__Conn</dc:creator>
      <dc:date>2019-04-11T10:06:11Z</dc:date>
    </item>
    <item>
      <title>mpi_info.Set("add-hostfile",</title>
      <link>https://community.intel.com/t5/Intel-MPI-Library/MPI-spawn-placement-of-processes/m-p/1126867#M5558</link>
      <description>&lt;PRE class="brush:python; class-name:dark;"&gt;mpi_info.Set("add-hostfile", "slurm.hosts")
&lt;/PRE&gt;

&lt;P&gt;is not a standard infokey, and&amp;nbsp;does nothing.&amp;nbsp;&lt;/P&gt;

&lt;PRE class="brush:python; class-name:dark;"&gt;mpi_info.Set("host", "slurm.hosts")&lt;/PRE&gt;

&lt;P&gt;Host infokey is for a hostname or comma-delimited list of them, not a filename. You add a non-existent node "slurm.hosts" and when processes are intended&amp;nbsp;to start on it, you get a hang?&lt;/P&gt;
&lt;P&gt;Normaly,&amp;nbsp;mpirun&amp;nbsp;extracts a node list from SLURM, so you might not need to set that infokey at all.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Apr 2019 07:04:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-MPI-Library/MPI-spawn-placement-of-processes/m-p/1126867#M5558</guid>
      <dc:creator>Maksim_B_Intel</dc:creator>
      <dc:date>2019-04-12T07:04:00Z</dc:date>
    </item>
    <item>
      <title>Hi Maksim, </title>
      <link>https://community.intel.com/t5/Intel-MPI-Library/MPI-spawn-placement-of-processes/m-p/1126868#M5559</link>
      <description>&lt;P&gt;Hi Maksim,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the reply - where have you found the standard list of mpi_info keys for Intel mpi? I couldn't find it (add-hostfile is an openmpi key, which I was trying).&lt;/P&gt;&lt;P&gt;Cheers!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Apr 2019 08:58:15 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-MPI-Library/MPI-spawn-placement-of-processes/m-p/1126868#M5559</guid>
      <dc:creator>O_Rourke__Conn</dc:creator>
      <dc:date>2019-04-12T08:58:15Z</dc:date>
    </item>
  </channel>
</rss>

