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

Function assertMatrixNotDistributedOverTooManyNodes

quest/src/core/validation.cpp:1863–1889  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1861}
1862
1863void assertMatrixNotDistributedOverTooManyNodes(int numQubits, bool isDense, int isDistrib, int numEnvNodes, const char* caller) {
1864
1865 // 'isDistrib' can be 0 (user-disabled, or matrix is a local type), 1 (user-forced)
1866 // or modeflag::USE_AUTO=-1 (automatic; the type can be distributed but the user has
1867 // not forced it). Currently, only distributed diagonal matrices are supported, so
1868 // isDistrib must be specifically 0 for dense matrices.
1869 if (isDense && isDistrib != 0)
1870 error_validationEncounteredUnsupportedDistributedDenseMatrix();
1871
1872 // only need to validate when distribution is forced (auto-deployer will never over-distribute,
1873 // and non-distributed types (like CompMatr) will pass isDistrib=0
1874 if (isDistrib != 1)
1875 return;
1876
1877 // distributed diagonal matrices require at least 1 element per node, and while we
1878 // don't yet support distributed complex matrices, let's for now assume they would
1879 // require having at leat 1 column per node, like density matrix Quregs do.
1880 int minQubits = mem_getMinNumQubitsForDistribution(numEnvNodes);
1881
1882 string msg = report::NEW_DISTRIB_DIAG_MATR_HAS_TOO_FEW_AMPS;
1883 tokenSubs vars = {
1884 {"${NUM_QUBITS}", numQubits},
1885 {"${MIN_QUBITS}", minQubits},
1886 {"${NUM_NODES}", numEnvNodes}};
1887
1888 assertThat(numQubits >= minQubits, msg, vars, caller);
1889}
1890
1891void assertMatrixFitsInCpuMem(int numQubits, bool isDense, int isDistrib, int numEnvNodes, const char* caller) {
1892

Callers 1

Tested by

no test coverage detected