Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature new for hybrid #768

Open
wants to merge 57 commits into
base: main
Choose a base branch
from
Open

Feature new for hybrid #768

wants to merge 57 commits into from

Conversation

Davknapp
Copy link
Collaborator

@Davknapp Davknapp commented Sep 25, 2023

PR to enable the hybrid new.

Current TODOs:

  • Enable all tests
  • understand why t8_cmesh_hybrid_new.cxx fails for 'mpirun -np 7 ./example/cmesh/t8_cmesh_hybrid_new -l4 -f6 -p -m1' and fix it.

All these boxes must be checked by the reviewers before merging the pull request:

As a reviewer please read through all the code lines and make sure that the code is fully understood, bug free, well-documented and well-structured.

General

  • The reviewer executed the new code features at least once and checked the results manually

  • The code follows the t8code coding guidelines

  • New source/header files are properly added to the Makefiles

  • The code is well documented

  • All function declarations, structs/classes and their members have a proper doxygen documentation

  • All new algorithms and data structures are sufficiently optimal in terms of memory and runtime (If this should be merged, but there is still potential for optimization, create a new issue)

Tests

  • The code is covered in an existing or new test case using Google Test

Github action

  • The code compiles without warning in debugging and release mode, with and without MPI (this should be executed automatically in a github action)

  • All tests pass (in various configurations, this should be executed automatically in a github action)

    If the Pull request introduces code that is not covered by the github action (for example coupling with a new library):

    • Should this use case be added to the github action?
    • If not, does the specific use case compile and all tests pass (check manually)

Scripts and Wiki

  • If a new directory with source-files is added, it must be covered by the script/find_all_source_files.scp to check the indentation of these files.
  • If this PR introduces a new feature, it must be covered in an example/tutorial and a Wiki article.

Licence

  • The author added a BSD statement to doc/ (or already has one)

@Davknapp Davknapp added New feature Adds a new feature to the code draft Enhance the visibility that this is a draft. labels Sep 25, 2023
@Davknapp
Copy link
Collaborator Author

Merging with main solved the second issue

@Davknapp
Copy link
Collaborator Author

After Debugging-session with @lukasdreyer
Current Problem
Vertex mesh with a single vertex on level 11 with 2 procs.
proc 0 computes first_child 0 and last_child -1 and sets its first tree to -1, which should not be possible.

Copy link
Collaborator

@holke holke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very good contribution - obviously with such a big PR i have some comments, but i see no major problems.

You should add addtional test cases to catch the boundary cases.
For example testing when the first tree is not on the first process.

src/t8_cmesh/t8_cmesh_cxx.cxx Outdated Show resolved Hide resolved
{
return t8_A_times_B_over_C_intA (process, global_num_elements, mpisize);
}

void
t8_cmesh_uniform_bounds (t8_cmesh_t cmesh, int level, t8_scheme_cxx_t *ts, t8_gloidx_t *first_local_tree,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can now rename this function to
t8_cmesh_uniform_bounds_element_counts_are_equal (or similar name)
and call it each time that for all eclasses the "number of elements at level l" is the same.
It must not even be 2^n or k^n, just the same on the given level.

}

/* TODO: Shared trees, binary search in offset-array to avoid recv_any,
* use partition_given to partition the cmesh*/
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this TODO still to do?

#endif

/* TODO: Clean up size_t and gloidx_t data types, ensure that each variables has the
* matching type. */
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this TODO still to do?

src/t8_cmesh.h Outdated
* \param [in] comm The communicator
*/
void
t8_cmesh_uniform_bounds_hybrid (const t8_cmesh_t cmesh, const int level, const t8_scheme_cxx_t *scheme,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we agreed to change the name, since the old version can also be used for hybrid schemes.

= query_data->num_procs - 1
- t8_A_times_B_over_C_intA (query_data->num_procs, mirror_element_index, query_data->global_num_elements);

// (int)(((long double)mirror_element_index/query_data->global_num_elements)*query_data->num_procs);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we delete this comment?

const t8_gloidx_t mirror_element_index = query_data->global_num_elements - element_index - 1;
int first_proc_rank;

t8_debugf ("[H] tree %li el %li mirror %li\n", pure_local_tree, element_index, mirror_element_index);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this print still needed?

* add the first process. */
first_proc_adjusted = first_proc_rank - query_data->process_offset;
}
t8_debugf ("[H] ptree %zd, first element %li, on proc %zd\n", pure_local_tree, element_index, first_proc_adjusted);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this print still needed?

src/t8_cmesh/t8_cmesh_cxx.cxx Outdated Show resolved Hide resolved
t8_cmesh_uniform_bounds_hybrid (const t8_cmesh_t cmesh, const int level, const t8_scheme_cxx_t *scheme,
t8_gloidx_t *first_local_tree, t8_gloidx_t *child_in_tree_begin,
t8_gloidx_t *last_local_tree, t8_gloidx_t *child_in_tree_end, int8_t *first_tree_shared,
sc_MPI_Comm comm)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function is 600 lines long - uff.
Consider outsourcing some code into subroutines.
For example

  • partitioned and non-partitioned computation
  • sending of start message
  • sending of end message
  • receiving of start message
  • receiving of end message

@holke holke assigned Davknapp and unassigned holke Jan 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
draft Enhance the visibility that this is a draft. New feature Adds a new feature to the code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants