bifrost icon indicating copy to clipboard operation
bifrost copied to clipboard

Support for `astype()` on `bifrost.ndarray`'s

Open jaycedowell opened this issue 3 years ago • 1 comments

This PR enables support for the astype() method on bifrost.ndarray's. This was previously disabled because of problems with arrays that were in the "cuda" space. As implmented:

  • If an array is accessible from the "system" space:
    • Use numpy.ndarray.astype() for non-complex integer types. Complex integer types need to be handled separately so that the conversion happens as expected (complex -> real keeps only real; real -> complex only populates real).
  • If an array is accessible from the "cuda" space:
    • Use bifrost.libbifrost._bf.bfMap() to run the conversion on the GPU. The conversion function is set based on the input and output data types.

jaycedowell avatar Apr 26 '22 15:04 jaycedowell

Codecov Report

Attention: Patch coverage is 95.83333% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 66.94%. Comparing base (898e4a8) to head (0bb8c61). Report is 2 commits behind head on master.

:exclamation: Current head 0bb8c61 differs from pull request most recent head 0477754. Consider uploading reports for the commit 0477754 to get more accurate results

Files Patch % Lines
python/bifrost/ndarray.py 95.83% 1 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #177      +/-   ##
==========================================
- Coverage   68.19%   66.94%   -1.26%     
==========================================
  Files          65       69       +4     
  Lines        5515     7433    +1918     
==========================================
+ Hits         3761     4976    +1215     
- Misses       1754     2457     +703     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov-commenter avatar Apr 26 '22 16:04 codecov-commenter