{"action":"created","issue":{"url":"https://api.github.com/repos/ComputationalRadiationPhysics/alpaka/issues/175","repository_url":"https://api.github.com/repos/ComputationalRadiationPhysics/alpaka","labels_url":"https://api.github.com/repos/ComputationalRadiationPhysics/alpaka/issues/175/labels{/name}","comments_url":"https://api.github.com/repos/ComputationalRadiationPhysics/alpaka/issues/175/comments","events_url":"https://api.github.com/repos/ComputationalRadiationPhysics/alpaka/issues/175/events","html_url":"https://github.com/ComputationalRadiationPhysics/alpaka/issues/175","id":133958687,"number":175,"title":"trait to get stream type","user":{"login":"psychocoderHPC","id":4037125,"avatar_url":"https://avatars.githubusercontent.com/u/4037125?v=3","gravatar_id":"","url":"https://api.github.com/users/psychocoderHPC","html_url":"https://github.com/psychocoderHPC","followers_url":"https://api.github.com/users/psychocoderHPC/followers","following_url":"https://api.github.com/users/psychocoderHPC/following{/other_user}","gists_url":"https://api.github.com/users/psychocoderHPC/gists{/gist_id}","starred_url":"https://api.github.com/users/psychocoderHPC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/psychocoderHPC/subscriptions","organizations_url":"https://api.github.com/users/psychocoderHPC/orgs","repos_url":"https://api.github.com/users/psychocoderHPC/repos","events_url":"https://api.github.com/users/psychocoderHPC/events{/privacy}","received_events_url":"https://api.github.com/users/psychocoderHPC/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ComputationalRadiationPhysics/alpaka/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-02-16T11:40:40Z","updated_at":"2016-02-17T09:07:16Z","closed_at":null,"body":"Currently the user needs background knowledge to get the right stream type depending on the selected device.\r\nWe need something that gets the stream out of the device or maybe out of the platform if #167 is merged.\r\n\r\nCurrent usage:\r\n```C++\r\nusing AccDev = ::alpaka::dev::DevCpu;\r\n//async stream\r\nusing AccStream = ::alpaka::stream::StreamCpuAsync;\r\n//sync stream\r\nusing AccStream = ::alpaka::stream::StreamCpuAsync;\r\n\r\n//or for GPU\r\nusing AccDev = ::alpaka::dev::DevCudaRt;\r\nusing AccStream = ::alpaka::stream::StreamCudaRtAsync;\r\nusing AccStream = ::alpaka::stream::StreamCudaRtSync;\r\n```\r\n\r\nMy preferred way:\r\n```C++\r\nusing AccDev = ::alpaka::dev::DevCpu;\r\n//async stream\r\nusing AccStream = ::alpaka::stream::getType<AccDev, ::alpaka::stream::Async>;\r\n//sync stream\r\n//using AccStream = ::alpaka::stream::getType<AccDev, ::alpaka::stream::Sync>;\r\n\r\n//or for GPU\r\nusing AccDev = ::alpaka::dev::DevCudaRt;\r\nusing AccStream = ::alpaka::stream::getType<AccDev, ::alpaka::stream::Async>\r\nusing AccStream = ::alpaka::stream::getType<AccDev, ::alpaka::stream::Sync>\r\n```\r\n\r\nThis needs no knowledge about the naming and which devices needs which stream type."},"comment":{"url":"https://api.github.com/repos/ComputationalRadiationPhysics/alpaka/issues/comments/185105504","html_url":"https://github.com/ComputationalRadiationPhysics/alpaka/issues/175#issuecomment-185105504","issue_url":"https://api.github.com/repos/ComputationalRadiationPhysics/alpaka/issues/175","id":185105504,"user":{"login":"psychocoderHPC","id":4037125,"avatar_url":"https://avatars.githubusercontent.com/u/4037125?v=3","gravatar_id":"","url":"https://api.github.com/users/psychocoderHPC","html_url":"https://github.com/psychocoderHPC","followers_url":"https://api.github.com/users/psychocoderHPC/followers","following_url":"https://api.github.com/users/psychocoderHPC/following{/other_user}","gists_url":"https://api.github.com/users/psychocoderHPC/gists{/gist_id}","starred_url":"https://api.github.com/users/psychocoderHPC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/psychocoderHPC/subscriptions","organizations_url":"https://api.github.com/users/psychocoderHPC/orgs","repos_url":"https://api.github.com/users/psychocoderHPC/repos","events_url":"https://api.github.com/users/psychocoderHPC/events{/privacy}","received_events_url":"https://api.github.com/users/psychocoderHPC/received_events","type":"User","site_admin":false},"created_at":"2016-02-17T09:07:16Z","updated_at":"2016-02-17T09:07:16Z","body":"But keep in mind we need some instance or trait which maps streams to devices, else it is not possible to write platform independent code without `#ifdef` in the user code.\r\nWe need for streams a trait or a factory like `alapka::mem:alloc:alloc()` else it is like we use `alpaka::mem::buf::cuda::BufCudaRt` directly.\r\nA factory or trait not breaks the orthogonal concepts.\r\n\r\n> Users are free to implement other synchronous, asynchronous or even completely other types of \r\n> Streams for a specific Device. Therefore I think that there is no such general mapping and it is the task \r\n> of the user to define which stream should be used for which device.\r\n\r\nThis mapping needs knowledge about restrictions of each device and stream and must be part of alpaka."}}