a spectre with a new face
play

A SpECTRE With a New face Nils Deppe Simulating eXtreme Spacetimes - PowerPoint PPT Presentation

A SpECTRE With a New face Nils Deppe Simulating eXtreme Spacetimes Collaboration Charm ++ Workshop April 11, 2018 github.com/sxs-collaboration/spectre A SpECTRE With a New Face 1 / 21 Table of Contents 1 SpECTRE 2 The New face


  1. A SpECTRE With a New ’face Nils Deppe Simulating eXtreme Spacetimes Collaboration Charm ++ Workshop April 11, 2018 github.com/sxs-collaboration/spectre A SpECTRE With a New Face 1 / 21

  2. Table of Contents 1 SpECTRE 2 The New ’face github.com/sxs-collaboration/spectre A SpECTRE With a New Face 2 / 21

  3. SpECTRE Goals Physics: • Multi-scale, multi-physics relativistic astrophysics • Binary black holes, binary neutron stars • Core-collapse supernovae with micro-physics • Multi-disciplinary HPC: • Open-source, github.com/sxs-collaboration/spectre • Efficient • Exascale github.com/sxs-collaboration/spectre A SpECTRE With a New Face 3 / 21

  4. Domain Decomposition and Local Time Stepping B. Szilagyi, arXiv: 1405.3693 github.com/sxs-collaboration/spectre A SpECTRE With a New Face 4 / 21

  5. Dual Frames github.com/sxs-collaboration/spectre A SpECTRE With a New Face 5 / 21

  6. Table of Contents 1 SpECTRE 2 The New ’face github.com/sxs-collaboration/spectre A SpECTRE With a New Face 6 / 21

  7. Eliminating Charm++ Interface Files Issues with interface files: • Restrictive • Error-prone (undefined behavior = ⇒ difficult bugs) • Maintenance burden (users and Charm ++ devs) • Can’t handle modern C ++ = ⇒ inefficient generated code github.com/sxs-collaboration/spectre A SpECTRE With a New Face 7 / 21

  8. Eliminating Charm++ Interface Files Issues with interface files: • Restrictive • Error-prone (undefined behavior = ⇒ difficult bugs) • Maintenance burden (users and Charm ++ devs) • Can’t handle modern C ++ = ⇒ inefficient generated code Metaprogramming! github.com/sxs-collaboration/spectre A SpECTRE With a New Face 7 / 21

  9. Important Features We think: • Reduce user code • Really easy to use • Similar to current model: familiarity = ⇒ faster adoption • Error-free code generation • Eliminate runtime errors Any others?? github.com/sxs-collaboration/spectre A SpECTRE With a New Face 8 / 21

  10. Design Steps 1 Invoking entry methods 2 Creating chares 3 Reductions github.com/sxs-collaboration/spectre A SpECTRE With a New Face 8 / 21

  11. Invoking Entry Methods Entry methods MyEntryMethod0 , MyEntryMethod1 , and Charm ++ proxy my proxy . No arguments: charmxx ::invoke <MyEntryMethod0 >( my_proxy); Passing arguments: charmxx ::invoke <MyEntryMethod1 >(my_proxy , arg0 , arg1 , std::move(arg2)); github.com/sxs-collaboration/spectre A SpECTRE With a New Face 9 / 21

  12. Entry Methods/Actions struct MyEntryMethod1 { static void apply(const Arg0& arg0 , const Arg1& arg1 , Arg2&& arg2) noexcept { /* do work */ } }; • Entry methods are “member functions” github.com/sxs-collaboration/spectre A SpECTRE With a New Face 10 / 21

  13. Entry Methods/Actions struct MyEntryMethod1 { static void apply(const Arg0& arg0 , const Arg1& arg1 , Arg2&& arg2) noexcept { /* do work */ } }; • Entry methods are “member functions” • How to handle attributes? github.com/sxs-collaboration/spectre A SpECTRE With a New Face 10 / 21

  14. Entry Methods/Actions struct MyEntryMethod1 { static void apply(const Arg0& arg0 , const Arg1& arg1 , Arg2&& arg2) noexcept { /* do work */ } }; • Entry methods are “member functions” • How to handle attributes? • Where is chare member data? github.com/sxs-collaboration/spectre A SpECTRE With a New Face 10 / 21

  15. Entry Method Attributes Possible ways of controlling attributes: • Inside entry method class: struct EntryMethod0 { using attributes = charmxx ::AttrList < charmxx ::attrs::Inline >; /* apply function */ • At call site: charmxx ::invoke <MyEntryMethod1 , charmxx ::AttrList <charmxx ::attrs::Inline >>( my_proxy , arg0 , arg1 , std::move(arg2)); github.com/sxs-collaboration/spectre A SpECTRE With a New Face 11 / 21

  16. Member Data • Chares hold a TaggedTuple i.e. compile-time hash table • Tags to chare as template parameter, maybe: charmxx ::Chare <charmxx ::TagList <ParticleCoordinate , ParticleVelocity >> my_chare{start_coord , start_velocity }; • TaggedTuple passed to entry methods github.com/sxs-collaboration/spectre A SpECTRE With a New Face 12 / 21

  17. Passing Member Data To Entry Methods struct MyEntryMethod2 { template <class ... Tags > static void apply(charmxx :: TaggedTuple <Tags ...>& member_data , const double& delta_time) noexcept { const auto& vel = charmxx ::get <ParticleVelocity >( member_data); auto& coord = charmxx ::get <ParticleCoordinate >( member_data); coord += vel * delta_time; } }; github.com/sxs-collaboration/spectre A SpECTRE With a New Face 13 / 21

  18. Reducing Compilation Time 1/2 In MyEntryMethod2.hpp : #include "UpdateCoordinate.hpp" struct MyEntryMethod2 { template <class ... Tags > static void apply(charmxx :: TaggedTuple <Tags ...>& member_data , const double& delta_time) noexcept { update_coordinate( charmxx ::get <ParticleCoordinate >( member_data), charmxx ::get <ParticleVelocity >( member_data), delta_time); } }; github.com/sxs-collaboration/spectre A SpECTRE With a New Face 14 / 21

  19. Reducing Compilation Time 2/2 In UpdateCoordinate.hpp : void update_coordinate(double& coord , const double& vel , const double& delta_time); void update_coordinate(Vector& coord , const Vector& vel , const double& delta_time); In UpdateCoordinate.cpp : void update_coordinate(double& coord , const double& vel , const double& delta_time) { coord += vel * delta_time; } void update_coordinate(Vector& coord , const Vector& vel , const double& delta_time) { coord += vel * delta_time; } github.com/sxs-collaboration/spectre A SpECTRE With a New Face 15 / 21

  20. Design Steps 1 Invoking entry methods 2 Creating chares 3 Reductions github.com/sxs-collaboration/spectre A SpECTRE With a New Face 15 / 21

  21. Naming/Identifying Chares Charm ++ will supply class templates, need “names” struct MyChareName { // Singleton , Array , Group , or Nodegroup using chare_type = charmxx ::Array; // For arrays must specify index: using array_index = MyAwesomeArrayIndex; // List of the tags that are member data using tags = charmxx ::TagList <ParticleCoordinate , ParticleVelocity >; // To put proxy into a TaggedTuple: using type = charmxx :: compute_type <chare_type , tags >; }; github.com/sxs-collaboration/spectre A SpECTRE With a New Face 16 / 21

  22. Creating Chares Create using: auto my_proxy = charmxx :: MyChareName >( start_coord , start_velocity); auto my_proxy2 = charmxx ::create <MyChareName2 >( my_proxy , start_coord , start_velocity); • create replaces ckNew • Chare name is also tag! github.com/sxs-collaboration/spectre A SpECTRE With a New Face 17 / 21

  23. Bonus! Custom Array Indices Can handle custom array indices more easily, e.g. template <size_t VolumeDim > class ElementIndex { public: ElementIndex(const ElementId <VolumeDim >& id) noexcept; private: std::array <SegmentIndex , VolumeDim > segments_; }; ElementId indexes block, x , y , and z in domain github.com/sxs-collaboration/spectre A SpECTRE With a New Face 18 / 21

  24. Design Steps 1 Invoking entry methods 2 Creating chares 3 Reductions github.com/sxs-collaboration/spectre A SpECTRE With a New Face 18 / 21

  25. Reductions • Reductions become quite straight forward: charmxx :: contribute_to_reduction < ProcessReducedProductOfDoublesEntryMethod >( my_send_double , array_proxy[my_index], target_proxy , charmxx :: Reduction :: product_double); github.com/sxs-collaboration/spectre A SpECTRE With a New Face 19 / 21

  26. Reductions • Reductions become quite straight forward: charmxx :: contribute_to_reduction < ProcessReducedProductOfDoublesEntryMethod >( my_send_double , array_proxy[my_index], target_proxy , charmxx :: Reduction :: product_double); • Reducing custom data also simpler • Supply generic data structure for custom reductions charmxx :: ReductionData <int , std:: unordered_map <std::string , int >, std::vector <double >>; github.com/sxs-collaboration/spectre A SpECTRE With a New Face 19 / 21

  27. Custom Reductions Function to reduce custom data structure: charmxx :: ReductionMsg* reduce_reduction_data( const int number_of_messages , charmxx :: ReductionMsg ** const msgs) noexcept { /* custom reduction function */ } github.com/sxs-collaboration/spectre A SpECTRE With a New Face 20 / 21

  28. Custom Reductions Function to reduce custom data structure: charmxx :: ReductionMsg* reduce_reduction_data( const int number_of_messages , charmxx :: ReductionMsg ** const msgs) noexcept { /* custom reduction function */ } Inside an entry method: charmxx :: ReductionData <int , std:: unordered_map <std::string , int >, std::vector <int >> my_send_data{ 10, my_send_map , std::vector <int >{ array_index ,10,-8}}; charmxx :: contribute_to_reduction < &reduce_reduction_data , ProcessCustomReductionEntryMethod >( my_send_data , array_proxy[my_index], target_proxy); github.com/sxs-collaboration/spectre A SpECTRE With a New Face 20 / 21

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend