{"action":"created","issue":{"url":"https://api.github.com/repos/arrayfire/arrayfire/issues/1513","repository_url":"https://api.github.com/repos/arrayfire/arrayfire","labels_url":"https://api.github.com/repos/arrayfire/arrayfire/issues/1513/labels{/name}","comments_url":"https://api.github.com/repos/arrayfire/arrayfire/issues/1513/comments","events_url":"https://api.github.com/repos/arrayfire/arrayfire/issues/1513/events","html_url":"https://github.com/arrayfire/arrayfire/issues/1513","id":167022301,"number":1513,"title":"Internal Error 998 when mixing channels of big arrays","user":{"login":"grzegorz-gutowski","id":5970093,"avatar_url":"https://avatars.githubusercontent.com/u/5970093?v=3","gravatar_id":"","url":"https://api.github.com/users/grzegorz-gutowski","html_url":"https://github.com/grzegorz-gutowski","followers_url":"https://api.github.com/users/grzegorz-gutowski/followers","following_url":"https://api.github.com/users/grzegorz-gutowski/following{/other_user}","gists_url":"https://api.github.com/users/grzegorz-gutowski/gists{/gist_id}","starred_url":"https://api.github.com/users/grzegorz-gutowski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grzegorz-gutowski/subscriptions","organizations_url":"https://api.github.com/users/grzegorz-gutowski/orgs","repos_url":"https://api.github.com/users/grzegorz-gutowski/repos","events_url":"https://api.github.com/users/grzegorz-gutowski/events{/privacy}","received_events_url":"https://api.github.com/users/grzegorz-gutowski/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-07-22T11:04:33Z","updated_at":"2016-07-28T17:06:46Z","closed_at":null,"body":"Hello,\r\nI'm running the following code that exploits wrap/unwrap to mix/unmix channels of an rgb image.\r\n```cpp\r\n#include <iostream>\r\n\r\n#include <arrayfire.h>\r\n\r\naf::array mix_chans(const af::array& a, const af::array& b, const af::array& c) {\r\n    unsigned d0 = a.dims(0);\r\n    unsigned d1 = a.dims(1);\r\n    auto a_ = af::moddims(a, 1, d0*d1);\r\n    auto b_ = af::moddims(b, 1, d0*d1);\r\n    auto c_ = af::moddims(c, 1, d0*d1);\r\n    auto u = af::join(0, a_, b_, c_); \r\n    return af::wrap(u, d0*3, d1, 3, 1, 3, 1, 0, 0);\r\n}\r\nvoid unmix_chans(const af::array& abc, af::array& a, af::array& b, af::array& c) {\r\n    unsigned d0 = abc.dims(0)/3;\r\n    unsigned d1 = abc.dims(1);\r\n    auto abc_ = af::flat(abc);\r\n    auto u = af::unwrap(abc_, 3, 1, 3, 1, 0, 0);\r\n    a = af::moddims(u(0, af::span, af::span, af::span), d0, d1);\r\n    b = af::moddims(u(1, af::span, af::span, af::span), d0, d1);\r\n    c = af::moddims(u(2, af::span, af::span, af::span), d0, d1);\r\n}\r\n\r\nint main() {\r\n    int w = 1920;\r\n    int h = 1080;\r\n    af::array r = af::randu(w, h);\r\n    af::array g = af::randu(w, h);\r\n    af::array b = af::randu(w, h);\r\n    af::array rgb = mix_chans(r, g, b);\r\n    af::array r_,g_,b_;\r\n    unmix_chans(rgb, r_, g_, b_);\r\n    std::cerr << af::max<double>(af::abs(r - r_)) << \" \" <<\r\n                 af::max<double>(af::abs(g - g_)) << \" \" <<\r\n                 af::max<double>(af::abs(b - b_)) << std::endl;\r\n}\r\n```\r\nI get the following CUDA/AF Internal error:\r\n```\r\nterminate called after throwing an instance of 'af::exception'\r\n  what():  ArrayFire Exception (Internal error:998):\r\nIn function memcopy\r\nIn file src/backend/cuda/kernel/memcopy.hpp:85\r\nCUDA Error (9): invalid configuration argument\r\n\r\n\r\nIn function af::array af::moddims(const af::array&, unsigned int, const dim_t*)\r\nIn file src/api/cpp/data.cpp:265\r\nAborted\r\n```\r\nWhen dimensions of the image are halved then everything runs fine.\r\nI'm using ArrayFire v3.3.2 (CUDA, 64-bit Linux, build f65dd97)."},"comment":{"url":"https://api.github.com/repos/arrayfire/arrayfire/issues/comments/235959635","html_url":"https://github.com/arrayfire/arrayfire/issues/1513#issuecomment-235959635","issue_url":"https://api.github.com/repos/arrayfire/arrayfire/issues/1513","id":235959635,"user":{"login":"pavanky","id":364829,"avatar_url":"https://avatars.githubusercontent.com/u/364829?v=3","gravatar_id":"","url":"https://api.github.com/users/pavanky","html_url":"https://github.com/pavanky","followers_url":"https://api.github.com/users/pavanky/followers","following_url":"https://api.github.com/users/pavanky/following{/other_user}","gists_url":"https://api.github.com/users/pavanky/gists{/gist_id}","starred_url":"https://api.github.com/users/pavanky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pavanky/subscriptions","organizations_url":"https://api.github.com/users/pavanky/orgs","repos_url":"https://api.github.com/users/pavanky/repos","events_url":"https://api.github.com/users/pavanky/events{/privacy}","received_events_url":"https://api.github.com/users/pavanky/received_events","type":"User","site_admin":false},"created_at":"2016-07-28T17:06:46Z","updated_at":"2016-07-28T17:06:46Z","body":"@grzegorz-gutowski We haven't fixed the original bug..  I just checked same commit on my GTX 950 and still get the original error.\r\n\r\nAre you sure you are running the same code ?"}}
{"actor":{"display_login":"pavanky"}}