Fine grain control over rows distribution among locales in multi-locale program in Chapel












4















I am trying to implement an SOR, successive over relaxation, program in Chapel for multi-locale, but with local memory so I want to distribute rows among the locales explicitly. I already have reshaped targetlocales to 1D, but now I am not sure how I can have control over the rows distribution among the locales.



I am very much used to MPI so I will give an example of what I want to achieve in accordance to MPI. Is there a way I can specify that I want to distribute all the array rows among locales as in #rows / #locales and the remaining rows on the last locales?



Issue I face in chapel at moment is:




  • locales = 2 pattern was 5 rows on locale - 1, 5 rows on locale - 2

  • locales = 3 pattern was 4 rows on locale - 1, 3 rows on locale - 2, 3 rows on locale - 3

  • locales = 4 pattern was 3 rows on locale - 1, 2 rows on locale - 2, 3 rows on locale - 3, 2 rows on locale - 4

  • locales = 8 pattern was 2 rows on locale - 1, 1 row on locale - 2, 1 row on locale - 3, 1 row on locale - 4, 2 rows on locale - 5, 1 row on locale - 6, 1 row on locale - 7, 1 row on locale - 8.
    The pattern changes as the #locales increases.


Since my array size will vary for each experiment, I want to have control over row distribution since its local memory multi-locale implementation. I would have to copy back and receive rows from neighboring locales.










