[BUG, CUDA backend] af::shift cannot shift an array with one row
FloopCZ opened this issue · comments
Filip Matzner commented
af::shift
produces invalid result (a single repeating value) when shifting an array made of a single row on CUDA backend. On CPU backend, it works correctly.
#include <arrayfire.h>
int main() {
af::info();
af::array A = af::randu(1, 10);
af::print("A", A);
af::array A_shifted = af::shift(A, 0, 1);
af::print("A shifted", A_shifted);
A_shifted = af::shift(A, 1, 0);
af::print("A shifted", A_shifted);
}
Compile and run:
$ g++ -lafcuda bug.cpp && ./a.out
Output:
ArrayFire v3.8.3 (CUDA, 64-bit Linux, build default)
Platform: CUDA Runtime 12.0, Driver: 545.29.06
[0] NVIDIA RTX A500 Laptop GPU, 3905 MB, CUDA Compute 8.6
A
[1 10 1 1]
Offset: 0
Strides: [1 1 10 10]
0.6010 0.0278 0.9806 0.2126 0.0655 0.5497 0.2864 0.3410 0.7509 0.4105
A shifted
[1 10 1 1]
Offset: 0
Strides: [1 1 10 10]
0.4105 0.4105 0.4105 0.4105 0.4105 0.4105 0.4105 0.4105 0.4105 0.4105
A shifted
[1 10 1 1]
Offset: 0
Strides: [1 1 10 10]
0.6010 0.6010 0.6010 0.6010 0.6010 0.6010 0.6010 0.6010 0.6010 0.6010
System:
Linux pine 6.7.2-arch1-2 #1 SMP PREEMPT_DYNAMIC Wed, 31 Jan 2024 09:22:15 +0000 x86_64 GNU/Linux
ArrayFire v3.8.3 (CUDA, 64-bit Linux, build default)
Platform: CUDA Runtime 12.0, Driver: 545.29.06
NVIDIA RTX A500 Laptop GPU, 3905 MB, CUDA Compute 8.6
willy born commented
Filip,
PR #3513 should fix this problem.
With this PR, I get following result:
ArrayFire v3.9.0 (CUDA, 64-bit Windows, build a015130)
Platform: CUDA Runtime 11.8, Driver: 12020
[0] NVIDIA GeForce GTX 750 Ti, 2048 MB, CUDA Compute 5.0
A
[1 10 1 1]
0.6010 0.0278 0.9806 0.2126 0.0655 0.5497
0.2864 0.3410 0.7509 0.4105
A shifted
[1 10 1 1]
0.4105 0.6010 0.0278 0.9806 0.2126 0.0655
0.5497 0.2864 0.3410 0.7509
A shifted
[1 10 1 1]
0.6010 0.0278 0.9806 0.2126 0.0655 0.5497
0.2864 0.3410 0.7509 0.4105
BR,
Willy
…On Sun, 11 Feb 2024 at 12:04, Filip Matzner ***@***.***> wrote:
af::shift produces invalid result (a single repeating value) when
shifting an array made of a single row on CUDA backend. On CPU backend, it
works correctly.
#include <arrayfire.h>
int main() {
af::info();
af::array A = af::randu(1, 10);
af::print("A", A);
af::array A_shifted = af::shift(A, 0, 1);
af::print("A shifted", A_shifted);
A_shifted = af::shift(A, 1, 0);
af::print("A shifted", A_shifted);
}
Compile and run:
$ g++ -lafcuda bug.cpp && ./a.out
Output:
ArrayFire v3.8.3 (CUDA, 64-bit Linux, build default)
Platform: CUDA Runtime 12.0, Driver: 545.29.06
[0] NVIDIA RTX A500 Laptop GPU, 3905 MB, CUDA Compute 8.6
A
[1 10 1 1]
Offset: 0
Strides: [1 1 10 10]
0.6010 0.0278 0.9806 0.2126 0.0655 0.5497 0.2864 0.3410 0.7509 0.4105
A shifted
[1 10 1 1]
Offset: 0
Strides: [1 1 10 10]
0.4105 0.4105 0.4105 0.4105 0.4105 0.4105 0.4105 0.4105 0.4105 0.4105
A shifted
[1 10 1 1]
Offset: 0
Strides: [1 1 10 10]
0.6010 0.6010 0.6010 0.6010 0.6010 0.6010 0.6010 0.6010 0.6010 0.6010
System:
Linux pine 6.7.2-arch1-2 #1 SMP PREEMPT_DYNAMIC Wed, 31 Jan 2024 09:22:15 +0000 x86_64 GNU/Linux
ArrayFire v3.8.3 (CUDA, 64-bit Linux, build default)
Platform: CUDA Runtime 12.0, Driver: 545.29.06
NVIDIA RTX A500 Laptop GPU, 3905 MB, CUDA Compute 8.6
—
Reply to this email directly, view it on GitHub
<#3532>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AQ2WGPBKGPW7FU6SD7GNF6LYTCQVNAVCNFSM6AAAAABDDOMGPGVHI2DSMVQWIX3LMV43ASLTON2WKOZSGEZDQOJUGE3DGNA>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
Filip Matzner commented
Nice catch, that was a tricky one, thanks! Let's hope the PR will get a review from one of the maintainers soon.
willy born commented
Filip,
I tested your error with the official release 3.9.0 and it works there as
well, so upgrading to the latest version should help you.
No need for the PR.
…On Tue, 13 Feb 2024 at 21:57, Filip Matzner ***@***.***> wrote:
Nice catch, that was a tricky one, thanks! Let's hope the PR will get a
review from one of the maintainers soon.
—
Reply to this email directly, view it on GitHub
<#3532 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AQ2WGPFNMS2NTHVGZAYO4YDYTPHS7AVCNFSM6AAAAABDDOMGPGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNBSGQ4TGNBXGA>
.
You are receiving this because you commented.Message ID:
***@***.***>
Filip Matzner commented
Seems to be fixed in 3.9.0 indeed, thanks for testing!