Skip to content

MultiProcDataset + Postprocessing = CPU overcommit? #1780

Description

@NeoLegends

@Icemole Reports a case where he uses a PostprocessingDataset inside a MultiProcDataset. He finds that each MultiProcWorker uses more than one thread for its computation, resulting in a CPU overcommit (because the number of assigned CPUs matches the number of data processes), adversely affecting performance.

I wonder: is this a setup/config issue or a systematic issue of our current data loading pipeline? I cannot really believe that this hasn't happened anywhere before. E.g. speed perturbation seems like one use case where this would happen normally (due to using convolutions)? We use librosa for that, does it not use more than one core? In his setup there is torchaudio.add_noise.

ReturnnTrainingJob sets OMP_NUM_THREADS=self.rqmt["cpu"], so I see where the overcommit can come from when the child processes inherit that variable and think they have this many threads available. So, should we perhaps set OMP_NUM_THREADS=1 for the dataset worker processes (unless specified otherwise)? I don't think it's wise to set OMP_NUM_THREADS=1 for the main proc. I can have this wired up quickly, if you think this is sensible @albertz.

htop screenshot:
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions