env processing "too early" in bench/nebr_exchange.cpp

Issue #259 resolved
Paul Hargrove created an issue

Currently the test parameters for bench/nebr_exchange.cpp are globals with initializers:

const vector<size_t> buf_sizes = os_env<vector<size_t>>("sizes", vector<size_t>({1<<10}));
const vector<int> nebr_nums = os_env<vector<int>>("nebrs", std::vector<int>({10}));
const double nebr_stdev = os_env<double>("nebr_stdev", 10.0);
const double wait_secs = os_env<double>("wait_secs", 1.0);

Because these initializers run before upcxx::init(), they cannot use upcxx::getenv_console(). As a result, correct operation of the test often requires something like the following:

$ upcxx-run -n 2 env sizes='1 1024 100000' ./nebr_exchange

where it would be more natural to use

$ env sizes='1 1024 100000' upcxx-run -n 2 ./nebr_exchange

I have observed that use of the second form can result in hangs or crashes when rank 0 has parsed the environment variables and the other rank(s) are using the defaults.

Comments (3)

  1. Paul Hargrove reporter

    Delay env processing in nebr_exchange

    This commit moves the environment processing in nebr_exchange.cpp to occur after the call to upcxx::init(), thus allowing use of upcxx::getenv_console().

    This resolves issue 259

    → <<cset 08be3ca2c1c7>>

  2. Log in to comment