qiboteam / qibojit-benchmarks

Benchmark code for qibojit performance accessment
Apache License 2.0
2 stars 3 forks source link

recreate and delete circuit in every run to make sure the GPU memory is freed #47

Closed migueldiascosta closed 8 months ago

migueldiascosta commented 8 months ago

when running circuit_benchmarks that use more than half of the GPU memory, the dry_run runs fine but then the next run fails with, for instance (for a 32 qubit double precision circuit, 64GB, on a GPU with 96GB of memory)

cupy.cuda.memory.OutOfMemoryError: Out of memory allocating 68,719,476,736 bytes (allocated so far: 68,719,476,736 bytes)

these changes work around the issue for me by always destroying the circuit, which frees the GPU memory, and always recreating it (but I suppose an alternative would be to avoid recreating the circuits by e.g. adding a method to the circuit class that clears the state, or making its constructor overwrite any existing state?)

cc @scarrazza