Cannot run my code to use GPU instead of CPU, please help

Im new , but Im trying to learn . Im trying to use my code to work with GPU instead of CPU, but cannot get it work.
Here is my pure code, its working but I wish to accelerate with GPU:

start = 20
unknown = 1
finish = 100
def test():
    global check
    check = start + unknown
    return check
check = test()
while check != finish:
    unknown += 1

I got the error:

AttributeError: Failed at object (analyzing bytecode)
'DataFlowAnalysis' object has no attribute 'op_STORE_GLOBAL'

If anyone can help?
Thank you.

1 Like

Absolutely no idea how you’re executing (which you’ve already been told on another site) that or whether at all possible, but I’ll point out that sequential code will only run slower on a gpu.

Your error message looks like it’s complaining about a python bytecode, you can view the bytecode of a function by doing:

import dis
dis.dis(test)  # where test is your function

In other words, it would seem that you need to rewrite your function so that it does not use that bytecode.

If you want sequential python code to run faster, look into pypy instead.