-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCudaDomdecRecipLooper.cu
37 lines (24 loc) · 1.07 KB
/
CudaDomdecRecipLooper.cu
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
#include "CudaDomdecRecipLooper.h"
void CudaDomdecRecipLooper::run() {
while(true) {
// Receive header and stop if the STOP signal was received
if (!recipComm.recv_header()) break;
// Re-allocate coordinate array if needed
xyzq.realloc(recipComm.get_ncoord());
// Re-allocate force array if needed
reallocate<float3>(&force, &force_len, recipComm.get_ncoord(), 1.0f);
// Receive coordinates from Direct nodes
recipComm.recv_coord(xyzq.xyzq, stream);
//xyzq.save("xyzq_recip.txt");
assert(xyzq.xyzq == recipComm.get_coord_ptr());
// Compute forces
recip.calc(recipComm.get_inv_boxx(), recipComm.get_inv_boxy(), recipComm.get_inv_boxz(),
recipComm.get_coord_ptr(), recipComm.get_ncoord(),
recipComm.get_calc_energy(), recipComm.get_calc_virial(), force);
//NOTE: this synchronization is done in recipComm.send_force()
//cudaCheck(cudaStreamSynchronize(stream));
//save_float3(recipComm.get_ncoord(), force, "force_recip.txt");
// Send forces to Direct nodes
recipComm.send_force(force, stream);
}
}