Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reuse memory? #365

Open
erow opened this issue Feb 12, 2024 · 0 comments
Open

Reuse memory? #365

erow opened this issue Feb 12, 2024 · 0 comments

Comments

@erow
Copy link

erow commented Feb 12, 2024

I found that self.loader.graph.allocate_memory takes a lot of memory. It seems work for reusing the memory.

 >>> ffcv/loader/epoch_iterator.py 

if not hasattr(self.loader,'memory_allocations'):
    print("Memory Allocation 19219.1 MiB for bs=128 and batches_ahead=10")
    self.memory_allocations = self.loader.graph.allocate_memory(
        self.loader.batch_size,
        self.loader.batches_ahead + 2
    )
    self.loader.memory_allocations = self.memory_allocations
else:
    print("Reuse memory")
    self.memory_allocations = self.loader.memory_allocations
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant