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

Function cpu_statevec_initUniformState_sub

quest/src/cpu/cpu_subroutines.cpp:2442–2458  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2440
2441
2442void cpu_statevec_initUniformState_sub(Qureg qureg, qcomp amp) {
2443
2444 // approx-uniformly distribute modified memory pages across threads,
2445 // in the hope that each std::fill() will touch only memory within
2446 // the thread's corresponding NUMA node, for best performance
2447
2448 int numAmpsPerPage = cpu_getPageSize() / sizeof(qcomp); // divides evenly
2449
2450 #pragma omp parallel if(qureg.isMultithreaded)
2451 {
2452 const auto [start, end] = util_getBlockMultipleSubRange(
2453 qureg.numAmpsPerNode, numAmpsPerPage,
2454 cpu_getOpenmpThreadInd(), cpu_getCurrentNumThreads());
2455
2456 std::fill(qureg.cpuAmps + start, qureg.cpuAmps + end, amp);
2457 }
2458}
2459
2460
2461void cpu_statevec_initDebugState_sub(Qureg qureg) {

Callers 1

Calls 4

cpu_getPageSizeFunction · 0.85
cpu_getOpenmpThreadIndFunction · 0.85
cpu_getCurrentNumThreadsFunction · 0.85

Tested by

no test coverage detected