Skip to content

Commit

Permalink
Only allocate receive messahe handlers for the requested number of fa…
Browse files Browse the repository at this point in the history
…ces.
  • Loading branch information
maddyscientist committed May 13, 2015
1 parent 36292b4 commit 634d170
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions lib/cuda_color_spinor_field.cu
Original file line number Diff line number Diff line change
Expand Up @@ -1042,15 +1042,15 @@ namespace quda {

if(precision == QUDA_HALF_PRECISION){
for(int b=0; b<2; ++b){
mh_recv_norm_fwd[b][j][i] = comm_declare_receive_relative(from_fwd_norm_face[b][i], i, +1, nbytes_Nface_norm);
mh_recv_norm_back[b][j][i] = comm_declare_receive_relative(from_back_norm_face[b][i], i, -1, nbytes_Nface_norm);
mh_recv_norm_fwd[b][j][i] = (j+1 == nFace) ? comm_declare_receive_relative(from_fwd_norm_face[b][i], i, +1, nbytes_Nface_norm) : NULL;
mh_recv_norm_back[b][j][i] = (j+1 == nFace) ? comm_declare_receive_relative(from_back_norm_face[b][i], i, -1, nbytes_Nface_norm) : NULL;
}
}
#endif // GPU_COMMS

for(int b=0; b<2; ++b){
mh_recv_fwd[b][j][i] = comm_declare_receive_relative(from_fwd_face[b][i], i, +1, nbytes_Nface);
mh_recv_back[b][j][i] = comm_declare_receive_relative(from_back_face[b][i], i, -1, nbytes_Nface);
mh_recv_fwd[b][j][i] = (j+1 == nFace) ? comm_declare_receive_relative(from_fwd_face[b][i], i, +1, nbytes_Nface) : NULL;
mh_recv_back[b][j][i] = (j+1 == nFace) ? comm_declare_receive_relative(from_back_face[b][i], i, -1, nbytes_Nface) : NULL;
}


Expand All @@ -1071,15 +1071,15 @@ namespace quda {
for (int j=0; j<maxNface; j++) {
for (int i=0; i<nDimComms; i++) {
if (commDimPartitioned(i)) {
comm_free(mh_recv_fwd[b][j][i]);
comm_free(mh_recv_back[b][j][i]);
if (mh_recv_fwd[b][j][i]) comm_free(mh_recv_fwd[b][j][i]);
if (mh_recv_fwd[b][j][i]) comm_free(mh_recv_back[b][j][i]);
if (mh_send_fwd[b][j][2*i]) comm_free(mh_send_fwd[b][j][2*i]);
if (mh_send_back[b][j][2*i]) comm_free(mh_send_back[b][j][2*i]);
// only in a special case are these not aliasing pointers
#ifdef GPU_COMMS
if(precision == QUDA_HALF_PRECISION){
comm_free(mh_recv_norm_fwd[b][j][i]);
comm_free(mh_recv_norm_back[b][j][i]);
if (mh_recv_norm_fwd[b][j][i]) comm_free(mh_recv_norm_fwd[b][j][i]);
if (mh_recv_norm_back[b][j][i]) comm_free(mh_recv_norm_back[b][j][i]);
if (mh_send_norm_fwd[b][j][2*i]) comm_free(mh_send_norm_fwd[b][j][2*i]);
if (mh_send_norm_back[b][j][2*i]) comm_free(mh_send_norm_back[b][j][2*i]);
}
Expand Down

0 comments on commit 634d170

Please sign in to comment.