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

Fixing number of configured localities #1572

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/util/command_line_handling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ namespace hpx { namespace util
std::size_t num_localities)
{
std::size_t batch_localities = env.retrieve_number_of_localities();
if (num_localities == 1)
if (num_localities == 1 &&
batch_localities != std::size_t(batch_localities))
{
std::size_t cfg_num_localities = cfgmap.get_value<std::size_t>(
"hpx.localities", batch_localities);
Expand Down
1 change: 1 addition & 0 deletions tests/unit/util/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ set(tests
any_serialization
boost_any
bind_action
configuration
function
parse_slurm_nodelist
stencil3_iterator
Expand Down
30 changes: 30 additions & 0 deletions tests/unit/util/configuration.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Copyright (c) 2015 Hartmut Kaiser
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

#include <hpx/hpx.hpp>
#include <hpx/util/lightweight_test.hpp>

int hpx_main(int argc, char* argv[])
{
// check number of localities
HPX_TEST_EQ(
boost::lexical_cast<boost::uint32_t>(
hpx::get_config_entry("hpx.localities", "")),
hpx::get_num_localities_sync());
HPX_TEST_EQ(
boost::lexical_cast<std::size_t>(
hpx::get_config_entry("hpx.os_threads", "")),
hpx::get_os_thread_count());
HPX_TEST_EQ(hpx::get_config_entry("hpx.runtime_mode", ""),
std::string("console"));

return hpx::finalize();
}

int main(int argc, char* argv[])
{
HPX_TEST_EQ(hpx::init(argc, argv), 0);
return hpx::util::report_errors();
}