{"action":"opened","issue":{"url":"https://api.github.com/repos/chapel-lang/chapel/issues/5512","repository_url":"https://api.github.com/repos/chapel-lang/chapel","labels_url":"https://api.github.com/repos/chapel-lang/chapel/issues/5512/labels{/name}","comments_url":"https://api.github.com/repos/chapel-lang/chapel/issues/5512/comments","events_url":"https://api.github.com/repos/chapel-lang/chapel/issues/5512/events","html_url":"https://github.com/chapel-lang/chapel/issues/5512","id":211919783,"number":5512,"title":"Feature request : simplifying intents in forall loops (and friends)","user":{"login":"npadmana","id":597866,"avatar_url":"https://avatars0.githubusercontent.com/u/597866?v=3","gravatar_id":"","url":"https://api.github.com/users/npadmana","html_url":"https://github.com/npadmana","followers_url":"https://api.github.com/users/npadmana/followers","following_url":"https://api.github.com/users/npadmana/following{/other_user}","gists_url":"https://api.github.com/users/npadmana/gists{/gist_id}","starred_url":"https://api.github.com/users/npadmana/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/npadmana/subscriptions","organizations_url":"https://api.github.com/users/npadmana/orgs","repos_url":"https://api.github.com/users/npadmana/repos","events_url":"https://api.github.com/users/npadmana/events{/privacy}","received_events_url":"https://api.github.com/users/npadmana/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-03-05T00:42:28Z","updated_at":"2017-03-05T00:42:28Z","closed_at":null,"body":"I often find myself doing multiple reductions of the same type in forall\r\nloops (eg. multiple accumulators). The way I currently do this is to\r\nspecify separate reduce intents (as in the commented line in the code\r\nbelow....)\r\n```\r\n  (+ reduce sum1, + reduce sum2)\r\n```\r\nWhile this works fine, it would be nice to write this as\r\n```\r\n  (+ reduce sum1,sum2)\r\n```\r\nor something like that (with a different delimiter, for instance). This could be extended to all intents (suggested by @nspark), instead of just reduce intents. \r\n\r\n@bradcray suggested using tuples for this \r\n```\r\n  (in (x,y), + reduce (sum1, sum2))\r\n```\r\n\r\nI'll note that OpenMP allows specifying such common reductions over a list of variables.\r\n\r\nThis was discussed in chapel-users [here.](https://sourceforge.net/p/chapel/mailman/chapel-users/thread/alpine.LNX.2.00.1703040850190.1380%40sealcs01.us.cray.com/#msg35701864)\r\n\r\nA possible future ---\r\n```\r\nvar sum1, sum2 = 0;\r\n\r\nconfig const N=100000;\r\n\r\nforall ii in 1..N with (+ reduce (sum1,sum2)) {\r\n  sum1 += ii;\r\n  sum2 += ii*ii;\r\n}\r\n\r\nwriteln(sum1);\r\nwriteln(sum2);\r\n```"}}
{"actor":{"display_login":"npadmana"}}