Unverified Commit 4dc90b36 authored by Axel Kohlmeyer's avatar Axel Kohlmeyer Committed by GitHub
Browse files

Merge pull request #1458 from wmbrownIntel/user-intel-bigbig

USER-INTEL: Changes to support LAMMPS_BIGBIG in USER-INTEL + fixed check for per-atom virials + fixed check for exclusion with offload.
parents 091dbfa2 a26dc1b3
Loading
Loading
Loading
Loading
+0 −3
Original line number Original line Diff line number Diff line
@@ -1127,9 +1127,6 @@ if(PKG_OPT)
endif()
endif()


if(PKG_USER-INTEL)
if(PKG_USER-INTEL)
  if(LAMMPS_SIZES STREQUAL BIGBIG)
    message(FATAL_ERROR "The USER-INTEL Package is not compatible with -DLAMMPS_BIGBIG")
  endif()
  add_definitions(-DLMP_USER_INTEL)
  add_definitions(-DLMP_USER_INTEL)


  set(INTEL_ARCH "cpu" CACHE STRING "Architectures used by USER-INTEL (cpu or knl)")
  set(INTEL_ARCH "cpu" CACHE STRING "Architectures used by USER-INTEL (cpu or knl)")
+4 −8
Original line number Original line Diff line number Diff line
@@ -34,10 +34,6 @@
#include <cstdio>
#include <cstdio>
#include <cmath>
#include <cmath>


#ifdef LAMMPS_BIGBIG
#error "The USER-INTEL package is not compatible with -DLAMMPS_BIGBIG"
#endif

#ifdef _LMP_INTEL_OFFLOAD
#ifdef _LMP_INTEL_OFFLOAD
#ifndef INTEL_OFFLOAD_NOAFFINITY
#ifndef INTEL_OFFLOAD_NOAFFINITY
#include <unistd.h>
#include <unistd.h>
@@ -378,13 +374,13 @@ void FixIntel::setup(int vflag)
  if (neighbor->style != Neighbor::BIN)
  if (neighbor->style != Neighbor::BIN)
    error->all(FLERR,
    error->all(FLERR,
            "Currently, neighbor style BIN must be used with Intel package.");
            "Currently, neighbor style BIN must be used with Intel package.");
  if (neighbor->exclude_setting() != 0)
  if (vflag > 3)
    error->all(FLERR,
            "Currently, cannot use neigh_modify exclude with Intel package.");
  if (vflag_atom)
   error->all(FLERR,
   error->all(FLERR,
               "Cannot currently get per-atom virials with Intel package.");
               "Cannot currently get per-atom virials with Intel package.");
  #ifdef _LMP_INTEL_OFFLOAD
  #ifdef _LMP_INTEL_OFFLOAD
  if (neighbor->exclude_setting() != 0)
    error->all(FLERR,
     "Currently, cannot use neigh_modify exclude with Intel package offload.");
  post_force(vflag);
  post_force(vflag);
  #endif
  #endif
}
}
+2 −2
Original line number Original line Diff line number Diff line
@@ -495,9 +495,9 @@ E: Currently, neighbor style BIN must be used with Intel package.
This is the only neighbor style that has been implemented for the Intel
This is the only neighbor style that has been implemented for the Intel
package.
package.


E: Currently, cannot use neigh_modify exclude with Intel package.
E: Currently, cannot use neigh_modify exclude with Intel package offload.


This is a current restriction of the Intel package.
This is a current restriction of the Intel package when built for offload.


W: Unknown Intel Compiler Version
W: Unknown Intel Compiler Version


