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

Tacho : return value from team-factor #13678

Merged
merged 1 commit into from
Dec 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2190,8 +2190,13 @@ class NumericToolsLevelSet : public NumericToolsBase<ValueType, DeviceType> {
// const ordinal_type team_size_factor[2] = { 16, 16 }, vector_size_factor[2] = { 32, 32};
const ordinal_type team_size_factor[2] = {64, 64}, vector_size_factor[2] = {8, 4};
const ordinal_type team_size_update[2] = {16, 8}, vector_size_update[2] = {32, 32};
// returned value from team Chol
colind_view d_rval("rval",1);
auto h_rval = Kokkos::create_mirror_view(host_memory_space(), d_rval);
{
typedef TeamFunctor_FactorizeChol<supernode_info_type> functor_type;
functor_type functor(_info, _factorize_mode, _level_sids, _buf, d_rval.data());

#if defined(TACHO_TEST_LEVELSET_TOOLS_KERNEL_OVERHEAD)
typedef Kokkos::TeamPolicy<Kokkos::Schedule<Kokkos::Static>, exec_space, typename functor_type::DummyTag>
team_policy_factorize;
Expand All @@ -2204,11 +2209,8 @@ class NumericToolsLevelSet : public NumericToolsBase<ValueType, DeviceType> {
typedef Kokkos::TeamPolicy<Kokkos::Schedule<Kokkos::Static>, exec_space, typename functor_type::UpdateTag>
team_policy_update;
#endif

int rval = 0;
team_policy_factor policy_factor(1, 1, 1);
team_policy_update policy_update(1, 1, 1);
functor_type functor(_info, _factorize_mode, _level_sids, _buf, &rval);

// get max vector size
const ordinal_type vmax = policy_factor.vector_length_max();
Expand Down Expand Up @@ -2259,10 +2261,14 @@ class NumericToolsLevelSet : public NumericToolsBase<ValueType, DeviceType> {
Kokkos::fence(); time_device += tick.seconds();
tick.reset();
}
Kokkos::fence();
Kokkos::deep_copy(h_rval, d_rval);
int rval = h_rval(0);
if (rval != 0) {
TACHO_TEST_FOR_EXCEPTION(rval, std::runtime_error, "POTRF (team) returns non-zero error code.");
}
//if (_status != 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can be deleted in follow up cleanup?

// TACHO_TEST_FOR_EXCEPTION(rval, std::runtime_error, "POTRF (device) returns non-zero error code.");
//}

Kokkos::parallel_for("update factor", policy_update, functor);
if (verbose) {
Expand Down Expand Up @@ -3926,8 +3932,13 @@ class NumericToolsLevelSet : public NumericToolsBase<ValueType, DeviceType> {
const ordinal_type team_size_factor[2] = {64, 64}, vector_size_factor[2] = {8, 4};
#endif
const ordinal_type team_size_update[2] = {16, 8}, vector_size_update[2] = {32, 32};
// returned value from team LDL
colind_view d_rval("rval",1);
auto h_rval = Kokkos::create_mirror_view(host_memory_space(), d_rval);
{
typedef TeamFunctor_FactorizeLDL<supernode_info_type> functor_type;
functor_type functor(_info, _factorize_mode, _level_sids, _piv, _diag, _buf, d_rval.data());

#if defined(TACHO_TEST_LEVELSET_TOOLS_KERNEL_OVERHEAD)
typedef Kokkos::TeamPolicy<Kokkos::Schedule<Kokkos::Static>, exec_space, typename functor_type::DummyTag>
team_policy_factorize;
Expand All @@ -3940,12 +3951,10 @@ class NumericToolsLevelSet : public NumericToolsBase<ValueType, DeviceType> {
typedef Kokkos::TeamPolicy<Kokkos::Schedule<Kokkos::Static>, exec_space, typename functor_type::UpdateTag>
team_policy_update;
#endif
int rval = 0;
team_policy_factor policy_factor(1, 1, 1);
team_policy_update policy_update(1, 1, 1);
functor_type functor(_info, _factorize_mode, _level_sids, _piv, _diag, _buf, &rval);

// get max vector length
team_policy_factor policy_factor(1, 1, 1);
team_policy_update policy_update(1, 1, 1);
const ordinal_type vmax = policy_factor.vector_length_max();
{
for (ordinal_type lvl = (_team_serial_level_cut - 1); lvl >= 0; --lvl) {
Expand Down Expand Up @@ -3994,10 +4003,14 @@ class NumericToolsLevelSet : public NumericToolsBase<ValueType, DeviceType> {
Kokkos::fence(); time_device += tick.seconds();
tick.reset();
}
Kokkos::fence();
Kokkos::deep_copy(h_rval, d_rval);
int rval = h_rval(0);
if (rval != 0) {
TACHO_TEST_FOR_EXCEPTION(rval, std::runtime_error, "SYTRF (team) returns non-zero error code.");
}
//if (_status != 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can be deleted in follow up cleanup?

// TACHO_TEST_FOR_EXCEPTION(rval, std::runtime_error, "SYTRF (device) returns non-zero error code.");
//}

Kokkos::parallel_for("update factor", policy_update, functor);
if (verbose) {
Expand Down Expand Up @@ -4271,6 +4284,10 @@ class NumericToolsLevelSet : public NumericToolsBase<ValueType, DeviceType> {
const ordinal_type team_size_factor[2] = {64, 64}, vector_size_factor[2] = {8, 4};
#endif
const ordinal_type team_size_update[2] = {16, 8}, vector_size_update[2] = {32, 32};

// returned value from team LU
colind_view d_rval("rval",1);
auto h_rval = Kokkos::create_mirror_view(host_memory_space(), d_rval);
{
typedef TeamFunctor_FactorizeLU<supernode_info_type> functor_type;
#if defined(TACHO_TEST_LEVELSET_TOOLS_KERNEL_OVERHEAD)
Expand All @@ -4285,10 +4302,9 @@ class NumericToolsLevelSet : public NumericToolsBase<ValueType, DeviceType> {
typedef Kokkos::TeamPolicy<Kokkos::Schedule<Kokkos::Static>, exec_space, typename functor_type::UpdateTag>
team_policy_update;
#endif
int rval = 0;
team_policy_factor policy_factor(1, 1, 1);
team_policy_update policy_update(1, 1, 1);
functor_type functor(_info, _factorize_mode, _level_sids, _piv, _buf, &rval);
functor_type functor(_info, _factorize_mode, _level_sids, _piv, _buf, d_rval.data());
if (pivot_tol > 0.0) {
functor.setDiagPertubationTol(pivot_tol);
}
Expand Down Expand Up @@ -4342,13 +4358,15 @@ class NumericToolsLevelSet : public NumericToolsBase<ValueType, DeviceType> {
Kokkos::fence(); time_device += tick.seconds();
tick.reset();
}
Kokkos::fence();
Kokkos::deep_copy(h_rval, d_rval);
int rval = h_rval(0);
if (rval != 0) {
TACHO_TEST_FOR_EXCEPTION(rval, std::runtime_error, "GETRF (team) returns non-zero error code.");
}
if (_status != 0) {
TACHO_TEST_FOR_EXCEPTION(rval, std::runtime_error, "GETRF (device) returns non-zero error code.");
}
//if (_status != 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can be deleted in follow up cleanup?

// TACHO_TEST_FOR_EXCEPTION(rval, std::runtime_error, "GETRF (device) returns non-zero error code.");
//}

Kokkos::parallel_for("update factor", policy_update, functor);
if (verbose) {
Kokkos::fence(); time_update += tick.seconds();
Expand Down
Loading