Skip to content

Commit

Permalink
Add command line option to ignore batch environment
Browse files Browse the repository at this point in the history
  • Loading branch information
hkaiser committed Jun 26, 2015
1 parent 9f598c2 commit f0ee8cc
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions docs/manual/commandline.qbk
Expand Up @@ -53,6 +53,7 @@ described in the table below:
application startup (default: 1)]]
[[`--hpx:node arg`] [number of the node this locality is run on
(must be unique)]]
[[`--hpx:ignore-batch-env`] [ignore batch environment variables]]
[[`--hpx:pu-offset`] [the first processing unit this instance of __hpx__ should be
run on (default: 0), valid for
`--hpx:queuing=local`, `--hpx:queuing=abp-priority`,
Expand Down
3 changes: 2 additions & 1 deletion hpx/util/batch_environment.hpp
Expand Up @@ -28,7 +28,8 @@ namespace hpx { namespace util
{
// the constructor tries to read initial values from a batch environment, filling our
// map of nodes and thread counts
batch_environment(std::vector<std::string> & nodelist, bool debug = false);
batch_environment(std::vector<std::string> & nodelist,
bool debug = false, bool enable = true);

// this function initializes the map of nodes from the given (space
// separated) list of nodes
Expand Down
6 changes: 5 additions & 1 deletion src/util/batch_environment.cpp
Expand Up @@ -26,13 +26,17 @@

namespace hpx { namespace util
{
batch_environment::batch_environment(std::vector<std::string> & nodelist, bool debug)
batch_environment::batch_environment(std::vector<std::string> & nodelist,
bool debug, bool enable)
: agas_node_num_(0)
, node_num_(-1)
, num_threads_(-1)
, num_localities_(-1)
, debug_(debug)
{
if (!enable)
return;

batch_environments::alps_environment alps_env(nodelist, debug);
if(alps_env.valid())
{
Expand Down
5 changes: 3 additions & 2 deletions src/util/command_line_handling.cpp
Expand Up @@ -383,7 +383,7 @@ namespace hpx { namespace util
if (debug_clp)
std::cerr << "failed opening: " << node_file << std::endl;

// raise hard error if nodefile could not be opened
// raise hard error if node file could not be opened
throw hpx::detail::command_line_error(boost::str(boost::format(
"Could not open nodefile: '%s'") % node_file));
}
Expand All @@ -392,7 +392,8 @@ namespace hpx { namespace util
nodelist = vm["hpx:nodes"].as<std::vector<std::string> >();
}

util::batch_environment env(nodelist, debug_clp);
bool enable_batch_env = vm.count("hpx:ignore-batch-env") == 0;
util::batch_environment env(nodelist, debug_clp, enable_batch_env);

if(!nodelist.empty())
{
Expand Down
1 change: 1 addition & 0 deletions src/util/parse_command_line.cpp
Expand Up @@ -403,6 +403,7 @@ namespace hpx { namespace util
("hpx:node", value<std::size_t>(),
"number of the node this locality is run on "
"(must be unique, alternatively: -0, -1, ..., -9)")
("hpx:ignore-batch-env", "ignore batch environment variables")
#if defined(HPX_HAVE_HWLOC) || defined(BOOST_WINDOWS)
("hpx:pu-offset", value<std::size_t>(),
"the first processing unit this instance of HPX should be "
Expand Down

0 comments on commit f0ee8cc

Please sign in to comment.