In my imagenet task, I use lmdb file as dataset, here is my dataset:
class ImageNetDataset(torch.utils.data.Dataset):
def __init__(self, config, phase='train', transforms=None):
    data_root = config.DATASET.ROOT
    self.phase = phase
    self.lmdb_file = os.path.join(data_root, self.phase+'.lmdb')
    label_file = os.path.join(data_root, self.phase+'_label.txt')
    self.transforms = transforms
    self.lines = []
    with open(label_file) as f:
        self.lines = f.readlines()
    self.txn = None
    self.workers = 32
    if not self.txn:
        env = lmdb.open(
            self.lmdb_file,
            max_readers=self.workers,
            readonly=True,
            lock=False,
            readahead=False,
            meminit=False
        )
        self.txn = env.begin(write=False)

def __len__(self):
    return len(self.lines)

def __getitem__(self, idx):
    line = self.lines[idx]
    image_name = line.split()[0]
    image = Image.open(io.BytesIO(self.txn.get(image_name.encode())))
    if image.getbands() != 3:
        image = image.convert('RGB')
    gt = int(line.split()[-1])
    image = self.transforms(image)
    return image, torch.tensor(gt, dtype=torch.long)

I found that using num_workers=16 is faster than num_workers=32, and the cpu utilization is  higher. I am not sure if my dataset is wrong, or some reason else case this problem?
This situation get worse when I use distributed training set(one subprocess per gpu(total gpu:4), num_workers=16), I have many cpu, but at this situation, the utilization of cpus is slow, is that the subprocess(the get_item of dataset) of subprocess(main_worker) can not take advantage of all cpu?