-
Notifications
You must be signed in to change notification settings - Fork 44
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
Is it possible to create a local matrix per MPI process #687
Comments
@Goon83 I have not tried this but maybe something along these lines works: auto team = dash::Team::All().split(dash::util::Locality::Scope::Unit, dash::size()); This should give you a team with only one unit each. You can pass this team to the c'tor of the matrix and that should create independent matrices in each unit. |
Hi Devreal, Code: Error:
|
Just realized that split returns a auto& team_local = dash::Team::All().split(dash::Team::All().size()); |
Hi devreal, Bests, Sample code:
Error Info:
|
Sorry, I didn't see your reply until just now. The problem is that your This should fix it: int main(int argc, char *argv[])
{
dash::init(&argc, &argv);
dash::global_unit_t myid = dash::myid();
size_t rows = 8;
size_t cols = 8;
auto &team_local = dash::Team::All().split(dash::Team::All().size());
dash::TeamSpec<2> teamspec{team_local};
teamspec.balance_extents();
dash::Matrix<int, 2> matrix_local(dash::SizeSpec<2>(rows, cols), dash::DistributionSpec<2>(), team_local, teamspec);
if (0 == myid)
{
cout << "matrix_local size: " << matrix_local.extent(0)
<< " x " << matrix_local.extent(1)
<< " == " << matrix_local.size()
<< endl;
}
dash::Team::All().barrier();
for (size_t i = 0; i < rows; i++)
{
for (size_t k = 0; k < cols; k++)
{
matrix_local[i][k] = myid;
}
}
for (size_t i = 0; i < rows; i++)
{
for (size_t k = 0; k < cols; k++)
{
int value = matrix_local[i][k];
int expected = myid;
DASH_ASSERT(expected == value);
}
}
int value = matrix_local[5][5];
cout << value << " at rank " << myid << "\n";
dash::Team::All().barrier();
dash::finalize();
return 0;
} We should think about changing the pattern and matrix interface to disallow passing a team and a teamspec to the c'tor to prevent this kind of ambiguity. |
Hi @devreal , Bests,
|
Hi,
Is it possible to create a local matrix per MPI process? It is like MPI_COMM_SELF for file creation. Then each MPI process access its own data.
Thanks,
Bin
The text was updated successfully, but these errors were encountered: