You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Example of the NumPy calculation exceeding the largest allowed signed 32-bit integer:
# this works just finenp.arange(0, 2147483648, 100000, dtype=np.uint32)
In PyKokkos not only do we not get a helpful error message (below), but I don't even know how to fix this:
Traceback (most recent call last):
File "/home/tyler/github_projects/pykokkos/test.py", line 10, in <module>
main()
File "/home/tyler/github_projects/pykokkos/test.py", line 6, in main
pk.arange(0, 2147483648, 100000, dtype=pk.uint32) # error
File "/home/tyler/github_projects/pykokkos/pykokkos/lib/create.py", line 62, in arange
_ufunc_kernel_dispatcher(tid=size,
File "/home/tyler/github_projects/pykokkos/pykokkos/lib/ufuncs.py", line 50, in _ufunc_kernel_dispatcher
ret = sub_dispatcher(tid, desired_workunit, **kwargs)
File "/home/tyler/github_projects/pykokkos/pykokkos/interface/parallel_dispatch.py", line 175, in parallel_for
func(**args)
RuntimeError: Unable to cast Python instance of type <class 'int'> to C++ type 'int'
I believe the issue boils down to range() in the workunit and how that gets translated over to C++ -- it obviously can't be the same as Python range() since Python can use arbitrary precision integers. Nonetheless, it would be helpful if:
the actual violating line in the workunit kernel were in the traceback
we had clear documentation of how to properly handle these scenarios, where the range includes input outside the normal positive (or negative) limit of C++ signed int32. Maybe we could provide a custom typing for i. It is really hard for me to judge here because it isn't Python or C++ anymore at this point, so I'm not even sure what syntax to use.
@JBludau may have something in the works to help out a bit here perhaps
For now, I'll just push my WIP on feature branch treddy_arange until I'm unstuck here.
The text was updated successfully, but these errors were encountered:
I should also mention--it isn't necessarily even clear to me that we'd want to make this multi-threaded/parallel -- nonetheless, the correct way forward would still be instructive for the purposes of crafting more sophisticated workunits.
While working on the implementation of
pk.arange()
the following scenario caused me a substantial headache. Example workunit:Example of the NumPy calculation exceeding the largest allowed signed 32-bit integer:
In PyKokkos not only do we not get a helpful error message (below), but I don't even know how to fix this:
I believe the issue boils down to
range()
in the workunit and how that gets translated over to C++ -- it obviously can't be the same as Pythonrange()
since Python can use arbitrary precision integers. Nonetheless, it would be helpful if:range
includes input outside the normal positive (or negative) limit of C++ signed int32. Maybe we could provide a custom typing fori
. It is really hard for me to judge here because it isn't Python or C++ anymore at this point, so I'm not even sure what syntax to use.@JBludau may have something in the works to help out a bit here perhaps
For now, I'll just push my WIP on feature branch
treddy_arange
until I'm unstuck here.The text was updated successfully, but these errors were encountered: