Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

field.cpp example on Arch linux breaks on all backends #3369

Open
bitstormFA opened this issue Feb 25, 2023 · 1 comment · May be fixed by #3375
Open

field.cpp example on Arch linux breaks on all backends #3369

bitstormFA opened this issue Feb 25, 2023 · 1 comment · May be fixed by #3375
Labels

Comments

@bitstormFA
Copy link

building field.cpp in the examples and executing field_cuda, field_cpu, field_opencl results in errors
Seems to be caused by the join operation in line 41
array hbowl = join(1, constant(1, x.elements()), flat(bvals));

Description

After installing ArrayFire 3.8.3 from the community package in Arch linux I did check the examples from the corresponding github release tar. All executables for the field.cpp example produce errors

  • Additional details regarding the bug
    field_cpu breaks with
ArrayFire v3.8.3 (CPU, 64-bit Linux, build default)
malloc(): invalid size (unsorted)
[1]    113747 IOT instruction (core dumped)  ./field_cpu

field_cuda breaks with

ArrayFire v3.8.3 (CUDA, 64-bit Linux, build default)
Platform: CUDA Runtime 11.8, Driver: 525.89.02
[0] NVIDIA GeForce RTX 4090, 24151 MB, CUDA Compute 8.9
ArrayFire Exception (Internal error:998):
In function void arrayfire::cuda::join(Array<T>&, int, const std::vector<Array<T> >&) [with T = float]
In file src/backend/cuda/join.cpp:177
CUDA Error (1): invalid argument

 0# 0x00007F7D85C3161F in /usr/lib/libafcuda.so.3
 1# 0x00007F7D86475888 in /usr/lib/libafcuda.so.3
 2# 0x00007F7D8646C8AB in /usr/lib/libafcuda.so.3
 3# af::Window::vectorField(af::array const&, af::array const&, char const*) in /usr/lib/libafcuda.so.3
 4# main in ./field_cuda
 5# 0x00007F7D8363C790 in /usr/lib/libc.so.6
 6# __libc_start_main in /usr/lib/libc.so.6
 7# _start in ./field_cuda

In function void af::Window::vectorField(const af::array&, const af::array&, const char*)
In file src/api/cpp/graphics.cpp:135
terminate called after throwing an instance of 'af::exception'
  what():  ArrayFire Exception (Internal error:998):
In function void arrayfire::cuda::join(Array<T>&, int, const std::vector<Array<T> >&) [with T = float]
In file src/backend/cuda/join.cpp:177
CUDA Error (1): invalid argument

 0# 0x00007F7D85C3161F in /usr/lib/libafcuda.so.3
 1# 0x00007F7D86475888 in /usr/lib/libafcuda.so.3
 2# 0x00007F7D8646C8AB in /usr/lib/libafcuda.so.3
 3# af::Window::vectorField(af::array const&, af::array const&, char const*) in /usr/lib/libafcuda.so.3
 4# main in ./field_cuda
 5# 0x00007F7D8363C790 in /usr/lib/libc.so.6
 6# __libc_start_main in /usr/lib/libc.so.6
 7# _start in ./field_cuda

In function void af::Window::vectorField(const af::array&, const af::array&, const char*)
In file src/api/cpp/graphics.cpp:135
[1]    115369 IOT instruction (core dumped)  ./field_cuda

field_opencl breaks with

ArrayFire v3.8.3 (OpenCL, 64-bit Linux, build default)
[0] NVIDIA: NVIDIA GeForce RTX 4090, 24150 MB -- OpenCL 3.0 CUDA -- Device driver 525.89.02 -- FP64 Support: True
ArrayFire Exception (Internal error:998):
OpenCL Error (-30): Invalid Value when calling clEnqueueCopyBuffer
In function void af::Window::vectorField(const af::array&, const af::array&, const char*)
In file src/api/cpp/graphics.cpp:135
terminate called after throwing an instance of 'af::exception'
  what():  ArrayFire Exception (Internal error:998):
OpenCL Error (-30): Invalid Value when calling clEnqueueCopyBuffer
In function void af::Window::vectorField(const af::array&, const af::array&, const char*)
In file src/api/cpp/graphics.cpp:135
[1]    118638 IOT instruction (core dumped)  ./field_opencl

  • Did you build ArrayFire yourself or did you use the official installers
    I used the Arch community build

  • Which backend is experiencing this issue? (CPU, CUDA, OpenCL)
    All

  • Do you have a workaround?
    No

  • Can the bug be reproduced reliably on your system?
    Yes

  • A clear and concise description of what you expected to happen.
    join operation on two arrays

  • Run your executable with AF_TRACE=all and AF_PRINT_ERRORS=1 environment
    variables set.

  • Screenshot or terminal output of the results

