update dataloader
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
# Created Date: Sunday February 6th 2022
|
||||
# Author: Chen Xuanhong
|
||||
# Email: chenxuanhongzju@outlook.com
|
||||
# Last Modified: Tuesday, 15th February 2022 1:35:41 am
|
||||
# Last Modified: Tuesday, 15th February 2022 1:50:19 am
|
||||
# Modified By: Chen Xuanhong
|
||||
# Copyright (c) 2022 Shanghai Jiao Tong University
|
||||
#############################################################
|
||||
@@ -56,7 +56,7 @@ class InfiniteSampler(torch.utils.data.Sampler):
|
||||
|
||||
class data_prefetcher():
|
||||
def __init__(self, loader, cur_gpu):
|
||||
torch.cuda.set_device(cur_gpu)
|
||||
torch.cuda.set_device(cur_gpu) # must add this line to avoid excessive use of GPU 0 by the prefetcher
|
||||
self.loader = loader
|
||||
self.dataiter = iter(loader)
|
||||
self.stream = torch.cuda.Stream(device=cur_gpu)
|
||||
|
||||
Reference in New Issue
Block a user