Parsa and Parveen, Neat idea! I've a bit of experience programming in Chapel. The published code is a nice start. Chapel domains represent index sets - I'd strongly encourage you to consider decoupling the notion of row major ordering from struct domain.
Chapel domains (an index set) are typically mapped to data (local or distributed data) through a Domain Map. Think of a Domain Map as a recipe describing how to organize the data associated with a Domain (the index set). There's a great powerpoint presentation from SC10 that describes Domains, Domain Maps, and the "subtypes" of Domain Maps (layouts and distributions). http://chapel.cray.com/tutorials/SC10/M10-6-DomainMaps.pdf Depending on an input type, a Domain could contain several different types of indices. As an example: var dom : domain(1); // range contains 1 dimension of integers dom = {1..10}; // domain contains a range of elements from 1 to 10 var dom2 : domain(2); // range contains 2 dimensions of integer information dom2 = {1..10, 1..10}; // 2x2 range var dom_str : domain(string); // range containing string data dom_str += "cat"; // the string "cat" is added into the domain dom_str += "dog"; dom_str += "bird"; There seems like an opportunity to generalize the presented domain concept using template meta programming, specifically variadic templates and template specialization, to accommodate local and distributed (aka: segmented) HPX data structures. V/r, Chris On Wed, Jun 21, 2017 at 5:56 PM, Parsa Amini <[email protected]> wrote: > 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 > >
_______________________________________________ hpx-users mailing list [email protected] https://mail.cct.lsu.edu/mailman/listinfo/hpx-users
