1 #include <../../nrnconf.h> 19 #define MD 2147483647. 35 char* (*nrnpy_po2pickle)(
Object*,
size_t*);
36 Object* (*nrnpy_pickle2po)(
char*, size_t);
37 char* (*nrnpy_callpicklef)(
char*, size_t,
int,
size_t*);
42 double nrnmpi_transfer_wait_;
48 double nrnmpi_dbl_allreduce(
double,
int);
49 void nrnmpi_dbl_allreduce_vec(
double* src,
double* dest,
int cnt,
int type);
50 void nrnmpi_dbl_allgather(
double*,
double*,
int);
57 extern void nrnmpi_subworld_size(
int n);
81 OcBBS(
int nhost_request);
118 int id,
i, firstarg, style;
141 pname = (*nrnpy_po2pickle)(ob, &size);
151 bbs->
pkstr(ob->ctemplate->sym->name);
172 bbs->
pkint(argtypes);
263 nrnmpi_subworld_size(n);
343 bbs->
upkvec(n, vec->data());
345 hoc_execerror(
"pc.unpack can only unpack str, scalar, or Vector.",
346 "use pc.upkpyobj to unpack a Python Object");
368 return (
const char**)ps;
381 bbs->
upkvec(n, vec->data());
382 return vec->temp_objvar();
390 Object* po = (*nrnpy_pickle2po)(
s,
n);
417 Object* po = (*nrnpympi_alltoall_type)(size,
type);
479 return ((
OcBBS*)v)->time();
487 }
else if (mode == 1) {
490 return nrnmpi_transfer_wait_;
521 double w = ((
OcBBS*)v)->wait_time();
526 double w = ((
OcBBS*)v)->integ_time();
541 if (w < 0.) { w = 0.0; }
550 return ((
OcBBS*)v)->send_time();
586 bool gid_compress =
true;
592 gid_compress = (
chkarg(2, 0, 1) ?
true :
false);
611 int backbone_style = 2;
612 int reducedtree_host = 0;
615 sid = (
int)
chkarg(2, 0, (
double)(0x7fffffff));
675 double tstop =
chkarg(1,
t, 1e9);
680 }
else if (enabled == 0) {
685 return double(enabled);
695 int nsend, nsendmax, nrecv, nrecv_useful;
697 nsend = nsendmax = nrecv = nrecv_useful = 0;
702 return double(nsendmax);
755 if (n == 0) {
return 0.0; }
760 double* dest =
new double[
n];
761 nrnmpi_dbl_allreduce_vec(px, dest, n, type);
762 for (
int i = 0;
i <
n; ++
i) {
775 val = nrnmpi_dbl_allreduce(val, type);
791 nrnmpi_dbl_allgather(&val, px, 1);
809 hoc_execerror(
"size of source counts vector is not nhost", 0);
812 int* scnt =
new int[np];
813 int* sdispl =
new int[np+1];
815 for (i=0; i < np; ++
i) {
817 sdispl[i+1] = sdispl[
i] + scnt[
i];
819 if (ns != sdispl[np]) {
820 hoc_execerror(
"sum of source counts is not the size of the src vector", 0);
825 int* rcnt =
new int[np];
826 int* rdispl =
new int[np + 1];
827 int*
c =
new int[np];
829 for (i=0; i < np; ++
i) {
835 for (i=0; i < np; ++
i) {
836 rdispl[i+1] = rdispl[
i] + rcnt[
i];
847 for (i=0; i < ns; ++
i) {
988 hoc_execerror(
"nrncore_write: optional second arg is not a number (True or False append flag)",
NULL);
1137 retobj_members, retstr_members);
1157 int size = strlen(s) + 1;
1188 if (ob->
index == i) {
1194 fprintf(stderr,
"%s[%d] is not an Object in this process\n", s, i);
1201 hoc_execerror(
"with subworlds, this submit style not implemented", 0);
1203 }
else if (style == 3) {
1213 int size = strlen(s) + 1;
1221 if (style != 3 && !fname) {
1230 for (j = argtypes; (i = j%5) != 0; j /= 5) {
1243 int size = strlen(sarg[ns]) + 1;
1279 delete [] pickle_ret_;
1281 pickle_ret_size_ = 0;
1284 rs = (*nrnpy_callpicklef)(
s, npickle,
narg, size);
1296 for (i=0; i < ns; ++
i) {
static Object ** py_alltoall_type(int type)
int nrn_mpiabort_on_error_
double nrnmpi_rtcomp_time_
static double set_maxstep(void *v)
static double mech_time(void *v)
static double userid(void *v)
int nrnmpi_spike_compress(int nspike, bool gid_compress, int xchng_meth)
static double allgather(void *)
static double setup_transfer(void *)
void netpar_solve(double)
int hoc_is_str_arg(int narg)
void hoc_pushobj(Object **d)
double netpar_mindelay(double maxdelay)
static double pctime(void *v)
static double nrnmpi_splitcell_wait_
static double spcompress(void *v)
static double barrier(void *)
void nrnmpi_gid_clear(int)
int nrnmpi_numprocs_world
static double step_time(void *v)
static double source_var(void *)
bool working(int &id, double &x, int &userid)
#define ITERATE(itm, lst)
int hoc_is_double_arg(int narg)
char *(* nrnpy_callpicklef)(char *, size_t, int, size_t *)
Symbol * hoc_lookup(const char *)
char *(* nrnpy_po2pickle)(Object *, size_t *)
char * hoc_object_name(Object *ob)
double nrn_bgp_receive_time(int)
char * upkpickle(size_t *size)
check_obj_type(o, "SectionList")
static void nrnmpi_char_broadcast(char *, int, int)
static Object ** py_scatter(void *)
static double thread_busywait(void *)
size_t nrnbbcore_register_mapping()
For BBP use case, we want to write section-segment mapping to gid_3.dat file.
static Object ** py_broadcast(void *)
static double rank_world(void *v)
int nrncore_is_file_mode()
char ** hoc_pgargstr(int narg)
int nrncore_run(const char *)
int nrn_how_many_processors()
static double subworlds(void *v)
sprintf(buf," if (secondorder) {\ " int _i;\" " for(_i=0;_i< %d;++_i) {\" " _p[_slist%d[_i]]+=dt *_p[_dlist%d[_i]];\" " }}\", numeqn, listnum, listnum)
static double gid_clear(void *v)
int nrn_allow_busywait(int)
static double upkscalar(void *v)
double * hoc_pgetarg(int narg)
static int submit_help(OcBBS *)
static double nrncorerun(void *)
void upkvec(int n, double *px)
static double pack(void *v)
static double thread_how_many_proc(void *)
void hoc_assign_str(char **cpp, const char *buf)
static Member_ret_str_func retstr_members[]
int hoc_is_pdouble_arg(int narg)
void nrn_prcellstate(int gid, const char *suffix)
static double allreduce(void *)
static double set_mpiabort_on_error(void *)
static double multisplit(void *v)
int const size_t const size_t n
static double nrncorewrite_argvec(void *)
int nrncore_psolve(double tstop, int file_mode)
static double sec_in_thread(void *)
static double nrn_rank(void *v)
static void nrnmpi_int_broadcast(int *, int, int)
void class2oc(const char *, void *(*cons)(Object *), void(*destruct)(void *), Member_func *, int(*checkpoint)(void **), Member_ret_obj_func *, Member_ret_str_func *)
void hoc_obj_unref(Object *obj)
static double broadcast(void *)
static Object ** py_alltoall(void *)
virtual void return_args(int userid)
static void destruct(void *v)
static void nrnmpi_barrier()
bool look_take(const char *)
static double retval(void *v)
static double prcellstate(void *v)
Object *(* nrnpy_pickle2po)(char *, size_t)
static Object ** py_allgather(void *)
Object ** gid_connect(int)
static const char * fname(const char *name)
static double partition(void *)
void netpar_spanning_statistics(int *, int *, int *, int *)
static double maxhist(void *v)
void hoc_execerror(const char *, const char *)
static double splitcell_connect(void *v)
static Member_func members[]
static void nrnmpi_int_alltoallv(int *s, int *scnt, int *sdispl, int *r, int *rcnt, int *rdispl)
void pkpickle(const char *, size_t size)
fprintf(stderr, "Don't know the location of params at %p\, pp)
static double thread_stat(void *)
static double rank_bbs(void *v)
void set_gid2node(int, int)
static Object ** py_gather(void *)
virtual void unref() const
static Member_ret_obj_func retobj_members[]
void hoc_obj_ref(Object *obj)
int nrn_set_timeout(int timeout)
static void * cons(Object *)
static double thread_dt(void *)
static double alltoall(void *)
int nrnmpi_splitcell_connect(int that_host)
void nrnmpi_setup_transfer()
static double nhost_bbs(void *v)
void vector_resize(Vect *v, int n)
void nrn_threads_create(int, int)
static double nthrd(void *)
static double set_timeout(void *v)
void nrn_seg_or_x_arg(int iarg, Section **psec, double *px)
static double step_wait(void *v)
static Object ** upkpyobj(void *v)
static double thread_ctime(void *)
int vector_capacity(Vect *v)
static void phase_end(const char *name)
IvocVect * netpar_max_histogram(IvocVect *)
static void phase_begin(const char *name)
Object *(* nrnpympi_alltoall_type)(int, int)
int hoc_obj_run(const char *, Object *)
HocStruct cTemplate * ctemplate
void pkvec(int n, double *px)
static void nrnmpi_dbl_alltoallv(double *s, int *scnt, int *sdispl, double *r, int *rcnt, int *rdispl)
Symbol * hoc_table_lookup(const char *, Symlist *)
static void nrnmpi_dbl_broadcast(double *, int, int)
void spike_record(int, IvocVect *, IvocVect *)
static double nhost_world(void *v)
Symbol * hoc_which_template(Symbol *)
static void unpack_help(int, OcBBS *)
static double nrnmpi_wtime()
double * vector_vec(Vect *v)
static double nrncorewrite_argappend(void *)
static double psolve(void *v)
void ParallelContext_reg()
static void pack_help(int, OcBBS *)
int hoc_is_object_arg(int narg)
void hoc_pushstr(char **d)
int nrnmpi_multisplit(Section *, double x, int sid, int backbonestyle)
static const char ** pname(void *v)
static double nrn_thread_t(void *)
double hoc_call_objfunc(Symbol *s, int narg, Object *ob)
void master_works(int flag)
Object ** hoc_temp_objptr(Object *)
static double target_var(void *)
static double unpack(void *v)
Object ** hoc_objgetarg(int)
static double vtransfer_time(void *v)
Section * chk_access(void)
double chkarg(int, double low, double high)
static double spike_stat(void *v)
char * execute_helper(size_t *, int id, bool exec=true)
static double event_time(void *v)
bool nrn_trajectory_request_per_time_step_
int vector_arg_px(int, double **)
void nrn_thread_partition(int, Object *)