-
Notifications
You must be signed in to change notification settings - Fork 12
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
Thin host matrix wrapper #140
Conversation
include/OGL/CommunicationPattern.H
Outdated
// to the corresponding target_id | ||
gko::array<comm_size_type> target_sizes; | ||
|
||
// send_idx stores the index_set ie which cells |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is the variable index_set
from?
Co-authored-by: chihta <97195768+chihta-wang@users.noreply.github.com>
to make it clear that there is only one owner process in the test
The unit test does not verify any functionality of CommunicationPattern. It verifies the functionality of a MPI communicator, and thus should not belong to the test suite for CommunicationPattern. To make some hardcoded unit tests more self-contained, the ascertain part for the communicator size is added accordinlgy.
1. Use vectors instead of vectors of vectors for expected results. 2. Parameterize the communicator size to avoid the repeated function calls.
… that it is not hardcoded anymore. Now it can run on an arbitrarily even number of processes.
in the increasing number of owner processes.
for the case of two owner processes
and "compute_gather_to_owner_counts_single_owner" to verify that each process can send a different number of elements to owner processes.
for the moment. Modify the unit test "compute_scatter_from_owner_counts_single_owner" so that the owner can send data to itself.
If only 1 process is used, the program will abort.
…e structures more easily identified.
…ts" for the case of two owners.
implement additional unit tests for communication pattern, see #143
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please check the comments for the header file HostMatrix.H
and for the unit test code HostMatrix.C
.
We may need some unit tests for the member functions of the class HostMatrixWrapper
?
** @param cols pointer to columns array | ||
** @param permute pointer to permuter array | ||
*/ | ||
void init_local_sparsity(const label nrows, const label upper_nnz, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why only upper non-zeros are considered? How about the lower non-zeros?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const label upper_nnz
is just the number of entries in the upper triangular matrix. the number of upper_nnz==lower_nnz
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
void init_local_sparsity(const label nrows, const label upper_nnz, | |
void init_local_sparsity(const label nrows, const label non_diag_nnz, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'll keep it as upper_nnz
, because we already use non_diag_nnz
for 2*upper_nnz
|
||
const ExecutorHandler &exec_; | ||
|
||
const DeviceIdGuardHandler device_id_guard_; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is device_id_guard
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for more details see scoped_device_id_guard.hpp
in Ginkgo
** ret = [(1,2,1),(2,20, 2), (3, 20, 2) ...] | ||
** i0 i1, i... | ||
*/ | ||
[[nodiscard]] std::vector<std::tuple<label, label, label, label>> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a inconsistency between the comment and the function declaration regarding the return value.
In the comment, a vector of 3-element tuples is specified for the return value. However, the function declaration has a vector of 4-element tuples as the return type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch.
const lduInterfaceFieldPtrsList &interfaces) const; | ||
|
||
public: | ||
// segregated matrix wrapper constructor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is a segregated matrix?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OF uses the term segregated opposed to coupled matrix. In a coupled matrix all transport equations are stored in a single matrix. In a segregated approach each transport equation gets its own matrix.
unitTests/HostMatrix.C
Outdated
EXPECT_EQ(((HostMatrixEnvironment *)global_env)->args_->size(), 1); | ||
} | ||
|
||
TEST(HostMatrix, runsInParallelWithCorrectNumberOfRanks) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the unit tests for host matrix wrapper are hardcoded at the moment, it's better to put this test to a place where setup takes place, e.g., the body of the SetUp
function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aggree, will do that.
** This uses the local_sparsity_.ldu_mapping to permute the data already | ||
** on the host or device to be in row major order. | ||
**/ | ||
void compute_local_coeffs(std::shared_ptr<const SparsityPattern> sparsity, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is compute_local_coeffs
implemented?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently, not. Will either added here in a separate PR or somewhere else. The reason is that it depends on the new distributed matrix wrapper class which is currently missing.
/** Copies the interface matrix coefficients to non_local_coeffs without | ||
** changing or reinstantiating the sparsity pattern. | ||
**/ | ||
void compute_non_local_coeffs( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is compute_non_local_coeffs
implemented?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as for the local_coeffs.
This PR adds a thin wrapper class around OpenFOAMs host LDU matrix class. The aim of this class is to simplify compute and access functions in order to create a ginkgo distributed matrix object. Ideally, this class doesn't need to be device persistent if we just make the distributed matrix class device persistent and an update function.
Additionally it introduces a communication pattern wrapper class.