Skip to content

Commit

Permalink
Merge pull request #310 from ludwig-cf/fix-issue-309
Browse files Browse the repository at this point in the history
Correct device halo swaps
  • Loading branch information
kevinstratford authored Jul 17, 2024
2 parents 0eaa467 + 9cbe656 commit 1fcd1c9
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions tests/unit/test_blue_phase.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Edinburgh Soft Matter and Statistical Physics Group and
* Edinburgh Parallel Computing Centre
*
* (c) 2010-2021 The University of Edinburgh
* (c) 2010-2024 The University of Edinburgh
*
* Contributing authors:
* Kevin Stratford ([email protected])
Expand Down Expand Up @@ -334,10 +334,13 @@ int test_o8m_struct(pe_t * pe, cs_t * cs, lees_edw_t * le, fe_lc_t * fe,
/* Now the free energy density. This requires that the gradients are
* set. These values use the standard 27-point stencil in 3-d. */

field_halo_swap(fq, FIELD_HALO_HOST);
/* Gradient computation is on the device, so ... */

field_memcpy(fq, tdpMemcpyHostToDevice);
field_halo(fq);

field_grad_compute(fqgrad);

field_grad_memcpy(fqgrad, tdpMemcpyDeviceToHost);

ic = 1;
Expand Down Expand Up @@ -800,11 +803,13 @@ int test_o8m_struct(pe_t * pe, cs_t * cs, lees_edw_t * le, fe_lc_t * fe,

/* Note the electric field remains switched on so... */

field_halo(fq);
field_grad_set(fqgrad, grad_3d_7pt_fluid_d2, NULL);

field_memcpy(fq, tdpMemcpyHostToDevice);
field_halo(fq);

field_grad_compute(fqgrad);

field_grad_memcpy(fqgrad, tdpMemcpyDeviceToHost);

ic = 1;
Expand Down

0 comments on commit 1fcd1c9

Please sign in to comment.