table of content
问题
使用Pytorch的DataLoader时,速度极慢,GPU完全吃不满,CPU占用率也不高。设置num_workers以及尝试拆分文件之后加载(原数据~50G)均无效。
实测的可用解决方案
-
os.environ["KMP_AFFINITY"] = "disabled"或export KMP_AFFINITY=disabled -
conda install 'llvm-openmp<16'
ref
https://github.com/pytorch/pytorch/issues/99625 https://github.com/pytorch/pytorch/issues/101850 https://github.com/pytorch/pytorch/issues/102494