File: gpu_extra.h

package info (click to toggle)
lammps 0~20120615.gite442279-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 128,448 kB
  • sloc: cpp: 321,874; fortran: 15,187; ansic: 11,007; python: 7,889; perl: 2,915; sh: 2,088; makefile: 924; f90: 374; objc: 238; lisp: 169; csh: 16; tcl: 6
file content (109 lines) | stat: -rw-r--r-- 3,526 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
/* -*- c++ -*- ----------------------------------------------------------
   LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
   http://lammps.sandia.gov, Sandia National Laboratories
   Steve Plimpton, sjplimp@sandia.gov

   Copyright (2003) Sandia Corporation.  Under the terms of Contract
   DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
   certain rights in this software.  This software is distributed under
   the GNU General Public License.

   See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */

/* ----------------------------------------------------------------------
   Contributing author: Mike Brown (ORNL)
------------------------------------------------------------------------- */

#ifndef LMP_GPU_EXTRA_H
#define LMP_GPU_EXTRA_H

#include "modify.h"
#include "error.h"

namespace GPU_EXTRA {

  inline void check_flag(int error_flag, LAMMPS_NS::Error *error,
                         MPI_Comm &world) {
    int all_success;
    MPI_Allreduce(&error_flag, &all_success, 1, MPI_INT, MPI_MIN, world);
    if (all_success != 0) {
      if (all_success == -1)
        error->all(FLERR,
                   "The package gpu command is required for gpu styles");
      else if (all_success == -2)
        error->all(FLERR,
                   "Could not find/initialize a specified accelerator device");
      else if (all_success == -3)
        error->all(FLERR,"Insufficient memory on accelerator");
      else if (all_success == -4)
        error->all(FLERR,"GPU library not compiled for this accelerator");
      else if (all_success == -5)
        error->all(FLERR,
                   "Double precision is not supported on this accelerator");
      else if (all_success == -6)
        error->all(FLERR,"Unable to initialize accelerator for use");
      else if (all_success == -7)
        error->all(FLERR,
                   "Accelerator sharing is not currently supported on system");
      else if (all_success == -8)
        error->all(FLERR,
                   "GPU particle split must be set to 1 for this pair style.");
      else
        error->all(FLERR,"Unknown error in GPU library");
    }
  };

  inline void gpu_ready(LAMMPS_NS::Modify *modify, LAMMPS_NS::Error *error) {
    int ifix = modify->find_fix("package_gpu");
    if (ifix < 0)
      error->all(FLERR,"The package gpu command is required for gpu styles");
  };
}

#endif

/* ERROR/WARNING messages:

E: The package gpu command is required for gpu styles

Self-explanatory.

E: Could not find/initialize a specified accelerator device

Could not initialize at least one of the devices specified for the gpu
package

E: Insufficient memory on accelerator

There is insufficient memory on one of the devices specified for the gpu
package

E: GPU library not compiled for this accelerator

Self-explanatory.

E: Double precision is not supported on this accelerator

Self-explanatory

E: Unable to initialize accelerator for use

There was a problem initializing an accelerator for the gpu package

E: Accelerator sharing is not currently supported on system

Multiple MPI processes cannot share the accelerator on your
system. For NVIDIA GPUs, see the nvidia-smi command to change this
setting.

E: GPU particle split must be set to 1 for this pair style.

For this pair style, you cannot run part of the force calculation on
the host.  See the package command.

E: Unknown error in GPU library

Self-explanatory.

*/