The Quantum Exact Simulation Toolkit v4.1.0
Loading...
Searching...
No Matches
Synchronisation

Functions for overwriting a channel's GPU (VRAM) memory with its CPU (RAM) contents. More...

Functions

void syncKrausMap (KrausMap map)
 
void syncSuperOp (SuperOp op)
 

Detailed Description

Functions for overwriting a channel's GPU (VRAM) memory with its CPU (RAM) contents.

These functions are only necessary when the user wishes to manually modify the elements of a channel (in lieu of using the Setters), to thereafter synchronise the changes to the GPU copy of the channel. These functions have no effect when running without GPU-acceleration, but remain legal and harmless to call (to achieve platform agnosticism).

Function Documentation

◆ syncKrausMap()

void syncKrausMap ( KrausMap map)
Note
Documentation for this function or struct is under construction!
See also

Definition at line 236 of file channels.cpp.

236 {
237 validate_krausMapFields(map, __func__);
238
239 // re-compute and GPU-sync the superoperator from the modified matrices
240 util_setSuperoperator(map.superop.cpuElems, map.matrices, map.numMatrices, map.numQubits);
241 syncSuperOp(map.superop);
242
243 // indicate that we do not know whether the revised map is
244 // is CPTP; we defer establishing that until a CPTP check
245 util_setFlagToUnknown(map.isApproxCPTP);
246}
void syncSuperOp(SuperOp op)
Definition channels.cpp:223

Referenced by TEST_CASE().

◆ syncSuperOp()

void syncSuperOp ( SuperOp op)
Note
Documentation for this function or struct is under construction!
See also

Definition at line 223 of file channels.cpp.

223 {
224 validate_superOpFields(op, __func__);
225
226 // optionally overwrite GPU elements with user-modified CPU elements
227 if (mem_isAllocated(util_getGpuMemPtr(op)))
228 gpu_copyCpuToGpu(op);
229
230 // indicate that the matrix is now permanently GPU synchronised, even
231 // if we are not in GPU-accelerated mode - it hardly matters
232 *(op.wasGpuSynced) = 1;
233}

Referenced by syncKrausMap(), and TEST_CASE().