+7 −6
Original line number Original line Diff line number Diff line
@@ -186,8 +186,8 @@ void IntelBuffers<flt_t, acc_t>::free_nmax()
{
{
  #ifdef _LMP_INTEL_OFFLOAD
  #ifdef _LMP_INTEL_OFFLOAD
  if (_off_map_nmax > 0) {
  if (_off_map_nmax > 0) {
    const int * tag = _off_map_tag;
    const tagint * tag = _off_map_tag;
    const int * special = _off_map_special;
    const tagint * special = _off_map_special;
    const int * nspecial = _off_map_nspecial;
    const int * nspecial = _off_map_nspecial;
    #pragma offload_transfer target(mic:_cop) \
    #pragma offload_transfer target(mic:_cop) \
      nocopy(tag:alloc_if(0) free_if(1)) \
      nocopy(tag:alloc_if(0) free_if(1)) \
@@ -209,7 +209,8 @@ void IntelBuffers<flt_t, acc_t>::_grow_nmax(const int offload_end)
  _host_nmax = size;
  _host_nmax = size;


  if (!offload_end) return;
  if (!offload_end) return;
  int *special, *nspecial;
  tagint *special;
  int *nspecial;
  int tag_length, special_length, nspecial_length;
  int tag_length, special_length, nspecial_length;
  if (lmp->atom->molecular) {
  if (lmp->atom->molecular) {
    special = lmp->atom->special[0];
    special = lmp->atom->special[0];
@@ -226,7 +227,7 @@ void IntelBuffers<flt_t, acc_t>::_grow_nmax(const int offload_end)
    tag_length = size;
    tag_length = size;
  else
  else
    tag_length = 1;
    tag_length = 1;
  int *tag = lmp->atom->tag;
  tagint *tag = lmp->atom->tag;
  #pragma offload_transfer target(mic:_cop) \
  #pragma offload_transfer target(mic:_cop) \
    nocopy(tag:length(tag_length) alloc_if(1) free_if(0)) \
    nocopy(tag:length(tag_length) alloc_if(1) free_if(0)) \
    nocopy(special:length(special_length) alloc_if(1) free_if(0)) \
    nocopy(special:length(special_length) alloc_if(1) free_if(0)) \
@@ -523,7 +524,7 @@ void IntelBuffers<flt_t, acc_t>::free_ncache()
    flt_t *ncachez = _ncachez;
    flt_t *ncachez = _ncachez;
    int *ncachej = _ncachej;
    int *ncachej = _ncachej;
    int *ncachejtype = _ncachejtype;
    int *ncachejtype = _ncachejtype;
    int *ncachetag = _ncachetag;
    tagint *ncachetag = _ncachetag;


    #ifdef _LMP_INTEL_OFFLOAD
    #ifdef _LMP_INTEL_OFFLOAD
    if (_off_ncache) {
    if (_off_ncache) {
@@ -603,7 +604,7 @@ void IntelBuffers<flt_t, acc_t>::grow_ncache(const int off_flag,
      tsize = 16;
      tsize = 16;
      lmp->memory->create(_ncachetag, tsize, "_ncachetag");
      lmp->memory->create(_ncachetag, tsize, "_ncachetag");
    }
    }
    int *ncachetag = _ncachetag;
    tagint *ncachetag = _ncachetag;
    #pragma offload_transfer target(mic:_cop)                   \
    #pragma offload_transfer target(mic:_cop)                   \
      nocopy(ncachetag:length(tsize) alloc_if(1) free_if(0))
      nocopy(ncachetag:length(tsize) alloc_if(1) free_if(0))
    _off_ncache = 1;
    _off_ncache = 1;
+5 −4
Original line number Original line Diff line number Diff line
@@ -132,7 +132,7 @@ class IntelBuffers {
  inline flt_t * get_ncachez() { return _ncachez; }
  inline flt_t * get_ncachez() { return _ncachez; }
  inline int * get_ncachej() { return _ncachej; }
  inline int * get_ncachej() { return _ncachej; }
  inline int * get_ncachejtype() { return _ncachejtype; }
  inline int * get_ncachejtype() { return _ncachejtype; }
  inline int * get_ncachetag() { return _ncachetag; }
  inline tagint * get_ncachetag() { return _ncachetag; }


  inline int get_max_nbors() {
  inline int get_max_nbors() {
    int mn = lmp->neighbor->oneatom * sizeof(int) /
    int mn = lmp->neighbor->oneatom * sizeof(int) /
@@ -336,7 +336,8 @@ class IntelBuffers {


  int _ncache_stride, _ncache_alloc;
  int _ncache_stride, _ncache_alloc;
  flt_t *_ncachex, *_ncachey, *_ncachez;
  flt_t *_ncachex, *_ncachey, *_ncachez;
  int *_ncachej, *_ncachejtype, *_ncachetag;
  int *_ncachej, *_ncachejtype;
  tagint *_ncachetag;


  int _need_tag, _host_nmax;
  int _need_tag, _host_nmax;


@@ -352,8 +353,8 @@ class IntelBuffers {
  quat_t *_host_quat;
  quat_t *_host_quat;
  vec3_acc_t *_off_f;
  vec3_acc_t *_off_f;
  int _off_map_nmax, _cop, _off_ccache, _off_ncache;
  int _off_map_nmax, _cop, _off_ccache, _off_ncache;
  int *_off_map_ilist;
  int *_off_map_ilist, *_off_map_nspecial;
  int *_off_map_special, *_off_map_nspecial, *_off_map_tag;
  tagint *_off_map_tag, *_off_map_special;
  int **_off_map_firstneigh, *_off_map_numneigh;
  int **_off_map_firstneigh, *_off_map_numneigh;
  bool _off_list_alloc;
  bool _off_list_alloc;
  #endif
  #endif
Loading