Hi Riccardo, >From a first glance, the second parameter of do_work is a non-const reference. We don't support non-const references here.
>From a first glance Am 06.12.2016 5:51 nachm. schrieb "Riccardo Rossi" <[email protected]>: any help in understanding why this does not compile would be very welcome regards Riccardo //[hello_world_client_getting_started #include <hpx/hpx_init.hpp> #include <hpx/hpx.hpp> #include <hpx/include/parallel_algorithm.hpp> #include <hpx/include/parallel_numeric.hpp> #include <hpx/include/threads.hpp> #include <hpx/include/threadmanager.hpp> #include <hpx/include/lcos.hpp> #include <unordered_map> #include <unordered_set> #include <vector> #include <functional> //compile with //g++ -std=c++14 -fPIC coloring.cpp -o coloring.exe -I/home/rrossi/scratch/hpx/build -I/home/rrossi/scratch/hpx/hpx -I/home/rrossi/compiled_libraries/boost/include/ -L/home/rrossi/scratch/hpx/build/lib -lhpx -L/home/rrossi/compiled_libraries/boost/lib/ -lboost_program_options -lboost_system -lboost_thread //this one would be the function to process a color, that is, a collection of columns hpx::lcos::shared_future<void> do_work(unsigned int color, std::vector<hpx::lcos::shared_future<void> >& dependencies) { std::cout << "i am " << color << std::endl; return my_dependencies = hpx::lcos::shared_future<void>( hpx::when_all(dependencies.begin(), dependencies.end()) ); } int hpx_main(boost::program_options::variables_map&) { int ncolors = 6; std::vector< std::unordered_set<unsigned int> > dependencies(ncolors); dependencies[0]; //first has no dependencies dependencies[1].insert({0}); //1 can be launched when 0 is completed dependencies[2].insert({0,1}); //2 can be launched when 0 and 1 are both completed dependencies[3].insert({0,2}); dependencies[4].insert({1}); dependencies[5].insert({0}); //this is a set with all of the tasks i am spawning std::unordered_map< unsigned int, hpx::lcos::shared_future<void> > work_items; //here i actually spawn the threads for(unsigned int i=0; i<ncolors; i++) { std::vector< hpx::lcos::shared_future<void> > item_dependencies; auto& my_dependencies = dependencies[i]; for(unsigned int k=0; k<dependencies[i].size();i++) { unsigned int c = *(my_dependencies.find(k)); item_dependencies.push_back(c); //fill the item_dependencies on the base of the already constructed shared_futures } auto Op = hpx::util::unwrapped(&do_work); work_items[i] = hpx::dataflow(hpx::launch::async, Op, i, item_dependencies); } return hpx::finalize(); // Initiate shutdown of the runtime system. } int main(int argc, char* argv[]) { return hpx::init(argc, argv); // Initialize and run HPX. } //this loop doesn't really matter. It is computing the Id of the dependencies for the case of a triangular solve (and may well be wrong), //that is the Id of the colors that need to be finished before actually computing a given color // std::vector< std::set<unsigned int> > dependencies(ncolors); // for(auto row = rows[0]; row < nrows; row++) // { // const auto row_color = colors[row]; // // for(auto col = cols[row]; col<cols[row+1]; ++col) // { // const auto col_color = colors[col]; // if(col_color != row_color) // { // dependencies[col_color].insert(col_color); // } // } // } -- *Riccardo Rossi* PhD, Civil Engineer member of the Kratos Team: www.cimne.com/kratos Tenure Track Lecturer at Universitat Politècnica de Catalunya, BarcelonaTech (UPC) Full Research Professor at International Center for Numerical Methods in Engineering (CIMNE) C/ Gran Capità, s/n, Campus Nord UPC, Ed. B0, Despatx 102 (please deliver post to the porters of building C1) 08034 – Barcelona – Spain – www.cimne.com - T.(+34) 93 401 56 96 skype: *rougered4* <http://www.cimne.com/> <https://www.facebook.com/cimne> <http://blog.cimne.com/> <http://vimeo.com/cimne> <http://www.youtube.com/user/CIMNEvideos> <http://www.linkedin.com/company/cimne> <https://twitter.com/cimne> Les dades personals contingudes en aquest missatge són tractades amb la finalitat de mantenir el contacte professional entre CIMNE i voste. Podra exercir els drets d'accés, rectificació, cancel·lació i oposició, dirigint-se a [email protected]. La utilització de la seva adreça de correu electronic per part de CIMNE queda subjecte a les disposicions de la Llei 34/2002, de Serveis de la Societat de la Informació i el Comerç Electronic. Imprimiu aquest missatge, només si és estrictament necessari. <http://www.cimne.com/> _______________________________________________ hpx-users mailing list [email protected] https://mail.cct.lsu.edu/mailman/listinfo/hpx-users
_______________________________________________ hpx-users mailing list [email protected] https://mail.cct.lsu.edu/mailman/listinfo/hpx-users
