Skip to content

Commit

Permalink
Merge pull request #303 from ludwig-cf/fix-issue-302
Browse files Browse the repository at this point in the history
Fix issue 302
  • Loading branch information
kevinstratford authored Jun 12, 2024
2 parents 85bc25f + aae6cf8 commit 0eaa467
Show file tree
Hide file tree
Showing 11 changed files with 67 additions and 23 deletions.
16 changes: 12 additions & 4 deletions src/advection.c
Original file line number Diff line number Diff line change
Expand Up @@ -280,10 +280,18 @@ __host__ int advflux_free(advflux_t * obj) {
tdpFree(obj->target);
}

free(obj->fe);
free(obj->fw);
free(obj->fy);
free(obj->fz);
if (obj->le == NULL) {
free(obj->fx);
free(obj->fy);
free(obj->fz);
}
else {
free(obj->fe);
free(obj->fw);
free(obj->fy);
free(obj->fz);
}

free(obj);

return 0;
Expand Down
8 changes: 7 additions & 1 deletion src/ewald.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* Edinburgh Soft Matter and Statistical Physics Group and
* Edinburgh Parallel Computing Centre
*
* (c) 2007-2023 The University of Edinburgh.
* (c) 2007-2024 The University of Edinburgh.
*
* Contributing authors:
* Grace Kim
Expand Down Expand Up @@ -135,6 +135,12 @@ int ewald_create(pe_t * pe, cs_t * cs, double mu_input, double rc_input,
int ewald_free(ewald_t * ewald) {

assert(ewald);

free(sinx_);
free(cosx_);
free(sinkr_);
free(coskr_);

free(ewald);

return 0;
Expand Down
3 changes: 2 additions & 1 deletion src/io_impl_mpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* Edinburgh Soft Matter and Statistical Physics Group and
* Edinburgh Parallel Computing Centre
*
* (c) 2022 The University of Edinburgh
* (c) 2022-2024 The University of Edinburgh
*
* Kevin Stratford ([email protected])
*
Expand Down Expand Up @@ -274,6 +274,7 @@ int io_impl_mpio_write_end(io_impl_mpio_t * io) {
assert(io);

MPI_File_write_all_end(io->fh, io->super.aggr->buf, &io->status);
MPI_File_close(&io->fh);

return 0;
}
9 changes: 8 additions & 1 deletion src/wall.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* Edinburgh Soft Matter and Statistical Physics and
* Edinburgh Parallel Computing Centre
*
* (c) 2011-2023 The University of Edinburgh
* (c) 2011-2024 The University of Edinburgh
*
* Contributing authors:
* Kevin Stratford ([email protected])
Expand Down Expand Up @@ -150,10 +150,17 @@ __host__ int wall_free(wall_t * wall) {

cs_free(wall->cs);
free(wall->param);

/* slip quantities */
if (wall->linkk) free(wall->linkk);
if (wall->linkq) free(wall->linkq);
if (wall->links) free(wall->links);

if (wall->linki) free(wall->linki);
if (wall->linkj) free(wall->linkj);
if (wall->linkp) free(wall->linkp);
if (wall->linku) free(wall->linku);

free(wall);

return 0;
Expand Down
4 changes: 3 additions & 1 deletion tests/unit/test_fe_electro.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* Edinburgh Soft Matter and Statistical Phsyics Group and
* Edinburgh Parallel Computing Centre
*
* (c) 2014-2023 The University of Edinburgh
* (c) 2014-2024 The University of Edinburgh
*
* Contributing authors:
* Kevin Stratford ([email protected])
Expand Down Expand Up @@ -183,6 +183,7 @@ int do_test2(pe_t * pe, cs_t * cs, physics_t * phys) {
assert(cs);
assert(phys);

/* We need a slightly better way to construct nk /= 2 case */
{
int nhalo = 0;
cs_nhalo(cs, &nhalo);
Expand All @@ -194,6 +195,7 @@ int do_test2(pe_t * pe, cs_t * cs, physics_t * phys) {
opts.valency[0] = valency[0];
opts.valency[1] = valency[1];
opts.valency[2] = valency[2];
opts.rho = field_options_ndata_nhalo(3, nhalo);
psi_create(pe, cs, &opts, &psi);
}
}
Expand Down
4 changes: 3 additions & 1 deletion tests/unit/test_fe_electro_symm.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* Edinburgh Soft Matter and Statistical Physics Group and
* Edinburgh Parallel Computing Centre
*
* (c) 2013-2023 The University of Edinburgh
* (c) 2013-2024 The University of Edinburgh
*
* Contributing authors:
* Kevin Stratford ([email protected])
Expand Down Expand Up @@ -145,6 +145,8 @@ static int do_test1(pe_t * pe) {
/* Finish. */

fe_es_free(fe);
fe_symm_free(fe_symm);
fe_electro_free(fe_elec);
field_grad_free(dphi);
field_free(phi);
psi_free(&psi);
Expand Down
2 changes: 2 additions & 0 deletions tests/unit/test_kernel_3d.c
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,8 @@ int test_kernel_3d_cs_index(pe_t * pe) {
tdpAssert( tdpDeviceSynchronize() );
}

cs_free(cs);

return ifail;
}

Expand Down
28 changes: 17 additions & 11 deletions tests/unit/test_kernel_3d_v.c
Original file line number Diff line number Diff line change
Expand Up @@ -269,10 +269,12 @@ __global__ void test_kernel_3d_v_coords_kernel(kernel_3d_v_t k3v, cs_t * cs) {

int kindex = 0;

assert(k3v.nsimdvl == NSIMDVL);

for_simt_parallel(kindex, k3v.kiterations, k3v.nsimdvl) {
int icv[k3v.nsimdvl];
int jcv[k3v.nsimdvl];
int kcv[k3v.nsimdvl];
int icv[NSIMDVL];
int jcv[NSIMDVL];
int kcv[NSIMDVL];
kernel_3d_v_coords(&k3v, kindex, icv, jcv, kcv);
for (int iv = 0; iv < k3v.nsimdvl; iv++) {
int ic = icv[iv];
Expand All @@ -295,11 +297,13 @@ __global__ void test_kernel_3d_v_mask_kernel(kernel_3d_v_t k3v) {

int kindex = 0;

assert(k3v.nsimdvl == NSIMDVL);

for_simt_parallel(kindex, k3v.kiterations, k3v.nsimdvl) {
int icv[k3v.nsimdvl];
int jcv[k3v.nsimdvl];
int kcv[k3v.nsimdvl];
int maskv[k3v.nsimdvl];
int icv[NSIMDVL];
int jcv[NSIMDVL];
int kcv[NSIMDVL];
int maskv[NSIMDVL];

kernel_3d_v_coords(&k3v, kindex, icv, jcv, kcv);
kernel_3d_v_mask(&k3v, icv, jcv, kcv, maskv);
Expand Down Expand Up @@ -340,11 +344,13 @@ __global__ void test_kernel_3d_v_cs_index_kernel(kernel_3d_v_t k3v, cs_t *cs) {

int kindex = 0;

assert(k3v.nsimdvl == NSIMDVL);

for_simt_parallel(kindex, k3v.kiterations, k3v.nsimdvl) {
int icv[k3v.nsimdvl];
int jcv[k3v.nsimdvl];
int kcv[k3v.nsimdvl];
int indexv[k3v.nsimdvl];
int icv[NSIMDVL];
int jcv[NSIMDVL];
int kcv[NSIMDVL];
int indexv[NSIMDVL];

kernel_3d_v_coords(&k3v, kindex, icv, jcv, kcv);
kernel_3d_v_cs_index(&k3v, icv, jcv, kcv, indexv);
Expand Down
4 changes: 3 additions & 1 deletion tests/unit/test_lb_bc_outflow_rhou.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Edinburgh Soft Matter and Statistical Physics Group and
* Edinburgh Parallel Computing Centre
*
* (c) 2021-2022 The University of Edinburgh
* (c) 2021-2024 The University of Edinburgh
*
* Contributing authors:
* Kevin Stratford ([email protected])
Expand Down Expand Up @@ -82,6 +82,8 @@ __host__ int test_lb_bc_outflow_rhou_create(pe_t * pe, cs_t * cs) {
assert(outflow->linki);
assert(outflow->linkj);

lb_bc_outflow_rhou_free(outflow);

return 0;
}

Expand Down
4 changes: 3 additions & 1 deletion tests/unit/test_psi_solver_options.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Edinburgh Soft Matter and Statistical Physics Group and
* Edinburgh Parallel Computing Centre
*
* (c) 2023 The University of Edinburgh
* (c) 2023-2024 The University of Edinburgh
*
* Kevin Stratford ([email protected])
*
Expand Down Expand Up @@ -292,6 +292,8 @@ int test_psi_solver_options_from_json(void) {
assert(fabs(pso.abstol - 0.02) < DBL_EPSILON);
}

cJSON_Delete(json);

return ifail;
}

Expand Down
8 changes: 7 additions & 1 deletion tests/unit/test_psi_sor.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* Edinburgh Soft Matter and Statistical Physics Group and
* Edinburgh Parallel Computing Centre
*
* (c) 2012-2023 The University of Edinburgh
* (c) 2012-2024 The University of Edinburgh
*
* Contributing authors:
* Kevin Stratford ([email protected])
Expand Down Expand Up @@ -96,6 +96,9 @@ int test_psi_solver_sor_create(pe_t * pe) {
assert(sor == NULL);
}

psi_free(&psi);
cs_free(cs);

return ifail;
}

Expand Down Expand Up @@ -192,6 +195,9 @@ int test_psi_solver_sor_var_epsilon_create(pe_t * pe) {
assert(sor == NULL);
}

psi_free(&psi);
cs_free(cs);

return ifail;
}

Expand Down

0 comments on commit 0eaa467

Please sign in to comment.