Skip to content
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: 4 additions & 4 deletions include/wassail/data/mpirun.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
#ifndef _WASSAIL_DATA_MPIRUN_HPP
#define _WASSAIL_DATA_MPIRUN_HPP

#include <list>
#include <string>
#include <vector>
#include <wassail/data/shell_command.hpp>

namespace wassail {
Expand All @@ -32,7 +32,7 @@ namespace wassail {

std::string hostfile; /*!< Path to file containing list of hosts */

std::vector<std::string> hostlist; /*!< List of hosts */
std::list<std::string> hostlist; /*!< List of hosts */

std::string mpirun_args; /*!< extra mpirun arguments */

Expand Down Expand Up @@ -82,7 +82,7 @@ namespace wassail {
* \param[in] program MPI program to launch
* \param[in] mpi_impl MPI implementation
*/
mpirun(uint32_t num_procs, std::vector<std::string> hostlist,
mpirun(uint32_t num_procs, std::list<std::string> hostlist,
std::string program, mpi_impl_t mpi_impl = mpi_impl_t::OPENMPI)
: mpirun(num_procs, 0, hostlist, "", program, "", 60, mpi_impl) {};

Expand Down Expand Up @@ -112,7 +112,7 @@ namespace wassail {
* \param[in] mpi_impl MPI implementation
*/
mpirun(uint32_t num_procs, uint32_t per_node,
std::vector<std::string> hostlist, std::string mpirun_args,
std::list<std::string> hostlist, std::string mpirun_args,
std::string program, std::string program_args, uint8_t timeout,
mpi_impl_t mpi_impl = mpi_impl_t::OPENMPI);

Expand Down
5 changes: 2 additions & 3 deletions include/wassail/data/osu_micro_benchmarks.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@ namespace wassail {
* \param[in] osu_benchmark OSU micro-benchmark to launch
* \param[in] mpi_impl MPI implementation
*/
osu_micro_benchmarks(uint32_t num_procs,
std::vector<std::string> hostlist,
osu_micro_benchmarks(uint32_t num_procs, std::list<std::string> hostlist,
osu_benchmark_t osu_benchmark,
mpi_impl_t mpi_impl = mpi_impl_t::OPENMPI)
: osu_micro_benchmarks(num_procs, 0, hostlist, "", osu_benchmark, 60,
Expand Down Expand Up @@ -107,7 +106,7 @@ namespace wassail {
* \param[in] mpi_impl MPI implementation
*/
osu_micro_benchmarks(uint32_t num_procs, uint32_t per_node,
std::vector<std::string> hostlist,
std::list<std::string> hostlist,
std::string mpirun_args,
osu_benchmark_t osu_benchmark, uint8_t timeout,
mpi_impl_t mpi_impl = mpi_impl_t::OPENMPI)
Expand Down
12 changes: 7 additions & 5 deletions src/data/mpirun.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
#include "internal.hpp"

#include <cstdlib>
#include <list>
#include <numeric>
#include <stdexcept>
#include <string>
#include <vector>
#include <wassail/data/mpirun.hpp>

namespace wassail {
Expand All @@ -27,7 +27,7 @@ namespace wassail {
}

mpirun::mpirun(uint32_t num_procs, uint32_t per_node,
std::vector<std::string> hostlist, std::string mpirun_args,
std::list<std::string> hostlist, std::string mpirun_args,
std::string program, std::string program_args,
uint8_t timeout, mpi_impl_t mpi_impl)
: mpi_impl(mpi_impl), hostlist(hostlist), mpirun_args(mpirun_args),
Expand Down Expand Up @@ -65,7 +65,8 @@ namespace wassail {
/* create comma separated list */
command += wassail::format(
" -hosts {0}",
std::accumulate(hostlist.begin() + 1, hostlist.end(), hostlist[0],
std::accumulate(std::next(hostlist.begin()), hostlist.end(),
hostlist.front(),
[](const std::string &a, std::string b) {
return a + "," + b;
}));
Expand Down Expand Up @@ -105,7 +106,8 @@ namespace wassail {
/* create comma separated list */
command += wassail::format(
" -H {0}",
std::accumulate(hostlist.begin() + 1, hostlist.end(), hostlist[0],
std::accumulate(std::next(hostlist.begin()), hostlist.end(),
hostlist.front(),
[](const std::string &a, std::string b) {
return a + "," + b;
}));
Expand Down Expand Up @@ -153,7 +155,7 @@ namespace wassail {

d.hostfile = j.value(json::json_pointer("/configuration/hostfile"), "");
d.hostlist = j.value(json::json_pointer("/configuration/hostlist"),
std::vector<std::string>({}));
std::list<std::string>({}));

std::string mpi_impl =
j.value(json::json_pointer("/configuration/mpi_impl"), "");
Expand Down
8 changes: 4 additions & 4 deletions src/python/data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ void py_data(py::module &m) {
.def(py::init<uint32_t, std::string>())
.def(py::init<uint32_t, std::string, wassail::data::mpirun::mpi_impl_t>())
.def(py::init<uint32_t, std::string, std::string>())
.def(py::init<uint32_t, std::vector<std::string>, std::string>())
.def(py::init<uint32_t, std::list<std::string>, std::string>())
.def(py::init<uint32_t, uint32_t, std::string, std::string, std::string,
std::string, uint8_t, wassail::data::mpirun::mpi_impl_t>())
.def(py::init<uint32_t, uint32_t, std::vector<std::string>, std::string,
.def(py::init<uint32_t, uint32_t, std::list<std::string>, std::string,
std::string, std::string, uint8_t,
wassail::data::mpirun::mpi_impl_t>())
.def("__str__",
Expand Down Expand Up @@ -103,13 +103,13 @@ void py_data(py::module &m) {
.def(py::init<uint32_t, std::string,
wassail::data::osu_micro_benchmarks::osu_benchmark_t,
wassail::data::mpirun::mpi_impl_t>())
.def(py::init<uint32_t, std::vector<std::string>,
.def(py::init<uint32_t, std::list<std::string>,
wassail::data::osu_micro_benchmarks::osu_benchmark_t,
wassail::data::mpirun::mpi_impl_t>())
.def(py::init<uint32_t, uint32_t, std::string, std::string,
wassail::data::osu_micro_benchmarks::osu_benchmark_t,
uint8_t, wassail::data::mpirun::mpi_impl_t>())
.def(py::init<uint32_t, uint32_t, std::vector<std::string>, std::string,
.def(py::init<uint32_t, uint32_t, std::list<std::string>, std::string,
wassail::data::osu_micro_benchmarks::osu_benchmark_t,
uint8_t, wassail::data::mpirun::mpi_impl_t>())
.def("__str__",
Expand Down
8 changes: 4 additions & 4 deletions test/data/test_mpirun.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
#include "3rdparty/catch/catch.hpp"
#include "3rdparty/catch/catch_reporter_automake.hpp"

#include <list>
#include <string>
#include <unistd.h>
#include <vector>
#include <wassail/data/mpirun.hpp>

/* Some tests may fail if mpi is not setup */
Expand Down Expand Up @@ -50,8 +50,8 @@ TEST_CASE("mpirun hostfile usage") {
}

TEST_CASE("mpirun hostlist usage") {
auto d1 = wassail::data::mpirun(
2, std::vector<std::string>({"node1", "node2"}), "a.out");
auto d1 = wassail::data::mpirun(2, std::list<std::string>({"node1", "node2"}),
"a.out");

if (getuid() == 0 and d1.allow_run_as_root) {
REQUIRE(d1.command == "mpirun -n 2 -H node1,node2 --allow-run-as-root -x "
Expand All @@ -63,7 +63,7 @@ TEST_CASE("mpirun hostlist usage") {
}

auto d2 =
wassail::data::mpirun(2, std::vector<std::string>({"node1", "node2"}),
wassail::data::mpirun(2, std::list<std::string>({"node1", "node2"}),
"a.out", wassail::data::mpirun::mpi_impl_t::MPICH);
REQUIRE(d2.command ==
"MPIEXEC_TIMEOUT=60 mpirun -n 2 -hosts node1,node2 a.out");
Expand Down
Loading