Skip to content

Commit

Permalink
Merge pull request #1003 from DLR-AMR/feature-ghost_tuning
Browse files Browse the repository at this point in the history
Feature ghost tuning
  • Loading branch information
holke authored Nov 7, 2024
2 parents 4fd854b + 25ef458 commit a7e4110
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 14 deletions.
8 changes: 7 additions & 1 deletion src/t8_forest/t8_forest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -2508,10 +2508,15 @@ t8_forest_element_owners_at_face_recursion (t8_forest_t forest, t8_gloidx_t gtre
else {
last_owner_entry = -1;
}
if (first_owner != last_owner_entry) {

if (first_owner > last_owner_entry) {
/* We did not count this process as an owner, thus we add it */
*(int *) sc_array_push (owners) = first_owner;
}
if (last_owner > last_owner_entry) {
/* We did not count this process as an owner, thus we add it */
*(int *) sc_array_push (owners) = last_owner;
}
T8_ASSERT (t8_forest_element_check_owner (forest, first_face_desc, gtreeid, eclass, first_owner, 1));
T8_ASSERT (t8_forest_element_check_owner (forest, last_face_desc, gtreeid, eclass, first_owner, 1));
/* free memory */
Expand Down Expand Up @@ -3380,6 +3385,7 @@ t8_forest_commit (t8_forest_t forest)
}

if (forest->mpisize > 1) {
sc_MPI_Barrier (forest->mpicomm);
/* Construct a ghost layer, if desired */
if (forest->do_ghost) {
/* TODO: ghost type */
Expand Down
26 changes: 13 additions & 13 deletions src/t8_forest/t8_forest_ghost.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1459,19 +1459,6 @@ t8_forest_ghost_create_ext (t8_forest_t forest, int unbalanced_version)
t8_forest_ghost_send_end (forest, ghost, send_info, requests);
}

if (create_element_array) {
/* Free the offset memory, if created */
t8_shmem_array_destroy (&forest->element_offsets);
}
if (create_tree_array) {
/* Free the offset memory, if created */
t8_shmem_array_destroy (&forest->tree_offsets);
}
if (create_gfirst_desc_array) {
/* Free the offset memory, if created */
t8_shmem_array_destroy (&forest->global_first_desc);
}

if (forest->profile != NULL) {
/* If profiling is enabled, we measure the runtime of ghost_create */
forest->profile->ghost_runtime += sc_MPI_Wtime ();
Expand All @@ -1491,6 +1478,19 @@ t8_forest_ghost_create_ext (t8_forest_t forest, int unbalanced_version)
t8_global_productionf ("End ghost at %f %f\n", sc_MPI_Wtime (), forest->profile->ghost_runtime);
}

if (create_element_array) {
/* Free the offset memory, if created */
t8_shmem_array_destroy (&forest->element_offsets);
}
if (create_tree_array) {
/* Free the offset memory, if created */
t8_shmem_array_destroy (&forest->tree_offsets);
}
if (create_gfirst_desc_array) {
/* Free the offset memory, if created */
t8_shmem_array_destroy (&forest->global_first_desc);
}

t8_global_productionf ("Done t8_forest_ghost with %i local elements and %i"
" ghost elements.\n",
t8_forest_get_local_num_elements (forest), t8_forest_get_num_ghosts (forest));
Expand Down

0 comments on commit a7e4110

Please sign in to comment.