~ubuntu-branches/debian/sid/lammps/sid

« back to all changes in this revision

Viewing changes to lib/gpu/lal_lj_expand_ext.cpp

  • Committer: Package Import Robot
  • Author(s): Anton Gladky
  • Date: 2015-04-29 23:44:49 UTC
  • mfrom: (5.1.3 experimental)
  • Revision ID: package-import@ubuntu.com-20150429234449-mbhy9utku6hp6oq8
Tags: 0~20150313.gitfa668e1-1
Upload into unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
    message=true;
50
50
 
51
51
  if (message) {
52
 
    fprintf(screen,"Initializing GPU and compiling on process 0...");
 
52
    fprintf(screen,"Initializing Device and compiling on process 0...");
53
53
    fflush(screen);
54
54
  }
55
55
 
66
66
  for (int i=0; i<procs_per_gpu; i++) {
67
67
    if (message) {
68
68
      if (last_gpu-first_gpu==0)
69
 
        fprintf(screen,"Initializing GPU %d on core %d...",first_gpu,i);
 
69
        fprintf(screen,"Initializing Device %d on core %d...",first_gpu,i);
70
70
      else
71
 
        fprintf(screen,"Initializing GPUs %d-%d on core %d...",first_gpu,
 
71
        fprintf(screen,"Initializing Devices %d-%d on core %d...",first_gpu,
72
72
                last_gpu,i);
73
73
      fflush(screen);
74
74
    }
89
89
  return init_ok;
90
90
}
91
91
 
 
92
// ---------------------------------------------------------------------------
 
93
// Copy updated coeffs from host to device
 
94
// ---------------------------------------------------------------------------
 
95
int lje_gpu_reinit(const int ntypes, double **cutsq, double **host_lj1,
 
96
                   double **host_lj2, double **host_lj3, double **host_lj4,
 
97
                   double **offset, double **shift) {
 
98
  int world_me=LJEMF.device->world_me();
 
99
  int gpu_rank=LJEMF.device->gpu_rank();
 
100
  int procs_per_gpu=LJEMF.device->procs_per_gpu();
 
101
  
 
102
  if (world_me==0)
 
103
    LJEMF.reinit(ntypes, cutsq, host_lj1, host_lj2, host_lj3, host_lj4,
 
104
                offset, shift);
 
105
  LJEMF.device->world_barrier();
 
106
  
 
107
  for (int i=0; i<procs_per_gpu; i++) {
 
108
    if (gpu_rank==i && world_me!=0)
 
109
      LJEMF.reinit(ntypes, cutsq, host_lj1, host_lj2, host_lj3, host_lj4,
 
110
                   offset, shift);
 
111
    LJEMF.device->gpu_barrier();
 
112
  }
 
113
}
 
114
 
92
115
void lje_gpu_clear() {
93
116
  LJEMF.clear();
94
117
}