<li>Px,Py,Pz = # of processors in each dimension of 3d grid overlaying the simulation domain</li>
<li>zero or more keyword/arg pairs may be appended</li>
<li>keyword = <em>grid</em> or <em>map</em> or <em>part</em> or <em>file</em></li>
</ul>
<preclass="literal-block">
<em>grid</em> arg = gstyle params ...
gstyle = <em>onelevel</em> or <em>twolevel</em> or <em>numa</em> or <em>custom</em>
onelevel params = none
twolevel params = Nc Cx Cy Cz
Nc = number of cores per node
Cx,Cy,Cz = # of cores in each dimension of 3d sub-grid assigned to each node
numa params = none
custom params = infile
infile = file containing grid layout
<em>map</em> arg = <em>cart</em> or <em>cart/reorder</em> or <em>xyz</em> or <em>xzy</em> or <em>yxz</em> or <em>yzx</em> or <em>zxy</em> or <em>zyx</em>
cart = use MPI_Cart() methods to map processors to 3d grid with reorder = 0
cart/reorder = use MPI_Cart() methods to map processors to 3d grid with reorder = 1
xyz,xzy,yxz,yzx,zxy,zyx = map procesors to 3d grid in IJK ordering
<em>numa</em> arg = none
<em>part</em> args = Psend Precv cstyle
Psend = partition # (1 to Np) which will send its processor layout
Precv = partition # (1 to Np) which will recv the processor layout
cstyle = <em>multiple</em>
<em>multiple</em> = Psend grid will be multiple of Precv grid in each dimension
<em>file</em> arg = outfile
outfile = name of file to write 3d grid of processors to
<p>Specify how processors are mapped as a regular 3d grid to the global
simulation box. The mapping involves 2 steps. First if there are P
processors it means choosing a factorization P = Px by Py by Pz so
that there are Px processors in the x dimension, and similarly for the
y and z dimensions. Second, the P processors are mapped to the
regular 3d grid. The arguments to this command control each of these
2 steps.</p>
<p>The Px, Py, Pz parameters affect the factorization. Any of the 3
parameters can be specified with an asterisk “*”, which means LAMMPS
will choose the number of processors in that dimension of the grid.
It will do this based on the size and shape of the global simulation
box so as to minimize the surface-to-volume ratio of each processor’s
sub-domain.</p>
<p>Choosing explicit values for Px or Py or Pz can be used to override
the default manner in which LAMMPS will create the regular 3d grid of
processors, if it is known to be sub-optimal for a particular problem.
E.g. a problem where the extent of atoms will change dramatically in a
particular dimension over the course of the simulation.</p>
<p>The product of Px, Py, Pz must equal P, the total # of processors
LAMMPS is running on. For a <aclass="reference internal"href="dimension.html"><spanclass="doc">2d simulation</span></a>, Pz must
equal 1.</p>
<p>Note that if you run on a prime number of processors P, then a grid
such as 1 x P x 1 will be required, which may incur extra
communication costs due to the high surface area of each processor’s
sub-domain.</p>
<p>Also note that if multiple partitions are being used then P is the
number of processors in this partition; see <aclass="reference internal"href="Section_start.html#start-7"><spanclass="std std-ref">this section</span></a> for an explanation of the
-partition command-line switch. Also note that you can prefix the
processors command with the <aclass="reference internal"href="partition.html"><spanclass="doc">partition</span></a> command to
easily specify different Px,Py,Pz values for different partitions.</p>
<p>You can use the <aclass="reference internal"href="partition.html"><spanclass="doc">partition</span></a> command to specify
different processor grids for different partitions, e.g.</p>
<pclass="last">This command only affects the initial regular 3d grid created
when the simulation box is first specified via a
<aclass="reference internal"href="create_box.html"><spanclass="doc">create_box</span></a> or <aclass="reference internal"href="read_data.html"><spanclass="doc">read_data</span></a> or
<aclass="reference internal"href="read_restart.html"><spanclass="doc">read_restart</span></a> command. Or if the simulation box is
re-created via the <aclass="reference internal"href="replicate.html"><spanclass="doc">replicate</span></a> command. The same
regular grid is initially created, regardless of which
<aclass="reference internal"href="comm_style.html"><spanclass="doc">comm_style</span></a> command is in effect.</p>
</div>
<p>If load-balancing is never invoked via the <aclass="reference internal"href="balance.html"><spanclass="doc">balance</span></a> or
<aclass="reference internal"href="fix_balance.html"><spanclass="doc">fix balance</span></a> commands, then the initial regular grid
will persist for all simulations. If balancing is performed, some of
the methods invoked by those commands retain the logical toplogy of
the initial 3d grid, and the mapping of processors to the grid
specified by the processors command. However the grid spacings in
different dimensions may change, so that processors own sub-domains of
different sizes. If the <aclass="reference internal"href="comm_style.html"><spanclass="doc">comm_style tiled</span></a> command is
used, methods invoked by the balancing commands may discard the 3d
grid of processors and tile the simulation domain with sub-domains of
different sizes and shapes which no longer have a logical 3d
connectivity. If that occurs, all the information specified by the
processors command is ignored.</p>
<hrclass="docutils"/>
<p>The <em>grid</em> keyword affects the factorization of P into Px,Py,Pz and it
can also affect how the P processor IDs are mapped to the 3d grid of
processors.</p>
<p>The <em>onelevel</em> style creates a 3d grid that is compatible with the
Px,Py,Pz settings, and which minimizes the surface-to-volume ratio of
each processor’s sub-domain, as described above. The mapping of
processors to the grid is determined by the <em>map</em> keyword setting.</p>
<p>The <em>twolevel</em> style can be used on machines with multicore nodes to
minimize off-node communication. It insures that contiguous
sub-sections of the 3d grid are assigned to all the cores of a node.
For example if <em>Nc</em> is 4, then 2x2x1 or 2x1x2 or 1x2x2 sub-sections of
the 3d grid will correspond to the cores of each node. This affects
both the factorization and mapping steps.</p>
<p>The <em>Cx</em>, <em>Cy</em>, <em>Cz</em> settings are similar to the <em>Px</em>, <em>Py</em>, <em>Pz</em>
settings, only their product should equal <em>Nc</em>. Any of the 3
parameters can be specified with an asterisk “*”, which means LAMMPS
will choose the number of cores in that dimension of the node’s
sub-grid. As with Px,Py,Pz, it will do this based on the size and
shape of the global simulation box so as to minimize the
surface-to-volume ratio of each processor’s sub-domain.</p>
<divclass="admonition note">
<pclass="first admonition-title">Note</p>
<pclass="last">For the <em>twolevel</em> style to work correctly, it assumes the MPI
ranks of processors LAMMPS is running on are ordered by core and then
by node. E.g. if you are running on 2 quad-core nodes, for a total of
8 processors, then it assumes processors 0,1,2,3 are on node 1, and
processors 4,5,6,7 are on node 2. This is the default rank ordering
for most MPI implementations, but some MPIs provide options for this
ordering, e.g. via environment variable settings.</p>
</div>
<p>The <em>numa</em> style operates similar to the <em>twolevel</em> keyword except
that it auto-detects which cores are running on which nodes.
Currently, it does this in only 2 levels, but it may be extended in
the future to account for socket topology and other non-uniform memory
access (NUMA) costs. It also uses a different algorithm than the
<em>twolevel</em> keyword for doing the two-level factorization of the
simulation box into a 3d processor grid to minimize off-node
communication, and it does its own MPI-based mapping of nodes and
cores to the regular 3d grid. Thus it may produce a different layout
of the processors than the <em>twolevel</em> options.</p>
<p>The <em>numa</em> style will give an error if the number of MPI processes is
not divisible by the number of cores used per node, or any of the Px
or Py of Pz values is greater than 1.</p>
<divclass="admonition note">
<pclass="first admonition-title">Note</p>
<pclass="last">Unlike the <em>twolevel</em> style, the <em>numa</em> style does not require
any particular ordering of MPI ranks i norder to work correctly. This
is because it auto-detects which processes are running on which nodes.</p>
</div>
<p>The <em>custom</em> style uses the file <em>infile</em> to define both the 3d
factorization and the mapping of processors to the grid.</p>
<p>The file should have the following format. Any number of initial
blank or comment lines (starting with a “#” character) can be present.
<p>Note that, in principle, an MPI implementation on a particular machine
should be aware of both the machine’s network topology and the
specific subset of processors and nodes that were assigned to your
simulation. Thus its MPI_Cart calls can optimize the assignment of
MPI processes to the 3d grid to minimize communication costs. In
practice, however, few if any MPI implementations actually do this.
So it is likely that the <em>cart</em> and <em>cart/reorder</em> styles simply give
the same result as one of the IJK styles.</p>
<p>Also note, that for the <em>twolevel</em> grid style, the <em>map</em> setting is
used to first map the nodes to the 3d grid, then again to the cores
within each node. For the latter step, the <em>cart</em> and <em>cart/reorder</em>
styles are not supported, so an <em>xyz</em> style is used in their place.</p>
<hrclass="docutils"/>
<p>The <em>part</em> keyword affects the factorization of P into Px,Py,Pz.</p>
<p>It can be useful when running in multi-partition mode, e.g. with the
<aclass="reference internal"href="run_style.html"><spanclass="doc">run_style verlet/split</span></a> command. It specifies a
dependency bewteen a sending partition <em>Psend</em> and a receiving
partition <em>Precv</em> which is enforced when each is setting up their own
mapping of their processors to the simulation box. Each of <em>Psend</em>
and <em>Precv</em> must be integers from 1 to Np, where Np is the number of
partitions you have defined via the <aclass="reference internal"href="Section_start.html#start-7"><spanclass="std std-ref">-partition command-line switch</span></a>.</p>
<p>A “dependency” means that the sending partition will create its
regular 3d grid as Px by Py by Pz and after it has done this, it will
send the Px,Py,Pz values to the receiving partition. The receiving
partition will wait to receive these values before creating its own
regular 3d grid and will use the sender’s Px,Py,Pz values as a
constraint. The nature of the constraint is determined by the
<em>cstyle</em> argument.</p>
<p>For a <em>cstyle</em> of <em>multiple</em>, each dimension of the sender’s processor
grid is required to be an integer multiple of the corresponding
dimension in the receiver’s processor grid. This is a requirement of
the <aclass="reference internal"href="run_style.html"><spanclass="doc">run_style verlet/split</span></a> command.</p>
<p>For example, assume the sending partition creates a 4x6x10 grid = 240
processor grid. If the receiving partition is running on 80
processors, it could create a 4x2x10 grid, but it will not create a
2x4x10 grid, since in the y-dimension, 6 is not an integer multiple of
4.</p>
<divclass="admonition note">
<pclass="first admonition-title">Note</p>
<pclass="last">If you use the <aclass="reference internal"href="partition.html"><spanclass="doc">partition</span></a> command to invoke
different “processsors” commands on different partitions, and you also
use the <em>part</em> keyword, then you must insure that both the sending and
receiving partitions invoke the “processors” command that connects the
2 partitions via the <em>part</em> keyword. LAMMPS cannot easily check for
this, but your simulation will likely hang in its setup phase if this
error has been made.</p>
</div>
<hrclass="docutils"/>
<p>The <em>file</em> keyword writes the mapping of the factorization of P
processors and their mapping to the 3d grid to the specified file
<em>outfile</em>. This is useful to check that you assigned physical
processors in the manner you desired, which can be tricky to figure
out, especially when running on multiple partitions or on, a multicore
machine or when the processor ranks were reordered by use of the
<aclass="reference internal"href="Section_start.html#start-7"><spanclass="std std-ref">-reorder command-line switch</span></a> or due to
use of MPI-specific launch options such as a config file.</p>
<p>If you have multiple partitions you should insure that each one writes
to a different file, e.g. using a <aclass="reference internal"href="variable.html"><spanclass="doc">world-style variable</span></a>
for the filename. The file has a self-explanatory header, followed by
one-line per processor in this format:</p>
<p>world-ID universe-ID original-ID: I J K: name</p>
<p>The IDs are the processor’s rank in this simulation (the world), the
universe (of multiple simulations), and the original MPI communicator
used to instantiate LAMMPS, respectively. The world and universe IDs
will only be different if you are running on more than one partition;
see the <aclass="reference internal"href="Section_start.html#start-7"><spanclass="std std-ref">-partition command-line switch</span></a>.
The universe and original IDs will only be different if you used the
<aclass="reference internal"href="Section_start.html#start-7"><spanclass="std std-ref">-reorder command-line switch</span></a> to reorder
the processors differently than their rank in the original
communicator LAMMPS was instantiated with.</p>
<p>I,J,K are the indices of the processor in the regular 3d grid, each
from 1 to Nd, where Nd is the number of processors in that dimension
of the grid.</p>
<p>The <em>name</em> is what is returned by a call to MPI_Get_processor_name()
and should represent an identifier relevant to the physical processors
in your machine. Note that depending on the MPI implementation,
multiple cores can have the same <em>name</em>.</p>
</div>
<hrclass="docutils"/>
<divclass="section"id="restrictions">
<h2>Restrictions</h2>
<p>This command cannot be used after the simulation box is defined by a
<aclass="reference internal"href="read_data.html"><spanclass="doc">read_data</span></a> or <aclass="reference internal"href="create_box.html"><spanclass="doc">create_box</span></a> command.
It can be used before a restart file is read to change the 3d
processor grid from what is specified in the restart file.</p>
<p>The <em>grid numa</em> keyword only currently works with the <em>map cart</em>
option.</p>
<p>The <em>part</em> keyword (for the receiving partition) only works with the
<em>grid onelevel</em> or <em>grid twolevel</em> options.</p>
Built with <ahref="http://sphinx-doc.org/">Sphinx</a> using a <ahref="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <ahref="https://readthedocs.org">Read the Docs</a>.