Hey, I am encountering a similar issue. I am running Ubuntu 20.04 using python 3.8. Here are my results of
() with the different backends.
[0] GeForce RTX 2060 SUPER, 7981 MB, CUDA Compute 7.5
My problem arises when I try to run this function. It is part of a program that is suggested for testing by Arrayfire.
def calc_pi_device(samples):
# Simple, array based API
# Generate uniformly distributed random numbers
x = af.randu(samples)
y = af.randu(samples)
# Supports Just In Time Compilation
# The following line generates a single kernel
within_unit_circle = (x * x + y * y) < 1
# Intuitive function names
return 4 * af.count(within_unit_circle) / samples
The error only arises when this function is run with the cuda, or opencl backends. They are as follows:
cuda:
File "/home/thaddeus/Documents/Programming/Python/VideoStreaming/GPUtesting.py", line 19, in <module>
print(calc_pi_device(100000000))
File "/home/thaddeus/Documents/Programming/Python/VideoStreaming/GPUtesting.py", line 14, in calc_pi_device
return 4 * af.count(within_unit_circle) / samples
File "/home/thaddeus/Documents/Programming/Python/VideoStreaming/venv/lib/python3.8/site-packages/arrayfire/algorithm.py", line 383, in count
return _reduce_all(a, backend.get().af_count_all)
File "/home/thaddeus/Documents/Programming/Python/VideoStreaming/venv/lib/python3.8/site-packages/arrayfire/algorithm.py", line 26, in _reduce_all
safe_call(c_func(c_pointer(real), c_pointer(imag), a.arr))
File "/home/thaddeus/Documents/Programming/Python/VideoStreaming/venv/lib/python3.8/site-packages/arrayfire/util.py", line 79, in safe_call
raise RuntimeError(to_str(err_str))
RuntimeError: In function cuda::Module common::compileModule(const string&, const std::vector<std::basic_string<char> >&, const std::vector<std::basic_string<char> >&, const std::vector<std::basic_string<char> >&, bool)
In file src/backend/cuda/compile_module.cpp:
opencl:
File "/home/thaddeus/Documents/Programming/Python/VideoStreaming/GPUtesting.py", line 19, in <module>
print(calc_pi_device(100000000))
File "/home/thaddeus/Documents/Programming/Python/VideoStreaming/GPUtesting.py", line 14, in calc_pi_device
return 4 * af.count(within_unit_circle) / samples
File "/home/thaddeus/Documents/Programming/Python/VideoStreaming/venv/lib/python3.8/site-packages/arrayfire/algorithm.py", line 383, in count
return _reduce_all(a, backend.get().af_count_all)
File "/home/thaddeus/Documents/Programming/Python/VideoStreaming/venv/lib/python3.8/site-packages/arrayfire/algorithm.py", line 26, in _reduce_all
safe_call(c_func(c_pointer(real), c_pointer(imag), a.arr))
File "/home/thaddeus/Documents/Programming/Python/VideoStreaming/venv/lib/python3.8/site-packages/arrayfire/util.py", line 79, in safe_call
raise RuntimeError(to_str(err_str))
RuntimeError: In function cl::Program opencl::buildProgram(const std::vector<std::basic_string<char>, std::allocator<std::basic_string<char> > >&, const std::vector<std::basic_string<char>, std::allocator<std::basic_string<char> > >&)
In file src/backend/opencl/compile_module.cpp:
For a little more information here is another scenario with an error, and without an error. This section was all run with the opencl backend.
If I execute
y = af.randu(100)
af.display(y)
I get
I thought this might be due to the just in time compilation. So I had it multiply all the results by 1.
y = af.randu(100) * 1
af.display(y)
I got the following error though.
y
[Traceback (most recent call last):
File "/home/thaddeus/Documents/Programming/Python/VideoStreaming/GPUtesting.py", line 19, in <module>
af.display(y)
File "/home/thaddeus/Documents/Programming/Python/VideoStreaming/venv/lib/python3.8/site-packages/arrayfire/array.py", line 1426, in display
safe_call(backend.get().af_print_array_gen(name.encode('utf-8'),
File "/home/thaddeus/Documents/Programming/Python/VideoStreaming/venv/lib/python3.8/site-packages/arrayfire/util.py", line 79, in safe_call
raise RuntimeError(to_str(err_str))
RuntimeError: In function void print(const char*, af_array, int, std::ostream&, bool) [with T = float; af_array = void*; std::ostream = std::basic_ostream<char>]
In file src/api/c/print.cpp:
If anyone has a suggestion please let me know. Thank you for your time.