Skip to content

Handle CPU devices without DataParallel - #8

Draft
fulopjoz wants to merge 2 commits into
devfrom
fix/cpu-sentinel-dataparallel
Draft

Handle CPU devices without DataParallel#8
fulopjoz wants to merge 2 commits into
devfrom
fix/cpu-sentinel-dataparallel

Conversation

@fulopjoz

@fulopjoz fulopjoz commented Feb 25, 2026

Copy link
Copy Markdown
Owner

What changed

  • normalize string and torch.device inputs in model device selection
  • preserve the CPU sentinel in SequenceRNN without constructing cuda:-1
  • centralize device-aware DataParallel wrapping
  • update all nine generator and explorer wrapping sites to skip DataParallel on CPU
  • add four focused tests for CPU strings, CPU device objects, the sentinel, and mocked CUDA wrapping

Root cause

CPU execution stores (-1,) as a sentinel GPU tuple. Several training paths passed that tuple to DataParallel, which is invalid and can crash even when CPU execution was explicitly requested.

Compatibility

CUDA paths still construct DataParallel with the requested device IDs. CPU paths use the module directly. Public model constructors now accept both cpu strings and torch.device objects.

Validation

  • python -m drugex.training.generators.tests: 4 passed
  • python -m drugex.training.tests: passed
  • source compilation and diff checks: passed
  • physical multi-GPU execution: not available in this environment

@fulopjoz

Copy link
Copy Markdown
Owner Author

Recreating as upstream PR against CDDLeiden/DrugEx

@fulopjoz fulopjoz closed this Feb 25, 2026
@fulopjoz fulopjoz reopened this Jul 29, 2026
fulopjoz added 2 commits July 29, 2026 16:34
Normalize string and torch.device inputs, preserve the CPU sentinel, and add portable regression coverage for CPU and mocked CUDA wrapping.
Route all nine generator and explorer wrapping sites through the shared device-aware helper so CPU execution never passes the -1 sentinel to DataParallel.
@fulopjoz
fulopjoz marked this pull request as draft July 29, 2026 14:34
@fulopjoz
fulopjoz force-pushed the fix/cpu-sentinel-dataparallel branch from 04d4ffd to b52b41a Compare July 29, 2026 14:34
@fulopjoz fulopjoz changed the title Fix SequenceRNN crash when running on CPU Handle CPU devices without DataParallel Jul 29, 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.

1 participant