Skip to content

fix: define device once from use_cuda, eliminating hardcoded cuda:1#9

Merged
bushidocodes merged 1 commit into
masterfrom
claude/silly-lamport-21cf03
May 29, 2026
Merged

fix: define device once from use_cuda, eliminating hardcoded cuda:1#9
bushidocodes merged 1 commit into
masterfrom
claude/silly-lamport-21cf03

Conversation

@bushidocodes

Copy link
Copy Markdown
Owner

Summary

  • Adds device = torch.device("cuda" if use_cuda and torch.cuda.is_available() else "cpu") in cell 1 alongside use_cuda = True
  • Replaces the duplicated torch.device("cuda:1" ...) expressions in GCN.forward (cell 11) and Trainer.__init__ (cell 17) with the shared device variable
  • Updates README GPU configuration section to describe the corrected single-variable pattern and its actual cell location

Test plan

  • On a single-GPU machine (cuda:0 only): notebook should select cuda:0 instead of erroring on cuda:1
  • On a CPU-only machine: set use_cuda = False in cell 1; notebook should run on CPU
  • On a multi-GPU machine: no behavior change — cuda still maps to cuda:0 by default

Closes #4

🤖 Generated with Claude Code

Replaced two duplicate torch.device("cuda:1" ...) expressions in
GCN.forward and Trainer.__init__ with a single `device` variable
defined alongside `use_cuda` in cell 1. This lets the notebook run
correctly on single-GPU machines (cuda:0) and CPU-only environments
instead of raising a CUDA device error. Updated README GPU section to
match the actual cell location and corrected device selection logic.

Fixes #4

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@bushidocodes bushidocodes merged commit c7f5c49 into master May 29, 2026
@bushidocodes bushidocodes deleted the claude/silly-lamport-21cf03 branch May 29, 2026 22:34
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.

Notebook hardcodes cuda:1, contradicting README's CPU/single-GPU fallback

1 participant