177 grp =
new int[ngrp + 1];
178 (*nrn2core_group_ids_)(grp);
182 FILE*
fp = fopen(filesdat,
"r");
185 nrn_fatal_error(
"No input file ( %s ) with nrnthreads, exiting...", filesdat);
197 if (iNumFiles == -1) {
201 printf(
"Model uses gap junctions\n");
207 "Info : The number of input datasets are less than ranks, some ranks will be idle!\n");
214 for (
int iNum = 0; iNum < iNumFiles; ++iNum) {
239 auto gid2out_it =
gid2out.find(gid);
240 if (gid2out_it !=
gid2out.end()) {
241 *ps = gid2out_it->second;
243 auto gid2in_it =
gid2in.find(gid);
244 if (gid2in_it !=
gid2in.end()) {
245 *psi = gid2in_it->second;
251 *ps = gid2out_it->second;
266 std::vector<InputPreSyn*> inputpresyn_;
279 auto gid2out_it =
gid2out.find(gid);
280 if (gid2out_it !=
gid2out.end()) {
282 ++gid2out_it->second->nc_cnt_;
285 auto gid2in_it =
gid2in.find(gid);
286 if (gid2in_it !=
gid2in.end()) {
288 ++gid2in_it->second->nc_cnt_;
296 inputpresyn_.push_back(psi);
300 if (!negsrcgid_tid.empty()) {
301 tid = negsrcgid_tid[i_tid++];
306 ++gid2out_it->second->nc_cnt_;
347 for (
auto psi: inputpresyn_) {
348 psi->nc_index_ = offset;
349 offset += psi->nc_cnt_;
353 inputpresyn_.clear();
376 if (!negsrcgid_tid.empty() && gid < -1) {
377 tid = negsrcgid_tid[i_tid++];
410 bool is_mapping_needed,
412 bool run_setup_cleanup,
414 const char* restore_path,
424 strlen(restore_path) == 0 ? datpath : restore_path,
439 pnttype2presyn.clear();
440 pnttype2presyn.resize(
memb_func.size(), -1);
485 coreneuron::phase_wrapper<coreneuron::phase::one>(userParams, !
corenrn_file_mode);
489 p1.populate(*
n,
mut);
501 coreneuron::phase_wrapper<coreneuron::phase::two>(userParams, !
corenrn_file_mode);
510 coreneuron::phase_wrapper<coreneuron::gap>(userParams);
525 if (is_mapping_needed)
526 coreneuron::phase_wrapper<coreneuron::phase::three>(userParams, !
corenrn_file_mode);
530 if (run_setup_cleanup)
551 size_t model_size_bytes;
563 if (model_size_bytes < 1024) {
564 printf(
" Model size : %ld bytes\n", model_size_bytes);
565 }
else if (model_size_bytes < 1024 * 1024) {
566 printf(
" Model size : %.2lf kB\n", model_size_bytes / 1024.);
567 }
else if (model_size_bytes < 1024 * 1024 * 1024) {
568 printf(
" Model size : %.2lf MB\n", model_size_bytes / (1024. * 1024.));
570 printf(
" Model size : %.2lf GB\n", model_size_bytes / (1024. * 1024. * 1024.));
585 const std::lock_guard<OMP_Mutex>
lock(
mut);
603 int sidt_size = F.read_int();
605 std::size_t ntar = F.read_int();
606 std::size_t nsrc = F.read_int();
610 si.src_type.resize(nsrc);
611 si.src_index.resize(nsrc);
613 F.read_array<
sgid_t>(si.src_sid.data(), nsrc);
614 F.read_array<
int>(si.src_type.data(), nsrc);
615 F.read_array<
int>(si.src_index.data(), nsrc);
618 si.tar_sid.resize(ntar);
619 si.tar_type.resize(ntar);
620 si.tar_index.resize(ntar);
622 F.read_array<
sgid_t>(si.tar_sid.data(), ntar);
623 F.read_array<
int>(si.tar_type.data(), ntar);
624 F.read_array<
int>(si.tar_index.data(), ntar);
629 for (
int i = 0;
i < nsrc; ++
i) {
630 printf(
"src %z %d %d\n",
size_t(si.src_sid[
i]), si.src_type[
i], si.src_index[
i]);
632 for (
int i = 0;
i < ntar; ++
i) {
633 printf(
"tar %z %d %d\n",
size_t(si.src_sid[
i]), si.src_type[
i], si.src_index[
i]);
669 return ml->
data + cnrn_index;
670 }
else if (mtype == 0) {
673 printf(
"legacy_index2pointer does not handle mtype=%d\n", mtype);
686 icnt =
i % padded_cnt;
687 isz =
i / padded_cnt;
750 (*s)(nt, ml, tml->index);
757 (*priv_dtor)(nt, ml, tml->index);
759 assert(!ml->global_variables);
760 assert(ml->global_variables_size == 0);
798 if (tml->dependencies)
799 free(tml->dependencies);
801 next_tml = tml->
next;
833 delete[] std::exchange(nt->
pntprocs,
nullptr);
834 delete[] std::exchange(nt->
presyns,
nullptr);
927 p1.populate(nt,
mut);
950 F.restore_checkpoint();
958 nt.
mapping = (
void*) ntmapping;
996 printf(
"%s %d psize=%d ppsize=%d cnt=%d nbyte=%ld\n",
1015 printf(
" gid2out table bytes=~%ld size=%ld\n", nbyte,
gid2out.size());
1024 size_t nbyte =
sizeof(
gid2in) +
sizeof(
int) *
gid2in.size() +
1027 printf(
" gid2in table bytes=~%ld size=%ld\n", nbyte,
gid2in.size());
1034 size_t sz_nrnThread =
sizeof(
NrnThread);
1035 size_t sz_presyn =
sizeof(
PreSyn);
1037 size_t sz_netcon =
sizeof(
NetCon);
1041 std::vector<long> size_data(13, 0);
1042 std::vector<long> global_size_data_min(13, 0);
1043 std::vector<long> global_size_data_max(13, 0);
1044 std::vector<long> global_size_data_sum(13, 0);
1045 std::vector<float> global_size_data_avg(13, 0.0);
1054 for (
auto tml = nt.
tml; tml; tml = tml->
next) {
1060 nb_nt += sz_nrnThread;
1062 nb_nt += nt.
end *
sizeof(int);
1072 printf(
"nbyte so far %ld\n", nb_nt);
1074 printf(
"n_input_presyn = %d sz=%ld nbyte=%ld\n",
1078 printf(
"n_pntproc=%d sz=%ld nbyte=%ld\n",
1088 if (detailed_report) {
1089 size_data[0] += nt.
ncell;
1090 size_data[1] += nt.
end;
1091 size_data[2] += nmech;
1092 size_data[3] += nt.
_ndata;
1100 size_data[11] += nb_nt;
1104 nbyte += nccnt *
sizeof(
NetCon*);
1112 printf(
"nrnran123 size=%ld cnt=%ld nbyte=%ld\n",
1113 nrnran123_state_size(),
1118 if (detailed_report) {
1119 size_data[12] = nbyte;
1123 nrnmpi_long_allreduce_vec(&size_data[0], &global_size_data_sum[0], 13, 1);
1124 nrnmpi_long_allreduce_vec(&size_data[0], &global_size_data_max[0], 13, 2);
1125 nrnmpi_long_allreduce_vec(&size_data[0], &global_size_data_min[0], 13, 3);
1126 for (
int i = 0;
i < 13;
i++) {
1132 global_size_data_max = size_data;
1133 global_size_data_min = size_data;
1134 global_size_data_avg.assign(size_data.cbegin(), size_data.cend());
1138 printf(
"Memory size information for all NrnThreads per rank\n");
1139 printf(
"------------------------------------------------------------------\n");
1140 printf(
"%22s %12s %12s %12s\n",
"field",
"min",
"max",
"avg");
1141 printf(
"%22s %12ld %12ld %15.2f\n",
1143 global_size_data_min[0],
1144 global_size_data_max[0],
1145 global_size_data_avg[0]);
1146 printf(
"%22s %12ld %12ld %15.2f\n",
1148 global_size_data_min[1],
1149 global_size_data_max[1],
1150 global_size_data_avg[1]);
1151 printf(
"%22s %12ld %12ld %15.2f\n",
1153 global_size_data_min[2],
1154 global_size_data_max[2],
1155 global_size_data_avg[2]);
1156 printf(
"%22s %12ld %12ld %15.2f\n",
1158 global_size_data_min[3],
1159 global_size_data_max[3],
1160 global_size_data_avg[3]);
1161 printf(
"%22s %12ld %12ld %15.2f\n",
1163 global_size_data_min[4],
1164 global_size_data_max[4],
1165 global_size_data_avg[4]);
1166 printf(
"%22s %12ld %12ld %15.2f\n",
1168 global_size_data_min[5],
1169 global_size_data_max[5],
1170 global_size_data_avg[5]);
1171 printf(
"%22s %12ld %12ld %15.2f\n",
1173 global_size_data_min[6],
1174 global_size_data_max[6],
1175 global_size_data_avg[6]);
1176 printf(
"%22s %12ld %12ld %15.2f\n",
1178 global_size_data_min[6] * sz_presyn,
1179 global_size_data_max[6] * sz_presyn,
1180 global_size_data_avg[6] * sz_presyn);
1181 printf(
"%22s %12ld %12ld %15.2f\n",
1183 global_size_data_min[7],
1184 global_size_data_max[7],
1185 global_size_data_avg[7]);
1186 printf(
"%22s %12ld %12ld %15.2f\n",
1187 "n_input_presyn (bytes)",
1188 global_size_data_min[7] * sz_input_presyn,
1189 global_size_data_max[7] * sz_input_presyn,
1190 global_size_data_avg[7] * sz_input_presyn);
1191 printf(
"%22s %12ld %12ld %15.2f\n",
1193 global_size_data_min[8],
1194 global_size_data_max[8],
1195 global_size_data_avg[8]);
1196 printf(
"%22s %12ld %12ld %15.2f\n",
1197 "n_pntproc (bytes)",
1198 global_size_data_min[8] * sz_pntproc,
1199 global_size_data_max[8] * sz_pntproc,
1200 global_size_data_avg[8] * sz_pntproc);
1201 printf(
"%22s %12ld %12ld %15.2f\n",
1203 global_size_data_min[9],
1204 global_size_data_max[9],
1205 global_size_data_avg[9]);
1206 printf(
"%22s %12ld %12ld %15.2f\n",
1208 global_size_data_min[9] * sz_netcon,
1209 global_size_data_max[9] * sz_netcon,
1210 global_size_data_avg[9] * sz_netcon);
1211 printf(
"%22s %12ld %12ld %15.2f\n",
1213 global_size_data_min[10],
1214 global_size_data_max[10],
1215 global_size_data_avg[10]);
1216 printf(
"%22s %12ld %12ld %15.2f\n",
1217 "NrnThread (bytes)",
1218 global_size_data_min[11],
1219 global_size_data_max[11],
1220 global_size_data_avg[11]);
1221 printf(
"%22s %12ld %12ld %15.2f\n",
1222 "model size (bytes)",
1223 global_size_data_min[12],
1224 global_size_data_max[12],
1225 global_size_data_avg[12]);
1231 long global_nbyte = 0;
1232 nrnmpi_long_allreduce_vec(&nbyte, &global_nbyte, 1, 1);
1233 nbyte = global_nbyte;
auto & get_memb_func(size_t idx)
auto & get_prop_dparam_size()
auto & get_has_net_event()
auto & get_pnttype2presyn()
auto & get_prop_param_size()
void read_direct(int thread_id, const NrnThread &nt)
void read_file(FileHandler &F, const NrnThread &nt)
void populate(NrnThread &nt, const UserParams &userParams)
void read_file(FileHandler &F, NrnThreadMappingInfo *ntmapping)
void read_direct(NrnThreadMappingInfo *ntmapping)
struct NrnThread NrnThread
void free_memory(void *pointer)
struct NrnThreadMembList NrnThreadMembList
void gap_data_indices_setup(NrnThread *nt)
For now, until conceptualization of the ordering is clear, just replace src setup_info_ indices value...
TransferThreadData * transfer_thread_data_
SetupTransferInfo * setup_info_
void gap_mpi_setup(int ngroup)
THIS FILE IS AUTO GENERATED DONT MODIFY IT.
void nrn_threads_create(int n)
int soaos2cnrn_index(const std::array< int, 3 > &soaos_indices, const std::vector< int > &array_dims, int padded_node_count, int *permute)
Compute the CoreNEURON index given an SoAoS index.
void nrn_inverse_i_layout(int i, int &icnt, int cnt, int &isz, int sz, int layout)
void(*)(NrnThread *, Memb_list *, int) mod_f_t
size_t output_presyn_size(void)
Approximate count of number of bytes for the gid2out map.
void write_mech_report()
display global mechanism count
void read_phase1(NrnThread &nt, UserParams &userParams)
void * ecalloc_align(size_t n, size_t size, size_t alignment)
size_t input_presyn_size(void)
double ** nrn_ion_global_map
void nrn_setup(const char *filesdat, bool is_mapping_needed, CheckPoints &checkPoints, bool run_setup_cleanup, const char *datpath, const char *restore_path, double *mindelay)
std::map< int, InputPreSyn * > gid2in
bool nrn_have_gaps
variables defined in coreneuron library
void nrn_fast_imem_alloc()
size_t memb_list_size(NrnThreadMembList *tml, bool include_data)
static void nrn_fatal_error(const char *msg)
void nrn_mk_table_check()
void netpar_tid_gid2ps(int tid, int gid, PreSyn **ps, InputPreSyn **psi)
std::vector< std::map< int, PreSyn * > > neg_gid2out
Vector of maps for negative presyns.
bool use_solve_interleave
std::vector< std::vector< int > > nrnthreads_netcon_negsrcgid_tid
If a nrnthreads_netcon_srcgid is negative, need to determine the thread when in order to use the corr...
void read_phase3(NrnThread &nt, UserParams &userParams)
read mapping information for neurons
void check_bbcore_write_version(const char *)
void nrn_read_filesdat(int &ngrp, int *&grp, const char *filesdat)
std::vector< int * > nrnthreads_netcon_srcgid
Only for setup vector of netcon source gids.
void delete_trajectory_requests(NrnThread &nt)
std::array< int, 3 > legacy2soaos_index(int legacy_index, const std::vector< int > &array_dims)
Split a legacy index into the three SoAoS indices.
void read_phasegap(NrnThread &nt, UserParams &userParams)
int nrn_get_mechtype(const char *name)
Get mechanism type by the mechanism name.
void setup_ThreadData(NrnThread &nt)
double set_mindelay(double maxdelay)
NrnThreadChkpnt * nrnthread_chkpnt
void nrn_multisend_setup()
std::size_t nrnran123_instance_count()
void nrn_setup_cleanup()
Clean up.
int nrn_soa_padded_size(int cnt, int layout)
calculate size after padding for specific memory layout
double * legacy_index2pointer(int mtype, int index, NrnThread &nt)
void nrn_multithread_job(F &&job, Args &&... args)
void determine_inputpresyn()
std::vector< NetCon * > netcon_in_presyn_order_
InputPreSyn.nc_index_ to + InputPreSyn.nc_cnt_ give the NetCon*.
size_t model_size(bool detailed_report)
void nrn_multisend_cleanup()
void delete_fornetcon_info(NrnThread &nt)
int nrn_ion_global_map_size
std::map< int, PreSyn * > gid2out
Maps for ouput and input presyns.
corenrn_parameters corenrn_param
Printing method.
void nrn_cleanup_ion_map()
Cleanup global ion map created during mechanism registration.
void read_phase2(NrnThread &nt, UserParams &userParams)
void create_interleave_info()
void destroy_interleave_info()
#define nrn_assert(x)
assert()-like macro, independent of NDEBUG status
int corenrn_embedded_nthread
void(* nrn2core_all_weights_return_)(std::vector< double * > &weights)
void(* nrn2core_trajectory_values_)(int tid, int n_pr, void **vpr, double t)
void(* nrn2core_get_trajectory_requests_)(int tid, int &bsize, int &n_pr, void **&vpr, int &n_trajec, int *&types, int *&indices, double **&pvars, double **&varrays)
bool corenrn_embedded
--> Coreneuron
int(* nrn2core_all_spike_vectors_return_)(std::vector< double > &spikevec, std::vector< int > &gidvec)
void(* nrn2core_group_ids_)(int *)
void(* nrn2core_trajectory_return_)(int tid, int n_pr, int bsize, int vecsz, void **vpr, double t)
int const size_t const size_t n
std::vector< Memb_func > memb_func
std::vector< sgid_t > src_sid
void(* thread_mem_init_)(ThreadDatum *)
NetSendBuffer_t * _net_send_buffer
NetReceiveBuffer_t * _net_receive_buffer
int _net_send_buffer_size
PreSynHelper * presyns_helper
NrnFastImem * nrn_fast_imem
size_t * _fornetcon_weight_perm
size_t * _fornetcon_perm_indices
std::unique_ptr< SummationReportMapping > summation_report_handler_
TrajectoryRequests * trajec_requests
Compartment mapping information for NrnThread.
size_t size() const
number of cells
This structure is data needed is several part of nrn_setup, phase1 and phase2.
const int ngroup
direct memory mode with neuron, do not open files Number of local cell groups
const int *const gidgroups
Array of cell group numbers (indices)
std::vector< FileHandler > file_reader
bool model_stats
Print version and exit.
unsigned cell_interleave_permute
Spike Compression.
bool mpi_enable
Initialization seed for random number generator (int)
The basic problem is to copy sources to targets.
Project version information.