TransWikia.com

How to run list comprehensions on GPU?

Data Science Asked by Ishmael89 on August 11, 2021

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.

One Answer

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.

Answered by Brian Spiering on August 11, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP