14 #include "utils/profile/profiler_interface.h"
20 #define MD 2147483647.
36 double nrnmpi_transfer_wait_;
40 #include "nrnmpidec.h"
59 OcBBS(
int nhost_request);
94 int id,
i, firstarg, style;
114 std::vector<char>
pname{};
118 if (!
pname.empty()) {
145 bbs->
pkint(argtypes);
234 nrnmpi_subworld_size(
n);
315 hoc_execerror(
"pc.unpack can only unpack str, scalar, or Vector.",
316 "use pc.upkpyobj to unpack a Python Object");
338 return (
const char**) ps;
380 size = int(
chkarg(2, -1, 2.14748e9));
444 return ((
OcBBS*)
v)->time();
452 }
else if (mode == 1) {
455 return nrnmpi_transfer_wait_;
486 double w = ((
OcBBS*)
v)->wait_time();
491 double w = ((
OcBBS*)
v)->integ_time();
517 return ((
OcBBS*)
v)->send_time();
553 bool gid_compress =
true;
559 gid_compress = (
chkarg(2, 0, 1) ? true :
false);
562 xchng_meth = (int)
chkarg(3, 0, 15);
578 int backbone_style = 2;
581 sid = (int)
chkarg(2, 0, (
double) (0x7fffffff));
584 backbone_style = (int)
chkarg(3, 0, 2);
594 arg = int(
chkarg(1, 0, 10000));
611 arg = int(
chkarg(1, 0, 4));
641 double tstop =
chkarg(1,
t, 1e9);
646 }
else if (enabled == 0) {
651 return double(enabled);
661 int nsend, nsendmax, nrecv, nrecv_useful;
663 nsend = nsendmax = nrecv = nrecv_useful = 0;
674 return double(nsendmax);
738 double* dest =
new double[
n];
739 nrnmpi_dbl_allreduce_vec(px, dest,
n,
type);
740 for (
int i = 0;
i <
n; ++
i) {
753 val = nrnmpi_dbl_allreduce(val,
type);
769 nrnmpi_dbl_allgather(&val, px, 1);
789 std::size_t ns = vsrc->
size();
790 if (vscnt->
size() !=
np) {
791 hoc_execerror(
"size of source counts vector is not nhost",
nullptr);
793 const std::vector<int> scnt(vscnt->
begin(), vscnt->
end());
794 std::vector<int> sdispl(
np + 1);
795 for (
int i = 0;
i <
np; ++
i) {
796 sdispl[
i + 1] = sdispl[
i] + scnt[
i];
798 if (ns != sdispl[
np]) {
799 hoc_execerror(
"sum of source counts is not the size of the src vector",
nullptr);
803 std::vector<int> rcnt(
np);
804 std::vector<int>
c(
np, 1);
805 std::vector<int> rdispl(
np + 1);
806 std::iota(rdispl.begin(), rdispl.end(), 0);
809 scnt.data(),
c.data(), rdispl.data(), rcnt.data(),
c.data(), rdispl.data());
810 for (
int i = 0;
i <
np; ++
i) {
811 rdispl[
i + 1] = rdispl[
i] + rcnt[
i];
815 vsrc->
data(), scnt.data(), sdispl.data(), vdest->
data(), rcnt.data(), rdispl.data());
873 ip = bool(
chkarg(2, 0, 1));
937 return double(
sec->pnode[0]->_nt->id);
969 hoc_execerror(
"nrnbbcore_write: optional second arg is not a Vector",
nullptr);
980 nrnmpi_print_memory_stats(memory_stats);
991 "nrncore_write: optional second arg is not a number (True or False append flag)",
1170 std::vector<char> rs{};
1173 char* statement =
upkstr();
1175 int size = strlen(statement) + 1;
1183 std::vector<char> python_pickle{};
1186 std::list<char*>
sarg;
1191 char* template_name =
upkstr();
1192 int object_index =
upkint();
1204 if (ob->
index == object_index) {
1211 "%s[%d] is not an Object in this process\n",
1216 delete[] template_name;
1217 char* fname_str =
upkstr();
1220 fprintf(stderr,
"%s not a function in %s\n", fname_str,
hoc_object_name(ob));
1225 hoc_execerror(
"with subworlds, this submit style not implemented",
nullptr);
1227 }
else if (style == 3) {
1230 int size =
static_cast<int>(python_pickle.size());
1235 char* fname_str =
upkstr();
1237 int size = strlen(fname_str) + 1;
1243 fprintf(stderr,
"%s not a function in %s\n", fname_str,
hoc_object_name(ob));
1254 for (
int i = 0,
j = argtypes; (
i =
j % 5) != 0;
j /= 5) {
1262 }
else if (
i == 2) {
1265 int size = strlen(
sarg.back()) + 1;
1270 }
else if (
i == 3) {
1283 int size =
static_cast<int>(
s.size());
1306 for (
auto& arg:
sarg) {
1335 int style =
info[1];
1339 char*
s =
new char[size];
1348 std::vector<char>
s{};
1359 }
else if (style == 1) {
1377 for (
j = argtypes; (
i =
j % 5) != 0;
j /= 5) {
1384 }
else if (
i == 2) {
1387 sarg[ns] =
new char[size];
1391 }
else if (
i == 3) {
1400 std::vector<char>
s(
n);
1415 for (
i = 0;
i < ns; ++
i) {
static void nrnmpi_dbl_alltoallv(const double *s, const int *scnt, const int *sdispl, double *r, int *rcnt, int *rdispl)
static void nrnmpi_int_alltoallv(const int *s, const int *scnt, const int *sdispl, int *r, int *rcnt, int *rdispl)
static void nrnmpi_barrier()
bool look_take(const char *)
void spike_record(int, IvocVect *, IvocVect *)
Object ** gid_connect(int)
void master_works(int flag)
std::vector< char > upkpickle()
void set_gid2node(int, int)
void upkvec(int n, double *px)
void netpar_solve(double)
void pkvec(int n, double *px)
bool working(int &id, double &x, int &userid)
IvocVect * netpar_max_histogram(IvocVect *)
void netpar_spanning_statistics(int *, int *, int *, int *)
void pkpickle(const std::vector< char > &)
double netpar_mindelay(double maxdelay)
virtual void return_args(int userid)
std::vector< char > execute_helper(int id, bool exec=true)
virtual void upkvec(int, double *)=0
virtual char * upkstr()=0
virtual std::vector< char > upkpickle()=0
void subworld_worker_execute()
std::vector< char > pickle_ret_
virtual double upkdouble()=0
auto begin() const -> std::vector< double >::const_iterator
double const * data() const
auto end() const -> std::vector< double >::const_iterator
virtual void unref() const
void class2oc(const char *, ctor_f *cons, dtor_f *destruct, Member_func *, Member_ret_obj_func *, Member_ret_str_func *)
Symbol * hoc_table_lookup(const char *, Symlist *)
HocReturnType hoc_return_type_code
double chkarg(int, double low, double high)
int hoc_is_object_arg(int narg)
void hoc_pushstr(char **d)
double * hoc_getarg(int narg)
void vector_resize(IvocVect *v, int n)
int vector_arg_px(int, double **)
void hoc_pushobj(Object **d)
int hoc_is_str_arg(int narg)
void hoc_assign_str(char **cpp, const char *buf)
double hoc_call_objfunc(Symbol *s, int narg, Object *ob)
int hoc_is_double_arg(int narg)
void check_obj_type(Object *obj, const char *type_name)
IvocVect * vector_arg(int i)
void hoc_obj_ref(Object *obj)
char * hoc_object_name(Object *ob)
double * hoc_pgetarg(int narg)
Symbol * hoc_lookup(const char *)
int hoc_is_pdouble_arg(int narg)
void hoc_obj_unref(Object *obj)
int nrn_mpiabort_on_error_
char ** hoc_pgargstr(int narg)
Object ** hoc_objgetarg(int)
int hoc_obj_run(const char *, Object *)
#define ITERATE(itm, lst)
static double nrnmpi_splitcell_wait_
static double nrnmpi_wtime()
static void phase_end(const char *name)
static void phase_begin(const char *name)
void nrn_threads_create(int n)
double * vector_vec(IvocVect *v)
void hoc_execerror(const char *s1, const char *s2)
void print_memory_usage(const MemoryUsage &usage)
MemoryUsage local_memory_usage()
Gather memory usage of this process.
impl_ptrs methods
Collection of pointers to functions with python-version-specific implementations.
int Sprintf(char(&buf)[N], const char *fmt, Args &&... args)
Redirect sprintf to snprintf if the buffer size can be deduced.
int interleave_permute_type
int nrn_optimize_node_order(int type)
Select node ordering for optimum gaussian elimination.
void nrn_seg_or_x_arg(int iarg, Section **psec, double *px)
int const size_t const size_t n
int nrn_allow_busywait(int b)
Object ** nrn_get_thread_partition(int it)
int nrn_how_many_processors()
void nrn_thread_partition(int it, Object *sl)
std::size_t nof_worker_threads()
std::vector< char > call_picklef(const std::vector< char > &fname, int narg)
static std::vector< char > pickle(PyObject *p)
static Object * pickle2po(const std::vector< char > &s)
static std::vector< char > po2pickle(Object *ho)
int nrnmpi_numprocs_world
static double spike_record(void *v)
static double spike_stat(void *v)
int nrncore_run(const char *)
int nrn_set_timeout(int timeout)
static double step_time(void *v)
static double partition(void *)
size_t nrnbbcore_register_mapping()
For BBP use case, we want to write section-segment mapping to gid_3.dat file.
static Object ** upkpyobj(void *v)
static double print_memory_stats(void *)
static double nhost(void *v)
static double nthrd(void *)
static Object ** upkvec(void *v)
void ParallelContext_reg()
Symbol * hoc_which_template(Symbol *)
static double userid(void *v)
static double nrncorerun(void *)
void nrn_prcellstate(int gid, const char *suffix)
static double pctime(void *v)
static double thread_dt(void *)
double nrn_multisend_receive_time(int)
static double prcellstate(void *v)
static void unpack_help(int, OcBBS *)
static double nhost_world(void *v)
static double look_take(void *v)
static double working(void *v)
static double send_time(void *v)
static double alltoall(void *)
static double wait_time(void *v)
static double outputcell(void *v)
static double master_works(void *v)
static double done(void *v)
static Object ** gid2cell(void *v)
static double event_time(void *v)
static Member_ret_str_func retstr_members[]
static double thread_stat(void *)
static Member_func members[]
int nrncore_is_file_mode()
static void * cons(Object *)
static double set_gid2node(void *v)
static void pack_help(int, OcBBS *)
static double nrncorewrite_argvec(void *)
int nrncore_psolve(double tstop, int file_mode)
static double rank_bbs(void *v)
static void destruct(void *v)
static double retval(void *v)
static Object ** py_gather(void *)
static double context(void *v)
static Object ** py_alltoall_type(int type)
static double spcompress(void *v)
static void nrnmpi_dbl_broadcast(double *, int, int)
static double nrn_thread_t(void *)
static double thread_how_many_proc(void *)
static double thread_ctime(void *)
static double splitcell_connect(void *v)
static double gid_clear(void *v)
static double source_var(void *)
static void nrnmpi_char_broadcast(char *, int, int)
static double setup_transfer(void *)
static Object ** py_broadcast(void *)
static double allgather(void *)
static double threshold(void *v)
static double nhost_bbs(void *v)
static double integ_time(void *v)
static double sec_in_thread(void *)
static double thread_busywait(void *)
static double take(void *v)
static double step_wait(void *v)
static Object ** pyret(void *v)
static double subworlds(void *v)
static double vtransfer_time(void *v)
static double pack(void *v)
double nrnmpi_rtcomp_time_
static double cell(void *v)
static double mech_time(void *v)
static void nrnmpi_int_broadcast(int *, int, int)
static Object ** py_alltoall(void *)
static double set_timeout(void *v)
void nrnmpi_gid_clear(int)
static double multisplit(void *v)
int nrnmpi_spike_compress(int nspike, bool gid_compress, int xchng_meth)
static double nrncorewrite_argappend(void *)
static double post(void *v)
static double rank_world(void *v)
static double gid_exists(void *v)
static double set_maxstep(void *v)
static Member_ret_obj_func retobj_members[]
static double submit(void *v)
static double optimize_node_order(void *)
static double worker(void *v)
static Object ** gid_connect(void *v)
static Object ** py_allgather(void *)
static double nrn_rank(void *v)
static double target_var(void *)
static double broadcast(void *)
static Object ** gid2obj(void *v)
void nrnmpi_setup_transfer()
int nrnmpi_multisplit(Section *, double x, int sid, int backbonestyle)
static double barrier(void *)
bool nrn_trajectory_request_per_time_step_
static Object ** py_scatter(void *)
static int submit_help(OcBBS *)
static double unpack(void *v)
static const char ** upkstr(void *v)
static Object ** get_partition(void *)
static double number_of_worker_threads(void *)
int nrnmpi_splitcell_connect(int that_host)
static double upkscalar(void *v)
static double maxhist(void *v)
static double look(void *v)
static double psolve(void *v)
static double allreduce(void *)
static double set_mpiabort_on_error(void *)
static const char ** pname(void *v)
Object ** hoc_temp_objptr(Object *)
Overall SoA datastructures related memory usage.
std::vector< char >(* call_picklef)(const std::vector< char > &, int narg)
std::vector< char >(* po2pickle)(Object *)
Object *(* mpi_alltoall_type)(int, int)
Object *(* pickle2po)(const std::vector< char > &)