Maximum digits int can have

Hi,
What is the maximum no of digits a numba python integer can have inside a cuda kernel. I need to handle max digits of 0s and 1s possible. When i was using pow(10,x) where x is very large i get wierd numbers. Whats happening.

Thanks,

The maximum integer is 64 bits. See also Deviations from Python Semantics — Numba 0+untagged.871.g53e976f.dirty documentation and NBEP 1: Changes in integer typing — Numba 0+untagged.871.g53e976f.dirty documentation

Thanks. I think that explains why i get wierd nos.

No problem. Do you have an alternative strategy you can use within the constraints of 64 bit integers, or does it make it impossible to implement your requirements?

Hi,
I am in this situation where i have a very large numpy array which needs to be processed into a python datatype like dict. The numba cuda is good at processing numbers in an array but it cannot populate a dictionary or list in parallel. So in my case i have to process the numpy array serially and it is little time consuming.

Thanks,

It needn’t necessarily be the case that you have to process the array serially in CUDA - if there’s some kind of reduction / aggregation going on, there may be strategies for threads to cooperate and / or avoid race conditions using atomic operations.

If you can describe the algorithm you’re implementing a bit more, it might be possible to see if there are other solutions.

This is the project i am working on GitHub - ps-nithin/pyrebel: Abstract representation of data for machine vision. The specific algorithm i am working is in src/pyrebel/learn.py. In that file function ‘find_signatures_cuda’ is the one using pow(10,x) where x goes very large and the function ‘find_signatures_cuda2’ is the one which is implemented as a workaround for the limitation of int64. You may want to see.

Thanks,

The large numpy arr (3dimensional) which i was talking about is actually the output of cuda operations. Now i want to join numbers(0s and 1s) in each subarray in it at axis 2 into a string and store inside a dictionary.

Thanks,

The exact task is to convert

a=[
     [[0,1,0,1,2,2,2,2,2,2],[1,1,0,1,2,2,2,2,2,2],[0,1,1,1,2,2,2,2,2,2],...n],
     [[0,1,1,1,2,2,2,2,2,2],[1,1,1,1,2,2,2,2,2,2],[1,1,0,1,2,2,2,2,2,2],...n],
     ... i]

into

b=[
     ["0101","1101","0111",...n],
     ["0111","1111","1101",...n],
     ...i]

Joining 0s and 1s and removing 2s.