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

Some fixes for hwloc and the distributed-solver example #1230

Merged
merged 4 commits into from
Dec 9, 2022
Merged
Show file tree
Hide file tree
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
8 changes: 6 additions & 2 deletions examples/distributed-solver/distributed-solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ int main(int argc, char* argv[])
if (argc == 2 && (std::string(argv[1]) == "--help")) {
if (rank == 0) {
std::cerr << "Usage: " << argv[0]
<< " [executor] [num_grid_points] " << std::endl;
<< " [executor] [num_grid_points] [num_iterations] "
<< std::endl;
}
std::exit(-1);
}
Expand All @@ -104,6 +105,8 @@ int main(int argc, char* argv[])
const auto executor_string = argc >= 2 ? argv[1] : "reference";
const auto grid_dim =
static_cast<gko::size_type>(argc >= 3 ? std::atoi(argv[2]) : 100);
const auto num_iters =
static_cast<gko::size_type>(argc >= 4 ? std::atoi(argv[3]) : 1000);

// Pick the requested executor.
std::map<std::string, std::function<std::shared_ptr<gko::Executor>()>>
Expand Down Expand Up @@ -216,7 +219,8 @@ int main(int argc, char* argv[])
auto Ainv =
solver::build()
.with_criteria(
gko::stop::Iteration::build().with_max_iters(100u).on(exec),
gko::stop::Iteration::build().with_max_iters(num_iters).on(
exec),
gko::stop::ResidualNorm<ValueType>::build()
.with_baseline(gko::stop::mode::absolute)
.with_reduction_factor(1e-4)
Expand Down
2 changes: 1 addition & 1 deletion examples/distributed-solver/doc/intro.dox
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<h1>Introduction</h1>
This distributed solver example should help you understand the basics of using Ginkgo in a distributed setting.
The example will solve a simple 1D Laplace equation where the system can be distributed row-wise to multiple processes.
To run the solver with multiple processes, use `mpirun -n NUM_PROCS ./distributed-solver [executor] [num_grid_points]`.
To run the solver with multiple processes, use `mpirun -n NUM_PROCS ./distributed-solver [executor] [num_grid_points] [num_iterations]`.

If you are using GPU devices, please make sure that you run this example with at most as many processes as you have GPU
devices available.
10 changes: 2 additions & 8 deletions include/ginkgo/core/base/executor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1526,10 +1526,7 @@ class CudaExecutor : public detail::ExecutorBase<CudaExecutor>,
this->get_exec_info().num_pu_per_cu = 0;
this->CudaExecutor::populate_exec_info(
machine_topology::get_instance());
if (this->get_exec_info().closest_pu_ids.size()) {
machine_topology::get_instance()->bind_to_pus(
this->get_closest_pus());
}

// it only gets attribute from device, so it should not be affected by
// DeviceReset.
this->set_gpu_property();
Expand Down Expand Up @@ -1732,10 +1729,7 @@ class HipExecutor : public detail::ExecutorBase<HipExecutor>,
this->get_exec_info().num_computing_units = 0;
this->get_exec_info().num_pu_per_cu = 0;
this->HipExecutor::populate_exec_info(machine_topology::get_instance());
if (this->get_exec_info().closest_pu_ids.size()) {
machine_topology::get_instance()->bind_to_pus(
this->get_closest_pus());
}

// it only gets attribute from device, so it should not be affected by
// DeviceReset.
this->set_gpu_property();
Expand Down