share|improve this question





























    4















    I am trying to implement an SOR, successive over relaxation, program in Chapel for multi-locale, but with local memory so I want to distribute rows among the locales explicitly. I already have reshaped targetlocales to 1D, but now I am not sure how I can have control over the rows distribution among the locales.



    I am very much used to MPI so I will give an example of what I want to achieve in accordance to MPI. Is there a way I can specify that I want to distribute all the array rows among locales as in #rows / #locales and the remaining rows on the last locales?



    Issue I face in chapel at moment is:




    • locales = 2 pattern was 5 rows on locale - 1, 5 rows on locale - 2

    • locales = 3 pattern was 4 rows on locale - 1, 3 rows on locale - 2, 3 rows on locale - 3

    • locales = 4 pattern was 3 rows on locale - 1, 2 rows on locale - 2, 3 rows on locale - 3, 2 rows on locale - 4

    • locales = 8 pattern was 2 rows on locale - 1, 1 row on locale - 2, 1 row on locale - 3, 1 row on locale - 4, 2 rows on locale - 5, 1 row on locale - 6, 1 row on locale - 7, 1 row on locale - 8.
      The pattern changes as the #locales increases.


    Since my array size will vary for each experiment, I want to have control over row distribution since its local memory multi-locale implementation. I would have to copy back and receive rows from neighboring locales.










    share|improve this question



























      4












      4








      4








      I am trying to implement an SOR, successive over relaxation, program in Chapel for multi-locale, but with local memory so I want to distribute rows among the locales explicitly. I already have reshaped targetlocales to 1D, but now I am not sure how I can have control over the rows distribution among the locales.



      I am very much used to MPI so I will give an example of what I want to achieve in accordance to MPI. Is there a way I can specify that I want to distribute all the array rows among locales as in #rows / #locales and the remaining rows on the last locales?



      Issue I face in chapel at moment is:




      • locales = 2 pattern was 5 rows on locale - 1, 5 rows on locale - 2

      • locales = 3 pattern was 4 rows on locale - 1, 3 rows on locale - 2, 3 rows on locale - 3

      • locales = 4 pattern was 3 rows on locale - 1, 2 rows on locale - 2, 3 rows on locale - 3, 2 rows on locale - 4

      • locales = 8 pattern was 2 rows on locale - 1, 1 row on locale - 2, 1 row on locale - 3, 1 row on locale - 4, 2 rows on locale - 5, 1 row on locale - 6, 1 row on locale - 7, 1 row on locale - 8.
        The pattern changes as the #locales increases.


      Since my array size will vary for each experiment, I want to have control over row distribution since its local memory multi-locale implementation. I would have to copy back and receive rows from neighboring locales.










      share|improve this question
















      I am trying to implement an SOR, successive over relaxation, program in Chapel for multi-locale, but with local memory so I want to distribute rows among the locales explicitly. I already have reshaped targetlocales to 1D, but now I am not sure how I can have control over the rows distribution among the locales.



      I am very much used to MPI so I will give an example of what I want to achieve in accordance to MPI. Is there a way I can specify that I want to distribute all the array rows among locales as in #rows / #locales and the remaining rows on the last locales?



      Issue I face in chapel at moment is:




      • locales = 2 pattern was 5 rows on locale - 1, 5 rows on locale - 2

      • locales = 3 pattern was 4 rows on locale - 1, 3 rows on locale - 2, 3 rows on locale - 3

      • locales = 4 pattern was 3 rows on locale - 1, 2 rows on locale - 2, 3 rows on locale - 3, 2 rows on locale - 4

      • locales = 8 pattern was 2 rows on locale - 1, 1 row on locale - 2, 1 row on locale - 3, 1 row on locale - 4, 2 rows on locale - 5, 1 row on locale - 6, 1 row on locale - 7, 1 row on locale - 8.
        The pattern changes as the #locales increases.


      Since my array size will vary for each experiment, I want to have control over row distribution since its local memory multi-locale implementation. I would have to copy back and receive rows from neighboring locales.







      chapel






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 26 '18 at 21:16









      Brad

      2,573416




      2,573416










      asked Nov 25 '18 at 4:43









      Robin SharmaRobin Sharma

      706




      706
























          1 Answer
          1






          active

          oldest

          votes


















          3














          As background, the Chapel language itself does not dictate how an array's rows are distributed between the locales; rather, it is the definition of a domain map—a user-defined type that maps a domain's indices and array's elements to locales—that does so. The current Block distribution that's part of Chapel's standard modules does not currently have a way of specifying how the blocking is done apart from the default which you describe above. However, with effort, one could write their own domain map—or customize the BlockDist module—to get a different distribution.



          As I understand it, you want ceiling(rows / locales) on each of the initial locales and then the remaining elements on the final locale? This would be a reasonable thing to submit as a feature request on our GitHub issues page. Or if you wanted to tackle it yourself, you could ask for help getting started with the effort on Chapel's Gitter channel or mailing lists (see the user or developer resources pages for links to both).






          share|improve this answer
























          • As an editorial comment, I'll add that if your desire to control the per-locale block size is so that you can transliterate an MPI code into Chapel in a 1:1 fashion then it may be worth changing your thinking to make better use of Chapel's features (e.g., use StencilDist and have it communicate between neighbors rather than trying to do it manually yourself). OTOH, if your reason is that you need a specific layout in order to interoperate with an existing MPI library or code that requires a particular layout, that'd be a completely valid reason to extend Block in this way.

            – Brad
            Nov 28 '18 at 17:11











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53464714%2ffine-grain-control-over-rows-distribution-among-locales-in-multi-locale-program%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          3














          As background, the Chapel language itself does not dictate how an array's rows are distributed between the locales; rather, it is the definition of a domain map—a user-defined type that maps a domain's indices and array's elements to locales—that does so. The current Block distribution that's part of Chapel's standard modules does not currently have a way of specifying how the blocking is done apart from the default which you describe above. However, with effort, one could write their own domain map—or customize the BlockDist module—to get a different distribution.



          As I understand it, you want ceiling(rows / locales) on each of the initial locales and then the remaining elements on the final locale? This would be a reasonable thing to submit as a feature request on our GitHub issues page. Or if you wanted to tackle it yourself, you could ask for help getting started with the effort on Chapel's Gitter channel or mailing lists (see the user or developer resources pages for links to both).






          share|improve this answer
























          • As an editorial comment, I'll add that if your desire to control the per-locale block size is so that you can transliterate an MPI code into Chapel in a 1:1 fashion then it may be worth changing your thinking to make better use of Chapel's features (e.g., use StencilDist and have it communicate between neighbors rather than trying to do it manually yourself). OTOH, if your reason is that you need a specific layout in order to interoperate with an existing MPI library or code that requires a particular layout, that'd be a completely valid reason to extend Block in this way.

            – Brad
            Nov 28 '18 at 17:11
















          3














          As background, the Chapel language itself does not dictate how an array's rows are distributed between the locales; rather, it is the definition of a domain map—a user-defined type that maps a domain's indices and array's elements to locales—that does so. The current Block distribution that's part of Chapel's standard modules does not currently have a way of specifying how the blocking is done apart from the default which you describe above. However, with effort, one could write their own domain map—or customize the BlockDist module—to get a different distribution.



          As I understand it, you want ceiling(rows / locales) on each of the initial locales and then the remaining elements on the final locale? This would be a reasonable thing to submit as a feature request on our GitHub issues page. Or if you wanted to tackle it yourself, you could ask for help getting started with the effort on Chapel's Gitter channel or mailing lists (see the user or developer resources pages for links to both).






          share|improve this answer
























          • As an editorial comment, I'll add that if your desire to control the per-locale block size is so that you can transliterate an MPI code into Chapel in a 1:1 fashion then it may be worth changing your thinking to make better use of Chapel's features (e.g., use StencilDist and have it communicate between neighbors rather than trying to do it manually yourself). OTOH, if your reason is that you need a specific layout in order to interoperate with an existing MPI library or code that requires a particular layout, that'd be a completely valid reason to extend Block in this way.

            – Brad
            Nov 28 '18 at 17:11














          3












          3








          3







          As background, the Chapel language itself does not dictate how an array's rows are distributed between the locales; rather, it is the definition of a domain map—a user-defined type that maps a domain's indices and array's elements to locales—that does so. The current Block distribution that's part of Chapel's standard modules does not currently have a way of specifying how the blocking is done apart from the default which you describe above. However, with effort, one could write their own domain map—or customize the BlockDist module—to get a different distribution.



          As I understand it, you want ceiling(rows / locales) on each of the initial locales and then the remaining elements on the final locale? This would be a reasonable thing to submit as a feature request on our GitHub issues page. Or if you wanted to tackle it yourself, you could ask for help getting started with the effort on Chapel's Gitter channel or mailing lists (see the user or developer resources pages for links to both).






          share|improve this answer













          As background, the Chapel language itself does not dictate how an array's rows are distributed between the locales; rather, it is the definition of a domain map—a user-defined type that maps a domain's indices and array's elements to locales—that does so. The current Block distribution that's part of Chapel's standard modules does not currently have a way of specifying how the blocking is done apart from the default which you describe above. However, with effort, one could write their own domain map—or customize the BlockDist module—to get a different distribution.



          As I understand it, you want ceiling(rows / locales) on each of the initial locales and then the remaining elements on the final locale? This would be a reasonable thing to submit as a feature request on our GitHub issues page. Or if you wanted to tackle it yourself, you could ask for help getting started with the effort on Chapel's Gitter channel or mailing lists (see the user or developer resources pages for links to both).







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 26 '18 at 21:15









          BradBrad

          2,573416




          2,573416













          • As an editorial comment, I'll add that if your desire to control the per-locale block size is so that you can transliterate an MPI code into Chapel in a 1:1 fashion then it may be worth changing your thinking to make better use of Chapel's features (e.g., use StencilDist and have it communicate between neighbors rather than trying to do it manually yourself). OTOH, if your reason is that you need a specific layout in order to interoperate with an existing MPI library or code that requires a particular layout, that'd be a completely valid reason to extend Block in this way.

            – Brad
            Nov 28 '18 at 17:11



















          • As an editorial comment, I'll add that if your desire to control the per-locale block size is so that you can transliterate an MPI code into Chapel in a 1:1 fashion then it may be worth changing your thinking to make better use of Chapel's features (e.g., use StencilDist and have it communicate between neighbors rather than trying to do it manually yourself). OTOH, if your reason is that you need a specific layout in order to interoperate with an existing MPI library or code that requires a particular layout, that'd be a completely valid reason to extend Block in this way.

            – Brad
            Nov 28 '18 at 17:11

















          As an editorial comment, I'll add that if your desire to control the per-locale block size is so that you can transliterate an MPI code into Chapel in a 1:1 fashion then it may be worth changing your thinking to make better use of Chapel's features (e.g., use StencilDist and have it communicate between neighbors rather than trying to do it manually yourself). OTOH, if your reason is that you need a specific layout in order to interoperate with an existing MPI library or code that requires a particular layout, that'd be a completely valid reason to extend Block in this way.

          – Brad
          Nov 28 '18 at 17:11





          As an editorial comment, I'll add that if your desire to control the per-locale block size is so that you can transliterate an MPI code into Chapel in a 1:1 fashion then it may be worth changing your thinking to make better use of Chapel's features (e.g., use StencilDist and have it communicate between neighbors rather than trying to do it manually yourself). OTOH, if your reason is that you need a specific layout in order to interoperate with an existing MPI library or code that requires a particular layout, that'd be a completely valid reason to extend Block in this way.

          – Brad
          Nov 28 '18 at 17:11




















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53464714%2ffine-grain-control-over-rows-distribution-among-locales-in-multi-locale-program%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Feedback on college project

          Futebolista

          Albești (Vaslui)