Commit e8a941a0 authored by Vsevak's avatar Vsevak
Browse files

Remove unnecessary data transfer from tip4p/gpu pairstyle init

Such data transfer is performed at each timestep, so it does not belong to the initialization
parent 337b0fd6
Loading
Loading
Loading
Loading
+2 −18
Original line number Diff line number Diff line
@@ -56,9 +56,7 @@ int LJTIP4PLongT::init(const int ntypes,
    double **host_cut_ljsq,
    const double host_cut_coulsq, const double host_cut_coulsqplus,
    double *host_special_coul, const double qqrd2e,
    const double g_ewald, int* tag,
    int *map_array, int map_size,
    int *sametag, int max_same) {
    const double g_ewald, int map_size, int max_same) {
  int success;
  success=this->init_atomic(nlocal,nall,max_nbors,maxspecial,cell_size,gpu_split,
                            _screen,lj_tip4p_long,"k_lj_tip4p_long");
@@ -119,21 +117,9 @@ int LJTIP4PLongT::init(const int ntypes,
  m.alloc(nall,*(this->ucl_device), UCL_READ_WRITE);
  ansO.alloc(nall,*(this->ucl_device), UCL_READ_WRITE);

  // Allocate a host write buffer for data initialization
  UCL_H_Vec<int> host_tag_write(nall,*(this->ucl_device),UCL_READ_WRITE);
  this->tag.alloc(nall,*(this->ucl_device), UCL_READ_ONLY);
  for(int i=0; i<nall; ++i) host_tag_write[i] = tag[i];
  ucl_copy(this->tag, host_tag_write, nall, false);

  //if(max_same>host_tag_write.cols()) host_tag_write.resize(max_same);
  this->atom_sametag.alloc(nall, *(this->ucl_device), UCL_READ_ONLY);
  for(int i=0; i<nall; ++i) host_tag_write[i] = sametag[i];
  ucl_copy(this->atom_sametag, host_tag_write, nall, false);

  host_tag_write.resize_ib(map_size);
  this->atom_sametag.alloc(max_same, *(this->ucl_device), UCL_READ_ONLY);
  this->map_array.alloc(map_size,*(this->ucl_device), UCL_READ_ONLY);
  for(int i=0; i<map_size; ++i) host_tag_write[i] = map_array[i];
  ucl_copy(this->map_array, host_tag_write, map_size, false);

  _allocated=true;
  this->_max_bytes=lj1.row_bytes()+lj3.row_bytes()+cutsq.row_bytes()+
@@ -267,8 +253,6 @@ void LJTIP4PLongT::copy_relations_data(int n, int* tag, int *map_array,
  this->map_array.resize_ib(map_size);
  for(int i=0; i<map_size; ++i) host_tag_write[i] = map_array[i];
  ucl_copy(this->map_array, host_tag_write, map_size, false);

  host_tag_write.clear();
}


+1 −3
Original line number Diff line number Diff line
@@ -48,9 +48,7 @@ public:
           double **host_cut_ljsq,
           const double host_cut_coulsq, const double host_cut_coulsqplus,
           double *host_special_coul, const double qqrd2e,
           const double g_ewald, int* tag,
           int *map_array, int map_size,
           int *sametag, int max_same);
           const double g_ewald, int map_size,int max_same);

  /// Clear all host and device data
  /** \note This is called at the beginning of the init() routine **/
+4 −9
Original line number Diff line number Diff line
@@ -37,9 +37,7 @@ int ljtip4p_long_gpu_init(const int ntypes, double **cutsq, double **host_lj1,
    double **host_cut_ljsq,
    const double host_cut_coulsq, const double host_cut_coulsqplus,
    double *host_special_coul, const double qqrd2e,
    const double g_ewald, int* tag,
    int *map_array, int map_size,
    int *sametag, int max_same) {
    const double g_ewald, int map_size,int max_same) {
  LJTIP4PLMF.clear();
  gpu_mode=LJTIP4PLMF.device->gpu_mode();
  double gpu_split=LJTIP4PLMF.device->particle_split();
@@ -67,9 +65,7 @@ int ljtip4p_long_gpu_init(const int ntypes, double **cutsq, double **host_lj1,
        tH, tO, alpha, qdist, nall, 300,
        maxspecial, cell_size, gpu_split, screen,
        host_cut_ljsq, host_cut_coulsq, host_cut_coulsqplus,
        host_special_coul, qqrd2e, g_ewald, tag,
        map_array, map_size,
        sametag, max_same);
        host_special_coul, qqrd2e, g_ewald, map_size, max_same);

  LJTIP4PLMF.device->world_barrier();
  if (message)
@@ -90,9 +86,8 @@ int ljtip4p_long_gpu_init(const int ntypes, double **cutsq, double **host_lj1,
          tH, tO, alpha, qdist, nall, 300, maxspecial,
          cell_size, gpu_split, screen, host_cut_ljsq,
          host_cut_coulsq, host_cut_coulsqplus,
          host_special_coul, qqrd2e, g_ewald,tag,
          map_array, map_size,
          sametag, max_same);
          host_special_coul, qqrd2e,
          g_ewald, map_size, max_same);

    LJTIP4PLMF.device->gpu_barrier();
    if (message)
+4 −6
Original line number Diff line number Diff line
@@ -58,9 +58,8 @@ int ljtip4p_long_gpu_init(const int ntypes, double **cutsq, double **host_lj1,
    const double cell_size, int &gpu_mode, FILE *screen,
    double **host_cut_ljsq, const double host_cut_coulsq,
    const double host_cut_coulsqplus, double *host_special_coul,
    const double qqrd2e, const double g_ewald, int* tag,
    int *map_array, int map_size,
    int *sametag, int max_same);
    const double qqrd2e, const double g_ewald,
    int map_size, int max_same);
void ljtip4p_long_gpu_clear();
int ** ljtip4p_long_gpu_compute_n(const int ago, const int inum,
    const int nall, double **host_x, int *host_type,
@@ -227,9 +226,8 @@ void PairLJCutTIP4PLongGPU::init_style()
                             cell_size, gpu_mode, screen, cut_ljsq,
                             cut_coulsq, cut_coulsqplus,
                             force->special_coul, force->qqrd2e,
                             g_ewald,
                             atom->tag, atom->get_map_array(), atom->get_map_size(),
                             atom->sametag, atom->get_max_same());
                             g_ewald, atom->get_map_size(),
                             atom->get_max_same());
  GPU_EXTRA::check_flag(success,error,world);
  if (gpu_mode == GPU_FORCE) {
    int irequest = neighbor->request(this,instance_me);