Skip to content

Add device parameter to ToCupy operator and to_cupy utility #738

Open
Deshan-5 wants to merge 2 commits intoPyLops:devfrom
Deshan-5:fix/tocupy-device
Open

Add device parameter to ToCupy operator and to_cupy utility #738
Deshan-5 wants to merge 2 commits intoPyLops:devfrom
Deshan-5:fix/tocupy-device

Conversation

@Deshan-5
Copy link

@Deshan-5 Deshan-5 commented Mar 4, 2026

Fixes #640.

ToCupy currently hardcodes transfers to device 0, which breaks workflows on multi gpu machines where you need to target a specific device.

This adds a (device: int = 0) parameter to both ToCupy and the underlying to_cupy() utility.
Defaults to 0 so nothing breaks for existing users.

The implementation uses cp.cuda.Device context management, same pattern as to_cupy_conditional() which already handles this correctly.

Added test_ToCupy_device to cover the new parameter.

@Deshan-5 Deshan-5 changed the title Add device parameter to ToCupy operator and to_cupy utility (#640) Add device parameter to ToCupy operator and to_cupy utility Mar 5, 2026
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.

[Enhancement] Add device to ToCupy

1 participant