0
$\begingroup$

Is there a way to run complex list comprehensions like the following on GPU?

[[x[index] if x[index]>len(x) else x[index]-1 for x in slice] if (len(slice)==1) else slice for slice,index in zip(slices,indices)]

To what degree is it Possible? Do I have to convert it to some kind of numpy comprehension (if so what part is speciffically possible/necessary)

The goal is performance optimization on large datalists/arrays.

$\endgroup$
2
  • 1
    $\begingroup$ I think you would get a better response for this on StackOverflow, $\endgroup$
    – bkshi
    Apr 29 '20 at 18:17
  • $\begingroup$ Take a look at Nvidia's Copperhead. $\endgroup$ Apr 29 '20 at 19:50
1
$\begingroup$

There are several different methods.

One method to use Numba which is a just-in-time complier. Numba can compile Python to target CUDA. CUDA is a API for GPU computation.

$\endgroup$
1
  • $\begingroup$ Sorry to disappoint you, list comprehensions are not supported on CUDA numba $\endgroup$ Dec 29 '20 at 8:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.