➜ ./field_cpu   
[platform][1677346557][121088] [ /usr/src/debug/arrayfire/arrayfire-full-3.8.3/src/backend/common/DependencyModule.cpp:101 ] Attempting to load: libforge.so
[platform][1677346557][121088] [ /usr/src/debug/arrayfire/arrayfire-full-3.8.3/src/backend/common/DependencyModule.cpp:104 ] Found: libforge.so
[mem][1677346557][121088] [ /usr/src/debug/arrayfire/arrayfire-full-3.8.3/src/backend/common/DefaultMemoryManager.cpp:127 ] memory[0].max_bytes: 61.6 GB
ArrayFire v3.8.3 (CPU, 64-bit Linux, build default)
[0] AMD: AMD Ryzen Threadripper 3960X 24-Core Processor [mem][1677346557][121088] [ /usr/src/debug/arrayfire/arrayfire-full-3.8.3/src/backend/cpu/memory.cpp:147 ] nativeAlloc:    1 KB 0x5646a7100fe0
[mem][1677346557][121088] [ /usr/src/debug/arrayfire/arrayfire-full-3.8.3/src/backend/cpu/memory.cpp:147 ] nativeAlloc:    5 KB 0x5646a70e41f0
[mem][1677346557][121088] [ /usr/src/debug/arrayfire/arrayfire-full-3.8.3/src/backend/cpu/memory.cpp:147 ] nativeAlloc:    5 KB 0x5646a717b2a0
[mem][1677346557][121088] [ /usr/src/debug/arrayfire/arrayfire-full-3.8.3/src/backend/cpu/memory.cpp:147 ] nativeAlloc:   10 KB 0x5646a717c6b0
[mem][1677346557][121088] [ /usr/src/debug/arrayfire/arrayfire-full-3.8.3/src/backend/cpu/memory.cpp:147 ] nativeAlloc:   10 KB 0x5646a7118830
[mem][1677346557][121088] [ /usr/src/debug/arrayfire/arrayfire-full-3.8.3/src/backend/cpu/memory.cpp:147 ] nativeAlloc:    5 KB 0x5646a7143ce0
[mem][1677346557][121088] [ /usr/src/debug/arrayfire/arrayfire-full-3.8.3/src/backend/cpu/memory.cpp:147 ] nativeAlloc:   10 KB 0x5646a71837e0
[mem][1677346557][121088] [ /usr/src/debug/arrayfire/arrayfire-full-3.8.3/src/backend/cpu/memory.cpp:147 ] nativeAlloc:    5 KB 0x5646a7185ff0
[mem][1677346557][121088] [ /usr/src/debug/arrayfire/arrayfire-full-3.8.3/src/backend/cpu/memory.cpp:147 ] nativeAlloc:    1 KB 0x5646a7181990
[mem][1677346557][121088] [ /usr/src/debug/arrayfire/arrayfire-full-3.8.3/src/backend/cpu/memory.cpp:147 ] nativeAlloc:    1 KB 0x5646a70e5f40
malloc_consolidate(): invalid chunk size
[1]    121088 IOT instruction (core dumped)  ./field_cpu

Reproducible Code and/or Steps

System Information

@bitstormFA bitstormFA added the bug label Feb 25, 2023
willyborn added a commit to willyborn/arrayfire that referenced this issue Mar 12, 2023
Unitiliazed buffer used to collect partial join.
Join now accepts any buffer as out array, as long as it is large enough.
@willyborn willyborn linked a pull request Mar 14, 2023 that will close this issue
3 tasks
willyborn added a commit to willyborn/arrayfire that referenced this issue Mar 28, 2023
Corrected possible buffer overflow in vector_field
Join now accepts any buffer as out array, as long as it is large enough.
willyborn added a commit to willyborn/arrayfire that referenced this issue Mar 28, 2023
Corrected buffer overflow in vector_field
Join now accepts any buffer as out array, as long as it is large enough.
@PavloVlastos
Copy link

PavloVlastos commented Feb 28, 2024

Mine does this as well for field_* with openCL, CUDA, and CPU. I'm running Ubuntu 22.04, x86_64 architecture. I built from source from master, as of 2024-02-26. All other example graphics work. See below:


$  ./graphics/field_cuda
ArrayFire v3.9.0 (CUDA, 64-bit Linux, build 4061db86e)
Platform: CUDA Runtime 12.3, Driver: 545.23.08
[0] NVIDIA GeForce RTX 4060, 7931 MB, CUDA Compute 8.9
ArrayFire Exception (Internal error:998):
In function join
In file src/backend/cuda/join.cpp:177
CUDA Error (1): invalid argument

 0# 0x00007FF2BA1B8720 in /usr/local/lib/libafcuda.so.3
 1# 0x00007FF2BAD0DE61 in /usr/local/lib/libafcuda.so.3
 2# 0x00007FF2BAD0491B in /usr/local/lib/libafcuda.so.3
 3# af::Window::vectorField(af::array const&, af::array const&, char const*) in /usr/local/lib/libafcuda.so.3
 4# 0x00005635C4EAE833 in ./graphics/field_cuda
 5# 0x00007FF2B6829D90 in /lib/x86_64-linux-gnu/libc.so.6
 6# __libc_start_main in /lib/x86_64-linux-gnu/libc.so.6
 7# 0x00005635C4EAEA85 in ./graphics/field_cuda

In function vectorField
In file src/api/cpp/graphics.cpp:135
terminate called after throwing an instance of 'af::exception'
  what():  ArrayFire Exception (Internal error:998):
In function join
In file src/backend/cuda/join.cpp:177
CUDA Error (1): invalid argument

 0# 0x00007FF2BA1B8720 in /usr/local/lib/libafcuda.so.3
 1# 0x00007FF2BAD0DE61 in /usr/local/lib/libafcuda.so.3
 2# 0x00007FF2BAD0491B in /usr/local/lib/libafcuda.so.3
 3# af::Window::vectorField(af::array const&, af::array const&, char const*) in /usr/local/lib/libafcuda.so.3
 4# 0x00005635C4EAE833 in ./graphics/field_cuda
 5# 0x00007FF2B6829D90 in /lib/x86_64-linux-gnu/libc.so.6
 6# __libc_start_main in /lib/x86_64-linux-gnu/libc.so.6
 7# 0x00005635C4EAEA85 in ./graphics/field_cuda

In function vectorField
In file src/api/cpp/graphics.cpp:135
Aborted (core dumped)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants