diff --git a/checks/check_2d.cpp b/checks/check_2d.cpp index 5fb96e1f2bf4982150d4d1efdf8de84410fb0fa8..4d277744137a095bde8997f85841bf93559fc8ff 100644 --- a/checks/check_2d.cpp +++ b/checks/check_2d.cpp @@ -272,8 +272,8 @@ auto run(const int& tree_height, const int& group_size, const std::size_t order, scalfmm::list::sequential::build_interaction_lists(tree, tree, separation_criterion, mutual); scalfmm::io::trace(std::cout, tree, 4); - // auto operator_to_proceed = scalfmm::algorithms::all; - auto operator_to_proceed = scalfmm::algorithms::operators_to_proceed::farfield; + auto operator_to_proceed = scalfmm::algorithms::all; + // auto operator_to_proceed = scalfmm::algorithms::operators_to_proceed::farfield; // auto operator_to_proceed = scalfmm::algorithms::nearfield; // auto operator_to_proceed = scalfmm::algorithms::p2m | scalfmm::algorithms::m2m | scalfmm::algorithms::m2l; @@ -307,7 +307,7 @@ auto run(const int& tree_height, const int& group_size, const std::size_t order, } //////////////////////////////////////////////////////////////////////////// std::cout << "Save Tree\n"; - std::string outName("tree_check2d.bin"); + std::string outName("tree_check2d_h" + std::to_string(tree_height) + ".bin"); std::string header("chebyshev - Low-rank "); scalfmm::tools::io::save(outName, tree, header); // // diff --git a/examples/test_mpi_algo.cpp b/examples/test_mpi_algo.cpp index 85b178a736243190b52be8aaddfa2a0f26aef5b6..9501fb2cfb564246f50a2fd58b18d19a4875c82c 100644 --- a/examples/test_mpi_algo.cpp +++ b/examples/test_mpi_algo.cpp @@ -176,21 +176,16 @@ auto run(cpp_tools::parallel_manager::parallel_manager& para, const std::string& scalfmm::list::sequential::build_interaction_lists(letGroupTree, letGroupTree, separation_criterion, mutual); -// scalfmm::io::trace(std::cout, letGroupTree, 4); -#pragma omp critical(TRACE) - { - const int rank = para.get_process_id(); - - std::string outName2("tree_group_rank_" + std::to_string(rank) + ".txt"); - std::ofstream out(outName2); - scalfmm::io::trace(out, letGroupTree, 2); - } #ifdef SCALFMM_DEBUG_MPI { const int rank = para.get_process_id(); + std::string outName0("tree_group_rank_" + std::to_string(rank) + ".txt"); + std::ofstream out(outName0); + scalfmm::io::trace(out, letGroupTree, 2); std::string outName1("tree_rank_" + std::to_string(rank) + ".bin"); std::string header1("LOCAL TREE "); scalfmm::tools::io::save(outName1, letGroupTree, header1); + // const int nbDataPerRecord = scalfmm::container::particle_traits<particle_type>::number_of_elements; const int inputs_size = scalfmm::container::particle_traits<particle_type>::inputs_size; const bool verbose_write = true; // True only for the master @@ -213,12 +208,13 @@ auto run(cpp_tools::parallel_manager::parallel_manager& para, const std::string& << cpp_tools::colors::reset; } // - // auto operator_to_proceed = scalfmm::algorithms::operators_to_proceed::all; + auto operator_to_proceed = scalfmm::algorithms::operators_to_proceed::all; // auto operator_to_proceed = scalfmm::algorithms::operators_to_proceed::farfield; + // auto operator_to_proceed = scalfmm::algorithms::operators_to_proceed::nearfield; // auto operator_to_proceed = scalfmm::algorithms::operators_to_proceed::m2l; - auto operator_to_proceed = scalfmm::algorithms::operators_to_proceed::p2m | - scalfmm::algorithms::operators_to_proceed::m2m | - scalfmm::algorithms::operators_to_proceed::m2l; + // auto operator_to_proceed = scalfmm::algorithms::operators_to_proceed::p2m | + // scalfmm::algorithms::operators_to_proceed::m2m | + // scalfmm::algorithms::operators_to_proceed::m2l; // | scalfmm::algorithms::operators_to_proceed::p2p | // scalfmm::algorithms::operators_to_proceed::l2p; // @@ -230,7 +226,7 @@ auto run(cpp_tools::parallel_manager::parallel_manager& para, const std::string& scalfmm::algorithms::mpi::proc_task(letGroupTree, fmm_operator, operator_to_proceed); - std::clog << "End scalfmm::algorithms::mpi::proc_task\n"; + // std::clog << "End scalfmm::algorithms::mpi::proc_task\n"; /// /////////////////////////////////////////////////////////////////////////////////////////////////////// /// @@ -249,7 +245,7 @@ auto run(cpp_tools::parallel_manager::parallel_manager& para, const std::string& inputs_size); /// writer.writeFromTree(letGroupTree, number_of_particles); - std::cout << "End writing\n" << std::flush; + // std::cout << "End writing\n" << std::flush; } // /// diff --git a/include/scalfmm/algorithms/mpi/downward.hpp b/include/scalfmm/algorithms/mpi/downward.hpp index dfefbda344846f62fd6d0d24ddb688d10b85887a..1ed5e10910fb96fa29555f6cf0573c5b92512109 100644 --- a/include/scalfmm/algorithms/mpi/downward.hpp +++ b/include/scalfmm/algorithms/mpi/downward.hpp @@ -7,10 +7,8 @@ #include "scalfmm/operators/l2l.hpp" #ifdef _OPENMP - -#include <omp.h> - #include "scalfmm/algorithms/omp/downward.hpp" +#include <omp.h> #endif // _OPENMP #include <cpp_tools/parallel_manager/parallel_manager.hpp> @@ -35,13 +33,13 @@ namespace scalfmm::algorithms::mpi::pass auto const& csymb = (*grp_ptr)->csymbolics(); // iterate on the cells in the same group // we move forward in the index vector - std::cout << "[" << csymb.starting_index << " < " << parent_morton_index << " < " << csymb.ending_index - << "] ?" << std::endl - << std::flush; + // std::cout << "[" << csymb.starting_index << " < " << parent_morton_index << " < " << csymb.ending_index + // << "] ?" << std::endl + // << std::flush; if(parent_morton_index == ((csymb.ending_index - 1) >> dimension)) { - std::cout << parent_morton_index << " add depend for grp with Int [" << csymb.starting_index << ", " - << csymb.ending_index << "]" << std::endl; + // std::cout << parent_morton_index << " add depend for grp with Int [" << csymb.starting_index << ", " + // << csymb.ending_index << "]" << std::endl; dependencies.push_back(&(grp_ptr->get()->ccomponent(0).clocals(0))); } else @@ -88,23 +86,23 @@ namespace scalfmm::algorithms::mpi::pass int tag_data = 2201 + 10 * level; std::vector<dep_type> dependencies_in; // - auto ptr_tree = &tree; + auto ptr_tree = &tree; auto const& distrib = tree.get_cell_distribution(child_level); - std::clog << "distrib me [" << distrib[rank][0] << "," << distrib[rank][1] << "]\n"; + // std::clog << "distrib me [" << distrib[rank][0] << "," << distrib[rank][1] << "]\n"; // Send to the right the last locals if(rank != nb_proc - 1) { - std::clog << " Send step " << level << "\n"; + // std::clog << " Send step " << level << "\n"; // get the distribution at child level auto last_child_index = distrib[rank][1] - 1; auto first_child_index_after_me = distrib[rank + 1][0]; // dependencies in on the group // Check if the last mine and the first right ghost have the same father auto parent_morton_index = last_child_index >> dimension; - std::clog << " downward last_child_index " << last_child_index << " its parent " << parent_morton_index - << " first_child_index_after_me " << first_child_index_after_me << " its parent " - << (first_child_index_after_me >> dimension) << std::endl - << std::flush; + // std::clog << " downward last_child_index " << last_child_index << " its parent " << parent_morton_index + // << " first_child_index_after_me " << first_child_index_after_me << " its parent " + // << (first_child_index_after_me >> dimension) << std::endl + // << std::flush; if(parent_morton_index == (first_child_index_after_me >> dimension)) { // Two processes share the same parent @@ -119,7 +117,7 @@ namespace scalfmm::algorithms::mpi::pass // std::cout << " downward dep(in) on groupe dep_parent " << dep_parent << std::endl << std::flush; // depend(iterator(std::size_t it = 0 dependencies.size()), inout : (dependencies[it])[0]), -#pragma omp task default(none) firstprivate(comm, rank, tag_data, it_last_parent_group, last_child_index) \ +#pragma omp task default(none) firstprivate(comm, rank, tag_data, it_last_parent_group, last_child_index) \ shared(std::clog) depend(in : dep_parent[0], ptr_tree[0]) priority(prio) { // I have to send a message from my right to update the multipoles of the first @@ -146,7 +144,7 @@ namespace scalfmm::algorithms::mpi::pass // io::print("buffer(send) ", buffer); auto mpi_type = cpp_tools::parallel_manager::mpi::get_datatype<value_type>(); - std::clog << " send buffer to " << rank + 1 << std::endl; + // std::clog << " send buffer to " << rank + 1 << std::endl; comm->isend(buffer.data(), size_local, mpi_type, rank + 1, tag_data); // std::cout << " downward(task_send) buffer(rank=" << std::to_string(rank) << "): " << std::flush; // for(int i = 0; i < buffer.size(); ++i) @@ -160,16 +158,16 @@ namespace scalfmm::algorithms::mpi::pass // Receive if(rank > 0) { - std::clog << "Receive step\n"; + // std::clog << "Receive step\n"; auto last_child_index_before_me = distrib[rank - 1][1] - 1; auto first_child_index = distrib[rank][0]; // dependencies out on the group // check if same parent - std::clog << "downward receive comm last_child_index_before_me " << last_child_index_before_me - << " parent " << (last_child_index_before_me >> dimension) << " first_child_index " - << first_child_index << " its parent " << (first_child_index >> dimension) << std::endl - << std::flush; + // std::clog << "downward receive comm last_child_index_before_me " << last_child_index_before_me + // << " parent " << (last_child_index_before_me >> dimension) << " first_child_index " + // << first_child_index << " its parent " << (first_child_index >> dimension) << std::endl + // << std::flush; if((last_child_index_before_me >> dimension) == (first_child_index >> dimension)) { // task to do @@ -185,10 +183,10 @@ namespace scalfmm::algorithms::mpi::pass auto dep_ghost_parent = &(it_last_parent_group->get()->ccomponent(0).clocals(0)); // std::cout << " downward(receive) dependencies(out): " << dep_ghost_parent << std::endl << std::flush; -#pragma omp task default(none) firstprivate(comm, rank, tag_data, size_local, it_last_parent_group) shared(std::clog) \ +#pragma omp task default(none) firstprivate(comm, rank, tag_data, size_local, it_last_parent_group) shared(std::clog) \ depend(out : dep_ghost_parent[0], ptr_tree[0]) priority(prio) { - std::clog << " Same parent\n "; + // std::clog << " Same parent\n "; // Same parent, I have to receive a message from my left // to update the locals of the last cells of the left ghosts. std::vector<value_type> buffer(size_local); @@ -206,7 +204,7 @@ namespace scalfmm::algorithms::mpi::pass auto pos = it_group->get()->size() - 1; // index of the last cell in the group auto& cell = it_group->get()->component(pos); auto& m = cell.locals(); - std::clog << "cell index: " << cell.index() << " = parent " << (cell.index() >> dimension) << "\n"; + // std::clog << "cell index: " << cell.index() << " = parent " << (cell.index() >> dimension) << "\n"; auto nb_m = m.size(); // std::cout << " cell index: " << cell.index() << " level " << cell.csymbolics().level << "\n"; diff --git a/include/scalfmm/algorithms/mpi/proc_task.hpp b/include/scalfmm/algorithms/mpi/proc_task.hpp index a905e495a62daaeb73e2ccc8be7231d016dce242..798cc5ead69f54bea23c27c9e8f3c5c186b20ab5 100644 --- a/include/scalfmm/algorithms/mpi/proc_task.hpp +++ b/include/scalfmm/algorithms/mpi/proc_task.hpp @@ -105,12 +105,12 @@ namespace scalfmm::algorithms::mpi if((op & operators_to_proceed::p2m) == operators_to_proceed::p2m) { - std::cout << "pass::leaf_to_cell \n"; + // std::cout << "pass::leaf_to_cell \n"; scalfmm::algorithms::omp::pass::leaf_to_cell(tree_source, far_field); } if((op & operators_to_proceed::m2m) == operators_to_proceed::m2m) { - std::cout << "pass::upward \n"; + // std::cout << "pass::upward \n"; pass::upward(tree_source, far_field.approximation()); } // if(same_tree && tree_target.box().is_periodic()) diff --git a/include/scalfmm/algorithms/mpi/transfer.hpp b/include/scalfmm/algorithms/mpi/transfer.hpp index 47e832c2dc63a0c294bf46f9eb9a16bfc31ac5da..5cb2dd20277d1b0981d0c18ac5ddc72aec26dcec 100644 --- a/include/scalfmm/algorithms/mpi/transfer.hpp +++ b/include/scalfmm/algorithms/mpi/transfer.hpp @@ -390,7 +390,7 @@ namespace scalfmm::algorithms::mpi::pass template<typename TreeS, typename TreeT> void inline task_communications(const int level, TreeS& tree, TreeT& treeT) { - std::cout << "task_communications fct start\n "; + // std::cout << "task_communications fct start\n "; static constexpr auto prio{omp::priorities::max - 5}; static constexpr int nb_inputs = TreeS::cell_type::storage_type::inputs_size; // @@ -441,15 +441,15 @@ namespace scalfmm::algorithms::mpi::pass { dependencies_out[idx] = &(it_grp->get()->ccomponent(0).cmultipoles(0)); } - io::print("m2l(task comm) dependencies(transfer)(out): ", dependencies_out); + // io::print("m2l(task comm) dependencies(transfer)(out): ", dependencies_out); } - std::cout << " insert task (comm M2L(level=" + std::to_string(level) + ") \n"; - io::print(" out: ", dependencies_out); - io::print(" in: ", dependencies_in); + // std::cout << " insert task (comm M2L(level=" + std::to_string(level) + ") \n"; + // io::print(" out: ", dependencies_out); + // io::print(" in: ", dependencies_in); auto ptr_tree = &tree; auto ptr_treeT = &treeT; - std::cout << " inout: " << ptr_tree << std::endl; //to serialise the communication tasks + // std::cout << " inout: " << ptr_tree << std::endl; //to serialise the communication tasks // clang-format off #pragma omp task untied default(none) firstprivate(ptr_tree, nb_proc, rank, nb_inputs, level) shared(std::cerr, std::clog) \ @@ -459,7 +459,7 @@ namespace scalfmm::algorithms::mpi::pass // clang-format on { int receive_section{0}, send_section{0}; - std::clog << " m2l task(comm(l=" << level << ")) Send part \n" << std::flush; + // std::clog << " m2l task(comm(l=" << level << ")) Send part \n" << std::flush; // #ifndef NO_COMM_TASK try { @@ -475,11 +475,11 @@ namespace scalfmm::algorithms::mpi::pass auto& cells_to_send_access = ptr_tree->send_cells_access(level); auto begin_grp = ptr_tree->begin_mine_cells(level); auto end_grp = ptr_tree->end_mine_cells(level); - std::clog << " m2l task(comm(l=" << level << ")) build direct acces \n" << std::flush; + // std::clog << " m2l task(comm(l=" << level << ")) build direct acces \n" << std::flush; scalfmm::parallel::comm::build_direct_access_to_components(nb_proc, begin_grp, end_grp, cells_to_send_access, morton_to_send); // build type to send all the multipoles - std::clog << " m2l task(comm(l=" << level << ")) build type \n" << std::flush; + // std::clog << " m2l task(comm(l=" << level << ")) build type \n" << std::flush; auto multipole_type_to_send = scalfmm::parallel::comm::build_mpi_multipoles_type( cells_to_send_access, nb_inputs, mpi_multipole_value_type); // @@ -488,9 +488,9 @@ namespace scalfmm::algorithms::mpi::pass // io::print("morton_to_send", morton_to_send[p]); if(morton_to_send[p].size() > 0) { - std::clog << "m2l task(send(l=" << level << ")) send to " << p << " tag " << tag_level - << std::endl - << std::flush; + // std::clog << "m2l task(send(l=" << level << ")) send to " << p << " tag " << tag_level + // << std::endl + // << std::flush; // std::cout << "m2l task(send) ptr_data_type(" << p << ") " //<< &(multipole_type_to_send[p]) // << " level: " << level << std::endl // << std::flush; @@ -502,12 +502,12 @@ namespace scalfmm::algorithms::mpi::pass // #endif } } - std::clog << " m2l task(comm(l=" << level << ")) send end \n"; + // std::clog << " m2l task(comm(l=" << level << ")) send end \n"; /// end send part /////////////////////////////////////////////////////// receive_section = 1; { - std::clog << " m2l task(comm(l=" << level << ")) Receive part level " << level << std::endl; + // std::clog << " m2l task(comm(l=" << level << ")) Receive part level " << level << std::endl; // receive part auto& cells_to_receive_access = ptr_tree->receive_cells_access(level); // for(auto p = 0; p < nb_proc; ++p) @@ -539,9 +539,9 @@ namespace scalfmm::algorithms::mpi::pass if(cells_to_receive_access.at(p).size() != 0) // if(ptr_multipole_type_to_receive[p] != MPI_DATATYPE_NULL) { - std::clog << "m2l task(comm(l=" << level << ")) post ireceive from " << p << " tag " - << tag_level << std::endl - << std::flush; + // std::clog << "m2l task(comm(l=" << level << ")) post ireceive from " << p << " tag " + // << tag_level << std::endl + // << std::flush; recept_mpi_status.push_back(comm.irecv(MPI_BOTTOM, 1, type[p], p, tag_level)); } } @@ -559,8 +559,8 @@ namespace scalfmm::algorithms::mpi::pass reinterpret_cast<MPI_Request*>(recept_mpi_status.data()), &index, &status); // index = cpp_tools::parallel_manager::mpi::request::waitany(recept_mpi_status.size()), recept_mpi_status.data(),status); ++cpt; - std::clog << "receive one comm from " << status.MPI_SOURCE << " tag " << status.MPI_TAG - << " wait for " << recept_mpi_status.size() - cpt << std::endl; + // std::clog << "receive one comm from " << status.MPI_SOURCE << " tag " << status.MPI_TAG + // << " wait for " << recept_mpi_status.size() - cpt << std::endl; if(status.MPI_TAG != tag_level) { @@ -570,8 +570,8 @@ namespace scalfmm::algorithms::mpi::pass } } #else - std::clog << " m2l task(comm(l=" << level << ")) wait all level " << level << " \n" - << std::flush; + // std::clog << " m2l task(comm(l=" << level << ")) wait all level " << level << " \n" + // << std::flush; cpp_tools::parallel_manager::mpi::request::waitall(recept_mpi_status.size(), recept_mpi_status.data()); @@ -592,7 +592,7 @@ namespace scalfmm::algorithms::mpi::pass // }); // } } - std::clog << "m2l task(comm(l=" << level << ")) end receive \n"; + // std::clog << "m2l task(comm(l=" << level << ")) end receive \n"; } } catch(std::exception& e) @@ -611,9 +611,9 @@ namespace scalfmm::algorithms::mpi::pass std::exit(EXIT_FAILURE); } // #endif - std::clog << "m2l task(comm(l=" << level << ")) end\n"; + // std::clog << "m2l task(comm(l=" << level << ")) end\n"; } // end task - std::cout << "task_communications fct end\n "; + // std::cout << "task_communications fct end\n "; } /** @@ -633,7 +633,7 @@ namespace scalfmm::algorithms::mpi::pass template<typename TreeS, typename TreeT> inline auto start_communications(const int& level, TreeS& tree_source, TreeT& tree_target) -> void { - std::cout << "start_communications fct start at level " << level << "\n "; + // std::cout << "start_communications fct start at level " << level << "\n "; using mortonIdx_type = std::int64_t; // typename TreeT::group_of_cell_type::symbolics_type::morton_type; // static constexpr int nb_inputs = TreeS::base_type::cell_type::storage_type::inputs_size; @@ -684,7 +684,7 @@ namespace scalfmm::algorithms::mpi::pass scalfmm::parallel::comm::start_step1(comm, begin_left_ghost, end_left_ghost, begin_right_ghost, end_right_ghost, distrib, nb_messages_to_receive, nb_messages_to_send, to_receive, morton_to_receive, verbose); - std::cout << " Value after step 1 M2L" << std::endl << std::flush; + // std::cout << " Value after step 1 M2L" << std::endl << std::flush; // for(auto p = 0; p < nb_proc; ++p) // { // auto& access = to_receive[p]; @@ -757,14 +757,14 @@ namespace scalfmm::algorithms::mpi::pass } #endif } // end step3 - std::cout << "start_communications fct end at level " << level << "\n "; + // std::cout << "start_communications fct end at level " << level << "\n "; } // end function start_communications template<typename TreeS, typename TreeT> inline auto prepare_comm_transfert(const int& level, TreeS& tree_source, TreeT& tree_target) -> void { - std::cout << "start_communications fct start at level " << level << "\n "; + // std::cout << "start_communications fct start at level " << level << "\n "; using mortonIdx_type = typename TreeS::morton_type; // typename TreeT::group_of_cell_type::symbolics_type::morton_type; @@ -816,7 +816,7 @@ namespace scalfmm::algorithms::mpi::pass scalfmm::parallel::comm::start_step1(comm, begin_left_ghost, end_left_ghost, begin_right_ghost, end_right_ghost, distrib, nb_messages_to_receive, nb_messages_to_send, to_receive, morton_to_receive, verbose); - std::cout << " Value after step 1 M2L" << std::endl << std::flush; + // std::cout << " Value after step 1 M2L" << std::endl << std::flush; // for(auto p = 0; p < nb_proc; ++p) // { // auto& access = to_receive[p]; @@ -893,21 +893,21 @@ namespace scalfmm::algorithms::mpi::pass } // std::cout << "&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&" << std::endl; - std::cout << " loop start at top_height " << top_height << " and end at last_level " << last_level << std::endl - << std::flush; + // std::cout << " loop start at top_height " << top_height << " and end at last_level " << last_level << std::endl + // << std::flush; for(std::size_t level = top_height; level < last_level; ++level) { - std::cout << "transfer : " << level << std::endl << std::flush; + // std::cout << "transfer : " << level << std::endl << std::flush; start_communications(level, tree_source, tree_target); - std::cout << " end comm " << level << std::endl << std::flush; + // std::cout << " end comm " << level << std::endl << std::flush; // #pragma omp taskwait // std::cout << "&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&" << std::endl; omp::pass::transfer_level(level, tree_source, tree_target, far_field, buffers); // std::cout << "&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&" << std::endl; } - std::cout << "end transfer pass" << std::endl << std::flush; - std::cout << "&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&" << std::endl; + // std::cout << "end transfer pass" << std::endl << std::flush; + // std::cout << "&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&" << std::endl; } } // namespace scalfmm::algorithms::mpi::pass diff --git a/include/scalfmm/algorithms/mpi/upward.hpp b/include/scalfmm/algorithms/mpi/upward.hpp index abab38b6de9e39364489ccd1ad8bac65f8598777..874565ea0219a6844f46d6b17beab9f27af9ced0 100644 --- a/include/scalfmm/algorithms/mpi/upward.hpp +++ b/include/scalfmm/algorithms/mpi/upward.hpp @@ -138,13 +138,13 @@ namespace scalfmm::algorithms::mpi::pass depend(iterator(std::size_t it = 0 : dependencies_in.size()), in : (dependencies_in[it])[0]), \ depend(inout : ptr_tree[0]) priority(prio) { - std::clog << "upward(task send(" << level << ")) start \n"; + // std::clog << "upward(task send(" << level << ")) start \n"; std::vector<value_type> buffer(size); int count{0}; - std::clog << "upward(task send(" << level << ")) index " << first_index_child - << " parent_of_first_index_child " << previous_parent_morton_index << std::endl - << std::flush; + // std::clog << "upward(task send(" << level << ")) index " << first_index_child + // << " parent_of_first_index_child " << previous_parent_morton_index << std::endl + // << std::flush; // index is now the parent of the first child auto index = first_index_child >> dimension; // I have to send @@ -166,9 +166,9 @@ namespace scalfmm::algorithms::mpi::pass { break; } - std::clog << "upward(task send) Check children P " << index << " C " << it_cell->index() - << " level " << it_cell->csymbolics().level << std::endl - << std::flush; + // std::clog << "upward(task send) Check children P " << index << " C " << it_cell->index() + // << " level " << it_cell->csymbolics().level << std::endl + // << std::flush; // copy the multipoles in the buffer auto const& m = it_cell->cmultipoles(); auto nb_m = m.size(); @@ -181,7 +181,7 @@ namespace scalfmm::algorithms::mpi::pass ++count; } - std::clog << "upward(task send) nb_send = " << count << std::endl; + // std::clog << "upward(task send) nb_send = " << count << std::endl; ptr_comm->isend(&count, 1, mpi_int_type, rank - 1, tag_nb); @@ -197,7 +197,7 @@ namespace scalfmm::algorithms::mpi::pass // } // std::cout << " \n" << std::flush; } - std::clog << "upward(task send(" << level << ")) end \n"; + // std::clog << "upward(task send(" << level << ")) end \n"; } // end task } // else @@ -227,20 +227,20 @@ namespace scalfmm::algorithms::mpi::pass auto it_first_ghost = tree.end_mine_cells(level_child); build_dependencies<dimension>(it_first_ghost, tree.end_cells(level_child), parent_morton_index, dependencies_out); - io::print(std::clog, "upward(receive) dependencies(out) ", dependencies_out); - io::print(std::cout, "upward(receive) dependencies(out) ", dependencies_out); - std::clog << std::flush; + // io::print(std::clog, "upward(receive) dependencies(out) ", dependencies_out); + // io::print(std::cout, "upward(receive) dependencies(out) ", dependencies_out); + // std::clog << std::flush; // dependencies_out #pragma omp task default(none) shared(std::cout, std::clog) \ firstprivate(ptr_comm, rank, level, tag_data, tag_nb, mpi_int_type, size, dimension, it_first_ghost) \ depend(iterator(std::size_t it = 0 : dependencies_out.size()), out : (dependencies_out[it])[0]), \ depend(inout : ptr_tree[0]) priority(prio) { - std::clog << "upward(task receive(" << level << ")) start \n"; + // std::clog << "upward(task receive(" << level << ")) start \n"; int count{0}; std::vector<value_type> buffer(size); ptr_comm->recv(&count, 1, mpi_int_type, rank + 1, tag_nb); - std::clog << "upward(task receive(" << level << ")) " << count << " cell(s)\n" << std::flush; + // std::clog << "upward(task receive(" << level << ")) " << count << " cell(s)\n" << std::flush; auto mpi_type = cpp_tools::parallel_manager::mpi::get_datatype<value_type>(); @@ -268,9 +268,9 @@ namespace scalfmm::algorithms::mpi::pass // copy the multipoles in the buffer auto& m = it_cell->multipoles(); auto nb_m = m.size(); - std::clog << "upward((" << level << ")) cell index: " << it_cell->index() << " level " - << it_cell->csymbolics().level << "\n" - << std::flush; + // std::clog << "upward((" << level << ")) cell index: " << it_cell->index() << " level " + // << it_cell->csymbolics().level << "\n" + // << std::flush; for(std::size_t i{0}; i < nb_m; ++i) { auto& ten = m.at(i); @@ -280,7 +280,7 @@ namespace scalfmm::algorithms::mpi::pass // std::cout << "upward() ten(after) " << ten << std::endl << std::flush; } } - std::clog << "upward(task receive(" << level << ")) end \n"; + // std::clog << "upward(task receive(" << level << ")) end \n"; } // end task } // else diff --git a/include/scalfmm/algorithms/omp/transfer.hpp b/include/scalfmm/algorithms/omp/transfer.hpp index 6b4791b80e1bbc84462ec667d4809edacea2cbce..9d164cbef1414eb3d50bf5d3e755dbe0a6dff96a 100644 --- a/include/scalfmm/algorithms/omp/transfer.hpp +++ b/include/scalfmm/algorithms/omp/transfer.hpp @@ -55,41 +55,36 @@ namespace scalfmm::algorithms::omp::pass { using operators::m2l_loop; // Useful to overload m2l(...) function auto const& approximation = far_field.approximation(); -<<<<<<< HEAD auto begin_cell_target_level_it = target_tree.begin_cells(level); auto end_cell_target_level_it = target_tree.end_cells(level); auto num{0}; -======= - // - auto begin_cell_target_level_it = tree_target.begin_mine_cells(level); - auto end_cell_target_level_it = tree_target.end_mine_cells(level); - // ->>>>>>> 70233f77 (Removal of display for debugging) ///////////////////////////////////////////////////////////////////////////////////////// /// loop on the groups at level level const auto num_threads{omp_get_num_threads()}; for(auto cell_target_level_it = begin_cell_target_level_it; cell_target_level_it != end_cell_target_level_it; -<<<<<<< HEAD - ++cell_target_level_it, ++num) -======= ++cell_target_level_it) ->>>>>>> 70233f77 (Removal of display for debugging) { // get() because cell_target_level_it is a shared pointer auto group_ptr = cell_target_level_it->get(); // dependence on the first local of the group auto ptr_local_raw = &(group_ptr->ccomponent(0).clocals(0)); static constexpr auto prio{priorities::m2l}; -<<<<<<< HEAD -======= + + auto prio{priorities::m2l}; +#ifdef SCALFMM_USE_MPI + // Increase th priority on the last group (For L2L in MPI) + if(cell_target_level_it == (end_cell_target_level_it - 1)) + { + prio = priorities::max; + } +#endif // // std::cout << "M2L level = " << level << std::endl << std::flush; // io::print("M2L dependencies(transfer)(in): ", group_ptr->csymbolics().group_dependencies_m2l); // std::cout << "M2L dep(inout) on groupe ptr_local_raw " << ptr_local_raw << std::endl << std::flush; // ->>>>>>> 70233f77 (Removal of display for debugging) // clang-format off #pragma omp task untied default(none) firstprivate(group_ptr, ptr_local_raw, level) shared(approximation, buffers, std::clog) \ depend(iterator(it = 0 : std::size(group_ptr->csymbolics().group_dependencies_m2l)), \ @@ -97,11 +92,11 @@ namespace scalfmm::algorithms::omp::pass // clang-format on { const auto thread_id{omp_get_thread_num()}; - io::print(std::clog, - "m2l(task) dependencies(transfer)(in): ", group_ptr->csymbolics().group_dependencies_m2l); - std::clog << "m2l(task) start task dep(inout) on groupe ptr_local_raw " << ptr_local_raw - << " level=" << level << std::endl - << std::flush; + // io::print(std::clog, + // "m2l(task) dependencies(transfer)(in): ", group_ptr->csymbolics().group_dependencies_m2l); + // std::clog << "m2l(task) start task dep(inout) on groupe ptr_local_raw " << ptr_local_raw + // << " level=" << level << std::endl + // << std::flush; /////////////////////////////////////////////////////////////////////////////////////// // loop on the leaves of the current group @@ -118,9 +113,9 @@ namespace scalfmm::algorithms::omp::pass // std::clog << "m2l(task) end cell index " << target_cell.index() << " locals " // << target_cell.locals().at(0) << std::endl; } - std::clog << "m2l(task) end task dep(inout) on groupe ptr_local_raw " << ptr_local_raw - << " level=" << level << std::endl - << std::flush; + // std::clog << "m2l(task) end task dep(inout) on groupe ptr_local_raw " << ptr_local_raw + // << " level=" << level << std::endl + // << std::flush; } // end pragma task /// post-processing the group if necessary }