MCPcopy Create free account
hub / github.com/QuEST-Kit/QuEST / assertMatrixIsSynced

Function assertMatrixIsSynced

quest/src/core/validation.cpp:2402–2412  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2400// type T can be CompMatr, DiagMatr or FullStateDiagMatr
2401template <class T>
2402void assertMatrixIsSynced(T matr, string errMsg, const char* caller) {
2403
2404 // we don't need to perform any sync check in CPU-only mode
2405 if (!mem_isAllocated(util_getGpuMemPtr(matr)))
2406 return;
2407
2408 // check if GPU amps have EVER been overwritten; we sadly cannot check the LATEST changes were pushed though.
2409 // note we check this whenever the matrix has GPU memory, even if it is being applied upon a Qureg which is
2410 // NOT GPU-accelerated and ergo the GPU memory is not consulted. It's best to build the habit in the user!
2411 assertThat(*(matr.wasGpuSynced) == 1, errMsg, caller);
2412}
2413void validate_matrixIsSynced(CompMatr matr, const char* caller) { assertMatrixIsSynced(matr, report::COMP_MATR_NOT_SYNCED_TO_GPU, caller);}
2414void validate_matrixIsSynced(DiagMatr matr, const char* caller) { assertMatrixIsSynced(matr, report::DIAG_MATR_NOT_SYNCED_TO_GPU, caller); }
2415void validate_matrixIsSynced(FullStateDiagMatr matr, const char* caller) { assertMatrixIsSynced(matr, report::FULL_STATE_DIAG_MATR_NOT_SYNCED_TO_GPU, caller); }

Callers 1

validate_matrixIsSyncedFunction · 0.85

Calls 3

mem_isAllocatedFunction · 0.85
util_getGpuMemPtrFunction · 0.85
assertThatFunction · 0.85

Tested by

no test coverage detected