-
Fixes #700 Usage in python as: ``` >>>import arbor >>>arbor.config() {'mpi': True, 'mpi4py': True, 'gpu': False, 'version': '0.1.1-dev'} >>>d = arbor.config() >>>arbor.print_config(d) Arbor's configuration: mpi : True mpi4py : True gpu : False version: 0.1.1-dev ```
7c0b8236
strings.cpp 810 B
#include <string>
#include <sstream>
#include <arbor/context.hpp>
#include "strings.hpp"
namespace pyarb {
std::string context_string(const arb::context& c) {
std::stringstream s;
const bool gpu = arb::has_gpu(c);
const bool mpi = arb::has_mpi(c);
s << "<context: threads " << arb::num_threads(c)
<< ", gpu " << (gpu? "yes": "None")
<< ", distributed " << (mpi? "MPI": "Local")
<< " ranks " << arb::num_ranks(c)
<< ">";
return s.str();
}
std::string proc_allocation_string(const arb::proc_allocation& a) {
std::stringstream s;
s << "<hardware resource allocation: threads " << a.num_threads << ", gpu ";
if (a.has_gpu()) {
s << a.gpu_id;
}
else {
s << "None";
}
s << ">";
return s.str();
}
} // namespace pyarb