Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Intel GPU to GAT example #1320

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions gat/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ options:
epochs to wait for print training and validation evaluation (default: 20)
--no-cuda disables CUDA training
--no-mps disables macOS GPU training
--no-xpu disables XPU training
--dry-run quickly check a single pass
--seed S random seed (default: 13)
```
Expand Down
13 changes: 9 additions & 4 deletions gat/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,15 +303,17 @@ def test(model, criterion, input, target, mask):
help='dimension of the hidden representation (default: 64)')
parser.add_argument('--num-heads', type=int, default=8,
help='number of the attention heads (default: 4)')
parser.add_argument('--concat-heads', action='store_true', default=False,
parser.add_argument('--concat-heads', action='store_true',
help='wether to concatinate attention heads, or average over them (default: False)')
parser.add_argument('--val-every', type=int, default=20,
help='epochs to wait for print training and validation evaluation (default: 20)')
parser.add_argument('--no-cuda', action='store_true', default=False,
parser.add_argument('--no-cuda', action='store_true',
help='disables CUDA training')
parser.add_argument('--no-mps', action='store_true', default=False,
parser.add_argument('--no-xpu', action='store_true',
help='disables XPU training')
parser.add_argument('--no-mps', action='store_true',
help='disables macOS GPU training')
parser.add_argument('--dry-run', action='store_true', default=False,
parser.add_argument('--dry-run', action='store_true',
help='quickly check a single pass')
parser.add_argument('--seed', type=int, default=13, metavar='S',
help='random seed (default: 13)')
Expand All @@ -320,12 +322,15 @@ def test(model, criterion, input, target, mask):
torch.manual_seed(args.seed)
use_cuda = not args.no_cuda and torch.cuda.is_available()
use_mps = not args.no_mps and torch.backends.mps.is_available()
use_xpu = not args.no_xpu and torch.xpu.is_available()

# Set the device to run on
if use_cuda:
device = torch.device('cuda')
elif use_mps:
device = torch.device('mps')
elif use_xpu:
device = torch.device('xpu')
else:
device = torch.device('cpu')
print(f'Using {device} device')
Expand Down