{"action":"created","issue":{"url":"https://api.github.com/repos/NumScale/boost.simd/issues/299","repository_url":"https://api.github.com/repos/NumScale/boost.simd","labels_url":"https://api.github.com/repos/NumScale/boost.simd/issues/299/labels{/name}","comments_url":"https://api.github.com/repos/NumScale/boost.simd/issues/299/comments","events_url":"https://api.github.com/repos/NumScale/boost.simd/issues/299/events","html_url":"https://github.com/NumScale/boost.simd/issues/299","id":185115991,"number":299,"title":"scattering store ?","user":{"login":"Bert-Tijskens","id":10629526,"avatar_url":"https://avatars.githubusercontent.com/u/10629526?v=3","gravatar_id":"","url":"https://api.github.com/users/Bert-Tijskens","html_url":"https://github.com/Bert-Tijskens","followers_url":"https://api.github.com/users/Bert-Tijskens/followers","following_url":"https://api.github.com/users/Bert-Tijskens/following{/other_user}","gists_url":"https://api.github.com/users/Bert-Tijskens/gists{/gist_id}","starred_url":"https://api.github.com/users/Bert-Tijskens/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Bert-Tijskens/subscriptions","organizations_url":"https://api.github.com/users/Bert-Tijskens/orgs","repos_url":"https://api.github.com/users/Bert-Tijskens/repos","events_url":"https://api.github.com/users/Bert-Tijskens/events{/privacy}","received_events_url":"https://api.github.com/users/Bert-Tijskens/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/NumScale/boost.simd/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/NumScale/boost.simd/labels/feature","name":"feature","color":"d4c5f9"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/NumScale/boost.simd/milestones/2","html_url":"https://github.com/NumScale/boost.simd/milestones/Release%204.16.10.0","labels_url":"https://api.github.com/repos/NumScale/boost.simd/milestones/2/labels","id":1940134,"number":2,"title":"Release 4.16.10.0","description":"","creator":{"login":"jfalcou","id":285977,"avatar_url":"https://avatars.githubusercontent.com/u/285977?v=3","gravatar_id":"","url":"https://api.github.com/users/jfalcou","html_url":"https://github.com/jfalcou","followers_url":"https://api.github.com/users/jfalcou/followers","following_url":"https://api.github.com/users/jfalcou/following{/other_user}","gists_url":"https://api.github.com/users/jfalcou/gists{/gist_id}","starred_url":"https://api.github.com/users/jfalcou/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jfalcou/subscriptions","organizations_url":"https://api.github.com/users/jfalcou/orgs","repos_url":"https://api.github.com/users/jfalcou/repos","events_url":"https://api.github.com/users/jfalcou/events{/privacy}","received_events_url":"https://api.github.com/users/jfalcou/received_events","type":"User","site_admin":false},"open_issues":3,"closed_issues":21,"state":"open","created_at":"2016-08-13T08:39:22Z","updated_at":"2016-10-25T13:43:22Z","due_on":"2016-10-31T00:00:00Z","closed_at":null},"comments":4,"created_at":"2016-10-25T13:22:17Z","updated_at":"2016-10-26T16:04:57Z","closed_at":null,"body":"I am trying to vectorise an algorithm which necessitates gather as well as scatter. In order to figure out how to do that i wrote a test program (code below). The gathering works fine, however, the scattering does not do anything\r\n\r\nthe output i get is \r\n`test::Gather<T=f>::test()` ...\r\n```\r\n0   p (0, 2, 4, 6, 8, 10, 12, 14)\r\n0 ip2 (1, 3, 5, 7, 9, 11, 13, 15)\r\n8   p (1, 3, 5, 7, 9, 11, 13, 15)\r\n8 ip2 (0, 2, 4, 6, 8, 10, 12, 14)\r\n[ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 ]\r\n```\r\n\r\nthe last line should contain the scattered results, but nothing has been written\r\nas far as i understand from the documentation this should do the trick:\r\n```\r\nbs::store( p, &dat2[0], ip2 );\r\n```\r\np is a `pack<float>` containing the values to be written, `&dat2[0]` a pointer to the destination array, and ip2 contains the destination indices for p\r\n\r\nI could not find a example of the intended behavior the examples nor in the test code that comes with boost simd.\r\nI am compiling using gcc6.2 with -mavx\r\n\r\nhere's the code:\r\n\r\n```c++\r\n#include <iostream>\r\n#include <vector>\r\n\r\n#include <boost/simd/memory/allocator.hpp>\r\n#include <boost/simd/function/load.hpp>\r\n#include <boost/simd/function/aligned_load.hpp>\r\n#include <boost/simd/function/aligned_store.hpp>\r\n\r\n#include <typeinfo>\r\n#include <boost/simd/pack.hpp>\r\n#include <boost/simd/function/rec.hpp>\r\nnamespace bs = boost::simd;\r\n\r\nnamespace test {\r\n    template <class T, class U>\r\n    struct Gather\r\n    {\r\n        static void test()\r\n        {\r\n            std::cout<<\"test::Gather<T=\"<<typeid(T).name()<<\">::test() ... \"<<std::endl;\r\n\r\n            size_t n = 8;\r\n            std::vector<T, bs::allocator<T>> data(2*n);\r\n            std::vector<T, bs::allocator<T>> dat2(2*n);\r\n            std::vector<U, bs::allocator<U>> idx (2*n);\r\n            std::vector<U, bs::allocator<U>> idx2(2*n);\r\n            for( size_t i=0; i<2*n; ++i ) {\r\n                data[i] = T(i);\r\n                dat2[i] = T(-1);\r\n            }// data = { 1 2 ... 2*n }\r\n            for( size_t i=0; i<n; ++i ) {\r\n                idx [i  ] = T(2*i  );\r\n                idx [i+n] = T(2*i+1);\r\n                idx2[i  ] = T(2*i+1);\r\n                idx2[i+n] = T(2*i  );\r\n            }// idx = { 0 2 4 ... 2*n   1 3 5 ... 2*n-1 }\r\n             // idx2= { 1 3 5 ... 2*n-1 0 2 4 ... 2*n   }\r\n            constexpr size_t N = bs::pack<T>::static_size;\r\n            typedef bs::pack<T,N> T_pack;\r\n            typedef bs::pack<U,N> U_pack;\r\n            for( size_t i=0; i<2*n; i+=U_pack::static_size ) {\r\n                U_pack ip = bs::aligned_load<U_pack>( &idx [i] );\r\n                T_pack p  = bs::        load<T_pack>( &data[0], ip );\r\n                std::cout<<i<<\"   p \"<<p<<std::endl;\r\n                U_pack ip2= bs::aligned_load<U_pack>( &idx2[i] );\r\n                std::cout<<i<<\" ip2 \"<<ip2<<std::endl;\r\n                bs::store( p, &dat2[0], ip2 );\r\n            }\r\n            std::cout<<\"[ \"<<dat2[0];\r\n            for( size_t i=1; i<2*n; ++i ) {\r\n                std::cout<<\", \"<<dat2[i];\r\n            }   std::cout<<\" ]\"<<std::endl;\r\n        }\r\n    };\r\n}// namespace test\r\n\r\nint main()\r\n{\r\n    test::Gather<float ,std::int32_t>::test();\r\n    test::Gather<double,std::int32_t>::test();\r\n    return 0;\r\n}\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/NumScale/boost.simd/issues/comments/256396627","html_url":"https://github.com/NumScale/boost.simd/issues/299#issuecomment-256396627","issue_url":"https://api.github.com/repos/NumScale/boost.simd/issues/299","id":256396627,"user":{"login":"jfalcou","id":285977,"avatar_url":"https://avatars.githubusercontent.com/u/285977?v=3","gravatar_id":"","url":"https://api.github.com/users/jfalcou","html_url":"https://github.com/jfalcou","followers_url":"https://api.github.com/users/jfalcou/followers","following_url":"https://api.github.com/users/jfalcou/following{/other_user}","gists_url":"https://api.github.com/users/jfalcou/gists{/gist_id}","starred_url":"https://api.github.com/users/jfalcou/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jfalcou/subscriptions","organizations_url":"https://api.github.com/users/jfalcou/orgs","repos_url":"https://api.github.com/users/jfalcou/repos","events_url":"https://api.github.com/users/jfalcou/events{/privacy}","received_events_url":"https://api.github.com/users/jfalcou/received_events","type":"User","site_admin":false},"created_at":"2016-10-26T16:04:57Z","updated_at":"2016-10-26T16:04:57Z","body":"Thansk :)\r\nI'll try to get it done for the 4.16.10.0 release next week-ish."}}
{"actor":{"display_login":"jfalcou"}}