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

Function assertQuregLocalMemDoesntExceedMaxSizeof

quest/src/core/validation.cpp:1583–1601  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1581}
1582
1583void assertQuregLocalMemDoesntExceedMaxSizeof(int numQubits, int isDensMatr, int isDistrib, QuESTEnv env, const char* caller) {
1584
1585 // assume distributed (unless it is force disabled), because that reduces the memory required
1586 // per node and is ergo more permissive - and the auto-deployer would never choose non-distribution
1587 // in a distributed env if the memory would exceed the max sizeof!
1588 int numQuregNodes = (isDistrib == 0 || ! env.isDistributed)? 1 : env.numNodes;
1589 int maxNumQubits = (int) mem_getMaxNumQuregQubitsBeforeGlobalMemSizeofOverflow(isDensMatr, numQuregNodes);
1590
1591 tokenSubs vars = {
1592 {"${NUM_QUBITS}", numQubits},
1593 {"${NUM_NODES}", numQuregNodes},
1594 {"${MAX_QUBITS}", maxNumQubits}};
1595
1596 string msg = (isDensMatr)?
1597 report::NEW_DENSMATR_QUREG_LOCAL_MEM_WOULD_EXCEED_SIZEOF :
1598 report::NEW_STATEVEC_QUREG_LOCAL_MEM_WOULD_EXCEED_SIZEOF;
1599
1600 assertThat(numQubits <= maxNumQubits, msg, vars, caller);
1601}
1602
1603void assertQuregNotDistributedOverTooManyNodes(int numQubits, int isDensMatr, int isDistrib, QuESTEnv env, const char* caller) {
1604

Callers 1

validate_newQuregParamsFunction · 0.85

Tested by

no test coverage detected