diff --git a/example/dryrun/dryrun.cpp b/example/dryrun/dryrun.cpp index d78df681a68538dcfed96aaf07f936e4eb51eff8..ec9413bc59097e39e59405e55b57995c488f7b11 100644 --- a/example/dryrun/dryrun.cpp +++ b/example/dryrun/dryrun.cpp @@ -143,60 +143,6 @@ private: float event_weight_ = 0.01; }; -struct cell_stats { - using size_type = unsigned; - size_type ncells = 0; - int nranks = 1; - size_type nsegs = 0; - - cell_stats(arb::recipe& r, run_params params) { -#ifdef ARB_MPI_ENABLED - if(!params.dry_run) { - int rank; - MPI_Comm_rank(MPI_COMM_WORLD, &rank); - MPI_Comm_size(MPI_COMM_WORLD, &nranks); - ncells = r.num_cells(); - size_type cells_per_rank = ncells/nranks; - size_type b = rank*cells_per_rank; - size_type e = (rank+1)*cells_per_rank; - size_type nsegs_tmp = 0; - for (size_type i=b; i<e; ++i) { - auto c = arb::util::any_cast<arb::cable_cell>(r.get_cell_description(i)); - nsegs_tmp += c.morphology().num_branches(); - } - MPI_Allreduce(&nsegs_tmp, &nsegs, 1, MPI_UNSIGNED, MPI_SUM, MPI_COMM_WORLD); - } -#else - if(!params.dry_run) { - nranks = 1; - ncells = r.num_cells(); - for (size_type i = 0; i < ncells; ++i) { - auto c = arb::util::any_cast<arb::cable_cell>(r.get_cell_description(i)); - nsegs += c.morphology().num_branches(); - } - } -#endif - else { - nranks = params.num_ranks; - ncells = r.num_cells(); //total number of cells across all ranks - - for (size_type i = 0; i < params.num_cells_per_rank; ++i) { - auto c = arb::util::any_cast<arb::cable_cell>(r.get_cell_description(i)); - nsegs += c.morphology().num_branches(); - } - - nsegs *= params.num_ranks; - } - } - - friend std::ostream& operator<<(std::ostream& o, const cell_stats& s) { - return o << "cell stats: " - << s.nranks << " ranks; " - << s.ncells << " cells; " - << s.nsegs << " branches. "; - } -}; - int main(int argc, char** argv) { try { #ifdef ARB_MPI_ENABLED @@ -245,9 +191,6 @@ int main(int argc, char** argv) { params.num_ranks, params.cell, params.min_delay); arb::symmetric_recipe recipe(std::move(tile)); - cell_stats stats(recipe, params); - std::cout << stats << "\n"; - auto decomp = arb::partition_load_balance(recipe, ctx); // Construct the model. diff --git a/example/gap_junctions/gap_junctions.cpp b/example/gap_junctions/gap_junctions.cpp index f59726a41bfc0c08da9c890fa0f6be06f1b97954..8a39dd23bca8ccb49ec2b591e6f86b00d7d27c98 100644 --- a/example/gap_junctions/gap_junctions.cpp +++ b/example/gap_junctions/gap_junctions.cpp @@ -142,43 +142,6 @@ private: gap_params params_; }; -struct cell_stats { - using size_type = unsigned; - size_type ncells = 0; - size_type nsegs = 0; - - cell_stats(arb::recipe& r) { -#ifdef ARB_MPI_ENABLED - int nranks, rank; - MPI_Comm_rank(MPI_COMM_WORLD, &rank); - MPI_Comm_size(MPI_COMM_WORLD, &nranks); - ncells = r.num_cells(); - size_type cells_per_rank = ncells/nranks; - size_type b = rank*cells_per_rank; - size_type e = (rank==nranks-1)? ncells: (rank+1)*cells_per_rank; - size_type nsegs_tmp = 0; - for (size_type i=b; i<e; ++i) { - auto c = arb::util::any_cast<arb::cable_cell>(r.get_cell_description(i)); - nsegs_tmp += c.num_branches(); - } - MPI_Allreduce(&nsegs_tmp, &nsegs, 1, MPI_UNSIGNED, MPI_SUM, MPI_COMM_WORLD); -#else - ncells = r.num_cells(); - for (size_type i=0; i<ncells; ++i) { - auto c = arb::util::any_cast<arb::cable_cell>(r.get_cell_description(i)); - nsegs += c.morphology().num_branches(); - } -#endif - } - - friend std::ostream& operator<<(std::ostream& o, const cell_stats& s) { - return o << "cell stats: " - << s.ncells << " cells; " - << s.nsegs << " branchess."; - } -}; - - int main(int argc, char** argv) { try { bool root = true; @@ -225,9 +188,6 @@ int main(int argc, char** argv) { // Create an instance of our recipe. gj_recipe recipe(params); - cell_stats stats(recipe); - std::cout << stats << "\n"; - auto decomp = arb::partition_load_balance(recipe, context); // Construct the model. diff --git a/example/ring/ring.cpp b/example/ring/ring.cpp index 91fc043baf48c1d46af4bf14c6a702ade317d7f5..46b222cc11824717bfef78456451add30988f996 100644 --- a/example/ring/ring.cpp +++ b/example/ring/ring.cpp @@ -136,42 +136,6 @@ private: arb::cable_cell_global_properties gprop_; }; -struct cell_stats { - using size_type = unsigned; - size_type ncells = 0; - size_type nsegs = 0; - - cell_stats(arb::recipe& r) { -#ifdef ARB_MPI_ENABLED - int nranks, rank; - MPI_Comm_rank(MPI_COMM_WORLD, &rank); - MPI_Comm_size(MPI_COMM_WORLD, &nranks); - ncells = r.num_cells(); - size_type cells_per_rank = ncells/nranks; - size_type b = rank*cells_per_rank; - size_type e = (rank==nranks-1)? ncells: (rank+1)*cells_per_rank; - size_type nsegs_tmp = 0; - for (size_type i=b; i<e; ++i) { - auto c = arb::util::any_cast<arb::cable_cell>(r.get_cell_description(i)); - nsegs_tmp += c.num_branches(); - } - MPI_Allreduce(&nsegs_tmp, &nsegs, 1, MPI_UNSIGNED, MPI_SUM, MPI_COMM_WORLD); -#else - ncells = r.num_cells(); - for (size_type i=0; i<ncells; ++i) { - auto c = arb::util::any_cast<arb::cable_cell>(r.get_cell_description(i)); - nsegs += c.morphology().num_branches(); - } -#endif - } - - friend std::ostream& operator<<(std::ostream& o, const cell_stats& s) { - return o << "cell stats: " - << s.ncells << " cells; " - << s.nsegs << " branches."; - } -}; - int main(int argc, char** argv) { try { bool root = true; @@ -213,8 +177,6 @@ int main(int argc, char** argv) { // Create an instance of our recipe. ring_recipe recipe(params.num_cells, params.cell, params.min_delay); - cell_stats stats(recipe); - std::cout << stats << "\n"; auto decomp = arb::partition_load_balance(recipe, context);