Skip to content

GridPatch with pin_memory=True significant slow-down in following epochs #6082

@bhashemian

Description

@bhashemian

Reported by a user (@kenza-bouzid) here:

When using num_workers>1 and pin_memory=True, training time increases exponentially over epochs
image
image
I had profiled/timed all intermediate steps, and found out that GridPatch was the guilty one
image
So I timed all intermediate step in the tranform

image

image

image

It turned out that the operation that was taking too long was a memory allocation by np.array

patched_image = np.array(patches[0])

I eventually fixed it by setting pin_memory=False,
which I explain by cuda memory allocation being more expensive as it has to be allocated from the pinned memory

Note that I am dealing with particularly large slides ~50kx50k

Any thoughts on this?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions