Skip to content

Conversation

@dcamenisch
Copy link

Problem

The DaCe GPU framework was experiencing validation failures when comparing GPU results against NumPy reference implementations.

Root Cause

The DaceFramework class was missing a copy_back_func() method to convert CuPy GPU arrays back to NumPy CPU arrays before validation. While copy_func() properly transferred data to GPU, there was no corresponding method to transfer results back to CPU for comparison.

Solution

Added a copy_back_func() method that:

  • Checks if the framework is dace_gpu
  • Uses cupy.asnumpy() to convert GPU arrays to NumPy arrays
  • Falls back to the parent class's default behavior for CPU frameworks

Testing

  • Tested with benchmarks that previously failed validation
  • Confirmed GPU arrays are now properly converted before comparison
  • No impact on CPU framework behavior

Changes

  • Modified: npbench/infrastructure/dace_framework.py
    • Added copy_back_func() method (lines 45-55)

This commit adds a copy_back_func() method to the DaceFramework class
to properly convert CuPy arrays back to NumPy arrays during validation.

Previously, GPU arrays were not being converted, causing validation
failures when comparing against NumPy reference implementations.

The fix ensures that when running with dace_gpu framework, results
are properly copied from GPU to CPU using cupy.asnumpy() before
validation comparison.

Fixes validation errors in GPU benchmarks by ensuring proper data
transfer from device to host memory before numpy comparison.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant