The Quantum Exact Simulation Toolkit v4.3.0
Loading...
Searching...
No Matches

Functions to control temporary memory used by the QuEST process. More...

Functions

void clearQuESTGpuCache ()
 
qindex getQuESTGpuCacheSize ()
 

Detailed Description

Functions to control temporary memory used by the QuEST process.

Function Documentation

◆ clearQuESTGpuCache()

void clearQuESTGpuCache ( )

Clears QuEST's GPU cache.

Some QuEST functions involve allocating non-trivial device data, which persists between invocations for effiency. For example, applyCompMatr() when given a matrix of more than five qubits, will allocate data proportional in size to the matrix dimension and the simulated Qureg size. This allocation happens on-the-fly.

This function clears this cache, freeing memory at the cost of increased runtime when calling functions like applyCompMatr(), due to the overhead of reallocation therein. This function has no effect on the persistent device memory owned by QuEST objects like Qureg and CompMatr, nor does it have any effect when QuEST is not using GPU acceleration.

See also
Author
Tyson Jones

Definition at line 191 of file debug.cpp.

191 {
192 validate_envIsInit(__func__);
193
194 // safely do nothing if not GPU accelerated
195 if (getQuESTEnv().isGpuAccelerated)
196 gpu_clearCache();
197}
QuESTEnv getQuESTEnv()

◆ getQuESTGpuCacheSize()

qindex getQuESTGpuCacheSize ( )

Returns the current size (in bytes) of the persistent GPU cache used to accelerate QuEST.

Some QuEST functions involve allocating non-trivial device data, which persists between invocations for effiency. For example, applyCompMatr() when given a matrix of more than five qubits, will allocate data proportional in size to the matrix dimension and the simulated Qureg size. This allocation happens on-the-fly.

This function returns the size of that cache. It does not include device memory consumed by persistent QuEST objects, such as Qureg and CompMatr. When QuEST is not running in GPU-accelerated mode, this function always returns 0.

Returns
The current GPU cache size in bytes.
See also
Author
Tyson Jones

Definition at line 180 of file debug.cpp.

180 {
181 validate_envIsInit(__func__);
182
183 if (getQuESTEnv().isGpuAccelerated)
184 return gpu_getCacheMemoryInBytes();
185
186 // safely returns 0 if not GPU accelerated
187 return 0;
188}