{"action":"created","issue":{"url":"https://api.github.com/repos/dealii/dealii/issues/3766","repository_url":"https://api.github.com/repos/dealii/dealii","labels_url":"https://api.github.com/repos/dealii/dealii/issues/3766/labels{/name}","comments_url":"https://api.github.com/repos/dealii/dealii/issues/3766/comments","events_url":"https://api.github.com/repos/dealii/dealii/issues/3766/events","html_url":"https://github.com/dealii/dealii/pull/3766","id":200085198,"number":3766,"title":"Gather and scatter operations in vectorized array","user":{"login":"kronbichler","id":8276200,"avatar_url":"https://avatars.githubusercontent.com/u/8276200?v=3","gravatar_id":"","url":"https://api.github.com/users/kronbichler","html_url":"https://github.com/kronbichler","followers_url":"https://api.github.com/users/kronbichler/followers","following_url":"https://api.github.com/users/kronbichler/following{/other_user}","gists_url":"https://api.github.com/users/kronbichler/gists{/gist_id}","starred_url":"https://api.github.com/users/kronbichler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kronbichler/subscriptions","organizations_url":"https://api.github.com/users/kronbichler/orgs","repos_url":"https://api.github.com/users/kronbichler/repos","events_url":"https://api.github.com/users/kronbichler/events{/privacy}","received_events_url":"https://api.github.com/users/kronbichler/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2017-01-11T12:52:09Z","updated_at":"2017-01-11T16:20:29Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/dealii/dealii/pulls/3766","html_url":"https://github.com/dealii/dealii/pull/3766","diff_url":"https://github.com/dealii/dealii/pull/3766.diff","patch_url":"https://github.com/dealii/dealii/pull/3766.patch"},"body":"A thing I'd like to discuss about this PR is the interface we choose for the gather and scatter methods. The code uses the following:\r\n```\r\nvoid gather (const Number *base_ptr,\r\n             const int    *offsets);\r\nvoid scatter (const int *offsets,\r\n              Number    *base_ptr) const;\r\n```\r\nIn the current version, I chose to use `int` pointers for the offsets because that is the syntax used by Intel for the optimized hardware versions. However, it would be more consistent with deal.II to use `unsigned int*` for the offsets, which would be my preference. (We do not expose hardware details elsewhere either.) It would also be harmless from an implementation point of view because I do reinterpret cast data types anyway (see e.g. line 598-599) and Intel explicitly allows aliasing between different types in the vector registers.\r\n\r\nI also added `DEAL_II_ALWAYS_INLINE` to all the small functions of `VectorizedArray` that really should be inlined because they map to a single multiplication, addition, etc.\r\n\r\nThe change in the test `vectorization_05` is to actually test all code paths of `vectorized_load_and_transpose` on AVX-512 (Intel Knights Landing) with 16 entries in `float`."},"comment":{"url":"https://api.github.com/repos/dealii/dealii/issues/comments/271914108","html_url":"https://github.com/dealii/dealii/pull/3766#issuecomment-271914108","issue_url":"https://api.github.com/repos/dealii/dealii/issues/3766","id":271914108,"user":{"login":"kronbichler","id":8276200,"avatar_url":"https://avatars.githubusercontent.com/u/8276200?v=3","gravatar_id":"","url":"https://api.github.com/users/kronbichler","html_url":"https://github.com/kronbichler","followers_url":"https://api.github.com/users/kronbichler/followers","following_url":"https://api.github.com/users/kronbichler/following{/other_user}","gists_url":"https://api.github.com/users/kronbichler/gists{/gist_id}","starred_url":"https://api.github.com/users/kronbichler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kronbichler/subscriptions","organizations_url":"https://api.github.com/users/kronbichler/orgs","repos_url":"https://api.github.com/users/kronbichler/repos","events_url":"https://api.github.com/users/kronbichler/events{/privacy}","received_events_url":"https://api.github.com/users/kronbichler/received_events","type":"User","site_admin":false},"created_at":"2017-01-11T16:20:29Z","updated_at":"2017-01-11T16:20:29Z","body":"When talking about design choices: We now have a different order of arguments in the gather and scatter operations:\r\n```\r\nvoid gather (const Number       *base_ptr,\r\n             const unsigned int *offsets);\r\nvoid scatter (const unsigned int *offsets,\r\n              Number             *base_ptr) const;\r\n```\r\nIt is clear that we need to put the base pointer last in `scatter` because data gets written to it. On the other hand, we could also put the base pointer behind in the `gather` operation. But I think it would be confusing because the pseudo code uses `base_ptr[offsets[v]]`, so `base_ptr` comes prior to `offsets`. And it is illustrative in the sense that it indicates that the `gather` call does not modify the inputs (only itself), whereas the `scatter` call only modifies the `base_ptr` (last argument), so a different order makes the difference in the mechanisms clearer."}}
{"actor":{"display_login":"kronbichler"}}