Skip to content

Commit 0fadac2

Browse files
asuleckinv-kkudrynski
authored andcommitted
[ConvNets/PyT] Add option to set GPU affinity
1 parent 96b1a14 commit 0fadac2

File tree

5 files changed

+483
-12
lines changed

5 files changed

+483
-12
lines changed

PyTorch/Classification/ConvNets/configs.yml

+11-1
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,26 @@ precision:
1010
platform:
1111
DGX1V-16G:
1212
workers: 8
13+
prefetch: 4
14+
gpu_affinity: socket_unique_contiguous
1315
DGX1V-32G:
1416
workers: 8
17+
prefetch: 4
18+
gpu_affinity: socket_unique_contiguous
1519
T4:
1620
workers: 8
1721
DGX1V:
1822
workers: 8
23+
prefetch: 4
24+
gpu_affinity: socket_unique_contiguous
1925
DGX2V:
2026
workers: 8
27+
prefetch: 4
28+
gpu_affinity: socket_unique_contiguous
2129
DGXA100:
22-
workers: 16
30+
workers: 10
31+
prefetch: 4
32+
gpu_affinity: socket_unique_contiguous
2333

2434
mode:
2535
benchmark_training: &benchmark_training

PyTorch/Classification/ConvNets/image_classification/dataloaders.py

+7
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ def gdtl(
235235
workers=5,
236236
_worker_init_fn=None,
237237
memory_format=torch.contiguous_format,
238+
**kwargs,
238239
):
239240
if torch.distributed.is_initialized():
240241
rank = torch.distributed.get_rank()
@@ -284,6 +285,7 @@ def gdvl(
284285
workers=5,
285286
_worker_init_fn=None,
286287
memory_format=torch.contiguous_format,
288+
**kwargs,
287289
):
288290
if torch.distributed.is_initialized():
289291
rank = torch.distributed.get_rank()
@@ -413,6 +415,7 @@ def get_pytorch_train_loader(
413415
start_epoch=0,
414416
workers=5,
415417
_worker_init_fn=None,
418+
prefetch_factor=2,
416419
memory_format=torch.contiguous_format,
417420
):
418421
interpolation = {"bicubic": Image.BICUBIC, "bilinear": Image.BILINEAR}[
@@ -445,6 +448,7 @@ def get_pytorch_train_loader(
445448
collate_fn=partial(fast_collate, memory_format),
446449
drop_last=True,
447450
persistent_workers=True,
451+
prefetch_factor=prefetch_factor,
448452
)
449453

450454
return (
@@ -464,6 +468,7 @@ def get_pytorch_val_loader(
464468
_worker_init_fn=None,
465469
crop_padding=32,
466470
memory_format=torch.contiguous_format,
471+
prefetch_factor=2,
467472
):
468473
interpolation = {"bicubic": Image.BICUBIC, "bilinear": Image.BILINEAR}[
469474
interpolation
@@ -499,6 +504,7 @@ def get_pytorch_val_loader(
499504
collate_fn=partial(fast_collate, memory_format),
500505
drop_last=False,
501506
persistent_workers=True,
507+
prefetch_factor=prefetch_factor,
502508
)
503509

504510
return PrefetchedWrapper(val_loader, 0, num_classes, one_hot), len(val_loader)
@@ -548,6 +554,7 @@ def get_syntetic_loader(
548554
workers=None,
549555
_worker_init_fn=None,
550556
memory_format=torch.contiguous_format,
557+
**kwargs,
551558
):
552559
return (
553560
SynteticDataLoader(

0 commit comments

Comments
 (0)