{"action":"created","issue":{"url":"https://api.github.com/repos/arrayfire/arrayfire/issues/981","labels_url":"https://api.github.com/repos/arrayfire/arrayfire/issues/981/labels{/name}","comments_url":"https://api.github.com/repos/arrayfire/arrayfire/issues/981/comments","events_url":"https://api.github.com/repos/arrayfire/arrayfire/issues/981/events","html_url":"https://github.com/arrayfire/arrayfire/issues/981","id":104526690,"number":981,"title":"Sum of indexed array returns incorrect values","user":{"login":"shehzan10","id":2288659,"avatar_url":"https://avatars.githubusercontent.com/u/2288659?v=3","gravatar_id":"","url":"https://api.github.com/users/shehzan10","html_url":"https://github.com/shehzan10","followers_url":"https://api.github.com/users/shehzan10/followers","following_url":"https://api.github.com/users/shehzan10/following{/other_user}","gists_url":"https://api.github.com/users/shehzan10/gists{/gist_id}","starred_url":"https://api.github.com/users/shehzan10/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shehzan10/subscriptions","organizations_url":"https://api.github.com/users/shehzan10/orgs","repos_url":"https://api.github.com/users/shehzan10/repos","events_url":"https://api.github.com/users/shehzan10/events{/privacy}","received_events_url":"https://api.github.com/users/shehzan10/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/arrayfire/arrayfire/labels/bug","name":"bug","color":"FF0000"},{"url":"https://api.github.com/repos/arrayfire/arrayfire/labels/CUDA","name":"CUDA","color":"117711"},{"url":"https://api.github.com/repos/arrayfire/arrayfire/labels/OpenCL","name":"OpenCL","color":"ff9900"}],"state":"closed","locked":false,"assignee":{"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},"milestone":{"url":"https://api.github.com/repos/arrayfire/arrayfire/milestones/7","html_url":"https://github.com/arrayfire/arrayfire/milestones/3.1.1","labels_url":"https://api.github.com/repos/arrayfire/arrayfire/milestones/7/labels","id":1279862,"number":7,"title":"3.1.1","description":"- Bug fixes to 3.1.0\r\n- Minor performance improvements\r\n-  Build improvements","creator":{"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},"open_issues":1,"closed_issues":9,"state":"open","created_at":"2015-08-30T00:01:36Z","updated_at":"2015-09-13T12:48:32Z","due_on":"2015-09-15T04:00:00Z","closed_at":null},"comments":1,"created_at":"2015-09-02T16:53:26Z","updated_at":"2015-09-13T12:48:32Z","closed_at":"2015-09-13T12:48:32Z","body":"Source: https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg/arrayfire-users/MxGMBrZebzc/K6FcF5KBGAAJ\r\n\r\n```\r\narray aa = af::constant(-1, 4, 1, s32);\r\narray a = aa(2);\r\naf_print(aa);\r\naf_print(a);\r\n\r\nint sumAA = sum<int>(aa);\r\nint sumA = sum<int>(a);\r\ncout << sumAA << endl << sumA << endl;\r\n```\r\n\r\nOutputs:\r\n```\r\narrayfire(devel)$ ./build/examples/helloworld/helloworld_cpu\r\nWARNING: af_set_device not supported for CPU\r\nArrayFire v3.1.0 (CPU, 64-bit Linux, build 1a52ee1)\r\n[0] Intel: Intel(R) Core(TM) i7-4770K CPU @ 3.50GHz Max threads(8)\r\naa\r\n[4 1 1 1]\r\n        -1\r\n        -1\r\n        -1\r\n        -1\r\n\r\na\r\n[1 1 1 1]\r\n        -1\r\nsum(AA) = -4\r\nsum(A) = -1\r\narrayfire(devel)$ ./build/examples/helloworld/helloworld_cuda\r\nArrayFire v3.1.0 (CUDA, 64-bit Linux, build 1a52ee1)\r\nPlatform: CUDA Toolkit 7, Driver: 355.11\r\n[0] Quadro K5000, 4093 MB, CUDA Compute 3.0\r\naa\r\n[4 1 1 1]\r\n        -1\r\n        -1\r\n        -1\r\n        -1\r\n\r\na\r\n[1 1 1 1]\r\n        -1\r\nsum(AA) = -4\r\nsum(A) = 33554428\r\narrayfire(devel)$ ./build/examples/helloworld/helloworld_opencl\r\nDevice[1] has no support for OpenGL Interoperation\r\nArrayFire v3.1.0 (OpenCL, 64-bit Linux, build 1a52ee1)\r\n[0] NVIDIA  : Quadro K5000\r\n-1- INTEL   : Intel(R) Core(TM) i7-4770K CPU @ 3.50GHz\r\naa\r\n[4 1 1 1]\r\n        -1\r\n        -1\r\n        -1\r\n        -1\r\n\r\na\r\n[1 1 1 1]\r\n        -1\r\nsum(AA) = -4\r\nsum(A) = -4\r\n```\r\n\r\nCPU is working fine, CUDA and OpenCL give wrong results.\r\nI checked with a constant(1, 4, 1) as well. The results for CUDA and OpenCL are still incorrect."},"comment":{"url":"https://api.github.com/repos/arrayfire/arrayfire/issues/comments/139870189","html_url":"https://github.com/arrayfire/arrayfire/issues/981#issuecomment-139870189","issue_url":"https://api.github.com/repos/arrayfire/arrayfire/issues/981","id":139870189,"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":"2015-09-13T12:48:32Z","updated_at":"2015-09-13T12:48:32Z","body":"This is fixed and present in master."}}