I have a dataloader that samples data-sets then it has a custom collate function that creates data loaders for each of the sampled data-sets. I then sample data from each of the selected data-sets within the collate function. I (used to) have pin_memory=True when I created the data-loaders for the data-sets (within the collate function given to the higher level data-loader). The only one using multi-processing is the higher level level data-loader.
Is this what you mean by "trying to initialize the CUDA context multiple times?
Should I be sampling data-loaders instead of initializing them on the fly in the collate function?
I’ve read multiple sources online but nothing seems to help unfortunately.