LAMMPS WWW Site - LAMMPS Documentation - LAMMPS Commands

### fix gpu command

Syntax:

    fix ID group-ID gpu mode first last split

- ID, group-ID are documented in fix command
- gpu = style name of this fix command
- mode = force or force/neigh
- first = ID of first GPU to be used on each node
- last = ID of last GPU to be used on each node
- split = fraction of particles assigned to the GPU

Examples:

    fix 0 all gpu force 0 0 1.0
    fix 0 all gpu force 0 0 0.75
    fix 0 all gpu force/neigh 0 0 1.0
    fix 0 all gpu force/neigh 0 1 -1.0

Description:

Select and initialize GPUs to be used for acceleration and configure GPU acceleration in LAMMPS. This fix is required in order to use any style with GPU acceleration. The fix must be the first fix specified for a run or an error will be generated. The fix will not have an effect on any LAMMPS computations that do not use GPU acceleration, so there should not be any problems with specifying this fix first in input scripts.

mode specifies where neighbor list calculations will be performed. If mode is force, neighbor list calculation is performed on the CPU. If mode is force/neigh, neighbor list calculation is performed on the GPU. GPU neighbor list calculation currently cannot be used with a triclinic box. GPU neighbor list calculation currently cannot be used with hybrid pair styles. GPU neighbor lists are not compatible with styles that are not GPU-enabled. When a non-GPU enabled style requires a neighbor list, it will also be built using CPU routines. In these cases, it will typically be more efficient to only use CPU neighbor list builds.

first and last specify the GPUs that will be used for simulation. On each node, the GPU IDs in the inclusive range from first to last will be used.

split can be used for load balancing force calculation work between CPU and GPU cores in GPU-enabled pair styles. If 0<split<1.0, a fixed fraction of particles is offloaded to the GPU while force calculation for the other particles occurs simulataneously on the CPU. If split<0, the optimal fraction (based on CPU and GPU timings) is calculated every 25 timesteps. If split=1.0, all force calculations for GPU accelerated pair styles are performed on the GPU. In this case, hybrid, bond, angle, dihedral, improper, and long-range calculations can be performed on the CPU while the GPU is performing force calculations for the GPU-enabled pair style.

In order to use GPU acceleration, a GPU enabled style must be selected in the input script in addition to this fix. Currently, this is limited to a few pair styles and the PPPM kspace style.

More details about these settings and various possible hardware configuration are in this section of the manual.

Restart, fix_modify, output, run start/stop, minimize info:

No information about this fix is written to binary restart files. None of the fix_modify options are relevant to this fix.

No parameter of this fix can be used with the start/stop keywords of the run command.

Restrictions:

The fix must be the first fix specified for a given run. The force/neigh mode should not be used with a triclinic box or hybrid pair styles.

split must be positive when using hybrid pair styles.

Currently, group-ID must be all.

Related commands: none

Default: none