Everyone, Please take a look at Praveen's code. All input is welcome.
---------- Forwarded message ---------- From: Praveen Velliengiri <[email protected]> Date: Wed, Jun 21, 2017 at 4:22 PM Subject: GSoC To: Patricia Grubel <[email protected]>, Parsa Amini <[email protected]>, Hartmut Kaiser <[email protected]> Hi I have domain definitions now(not tested yet) and tomorrow I want to add operators over domains (like in chapel). Next thing I want to do is write a Mapper class - which takes policies ,domains, localities, Objects type. And distributes the domain over the localities. For creation of distributed objects. I think we can create components on the assigned localities and create objects through the components and manage it via Parcels. As far now I want to write a simple working model for that and getting that working I have to move to the standard md_span interfaces which at this point I'm not comfortable. Once I get underlying things like creating objects in remote localities and managing it correct I will move to the standard interfaces which requires some changes in the code. This is simple definition i write for how domain should look approximately. Tomorrow I have to make it more expressive and correct. Could you suggest any more ideas for creating objects in remote localities other than the one I have proposed ? Thank you Praveen v struct domain { private: std::size_t dimension; std::vector<std::size_t> space; std::string layout; public: /// default constructor /// empty dimension and space domain() : dimension(0),space(0),layout("row_major") {} domain(std::size_t const &dim, std::initializer_list<std::size_t> const &space_, std::string = "row_major") : dimension(dim), space(space),layout("row_major") { HPX_ASSERT(dimension == space.size()); } domain(std::size_t && dim, std::initializer_list<std::size_t> && space_,std::string = "row_major") : dimension(dim), space(space),layout("row_major") { HPX_ASSERT(dimension == space.size()); } /// CopyConstructable and MoveConstructable domain(domain const& v) noexcept :dimension(v.dimension), space(v.space), layout(v.layout) {} domain(domain && v) noexcept : dimension(std:move(v.dimension)), space(std::move(v.space)), layout(std::move(v.layout)) {} /// move assignable and copy assignable domain& operator= (domain&& other_domain) { dimension = std::move(other_domain.dimension); space = std::move(other_domain.space); layout = std::move(other_domain.layout); return *this; } domain& operator= (domain const& other_domain) { dimension = other_domain.dimension; space = other_domain.space; layout = other_domain.layout; return *this; } bool translate(std::vector<std::size_t> const& new_extents) { using namespace hpx::parallel; auto iterator = hpx::parallel::find_if( execution::par(execution::task), new_extents.begin(), new_extents.end(),[](std::size_t v) { if(v < std::size_t(0)) return true; }); if(iterator.get() == new_extents.end()) { auto it_ = new_extents.begin(); for(auto it = space.begin(); it != space.end() && it_ != new_extents.end(); it++, it_++) { *it = *it_; } return true; } else return false; } bool translate(std::vector<std::size_t> const&& new_extents) { using namespace hpx::parallel; auto iterator = hpx::parallel::find_if( execution::par(execution::task), new_extents.begin(), new_extents.end(),[](std::size_t v) { if(v < std::size_t(0)) return true; }); if(iterator.get() == new_extents.end()) { auto it_ = new_extents.begin(); for(auto it = space.begin(); it != space.end() && it_ != new_extents.end(); it++, it_++) { *it = *it_; } return true; } else return false; } domain expand(std::vector<std::size_t> & ref) { std::size_t i(0); for(auto &it : ref) { it = space[i] + it; i++; } return domain(ref.size(), ref); } domain expand(std::vector<std::size_t> && ref) { std::size_t i(0); for(auto &it : ref) { it = space[i] + it; i++; } return domain(ref.size(), std::move(ref)); } /// operators bool operator== (domain const& dom) { if(dimension == dom.dimension) { auto it_ = dom.space.begin(); for(auto it = space.begin(); it != space.end(); ++it, ++it_) { if(*it != *it_) return false; } return true; } else return false; } bool operator!= (domain const& dom) { if(dimension == dom.dimension) { auto it_ = dom.space.begin(); for(auto it = space.begin(); it != space.end(); ++it, ++it_) { if(*it != *it_) return true; } return false; } else return true; } std::size_t get_rank() { return this.dimension; } void clear_domain() { dimension = 0; space.clear(); } bool domain_isempty() { if(dimension == 0 && space.empty()) return true; else return false; } std::size_t capacity() { std::size_t max(1); for(auto& ref : space) max = max * ref; return max; }
_______________________________________________ hpx-users mailing list [email protected] https://mail.cct.lsu.edu/mailman/listinfo/hpx-users
