| 2000 | } |
| 2001 | |
| 2002 | void assertNewMatrixParamsAreValid(int numQubits, int useDistrib, int useGpu, int useMultithread, bool isDenseType, const char* caller) { |
| 2003 | |
| 2004 | // some of the below validation involves getting distributed node consensus, which |
| 2005 | // can be an expensive synchronisation, which we avoid if validation is anyway disabled |
| 2006 | if (!global_isValidationEnabled) |
| 2007 | return; |
| 2008 | |
| 2009 | QuESTEnv env = getQuESTEnv(); |
| 2010 | assertMatrixDeployFlagsRecognised(useDistrib, useGpu, useMultithread, caller); |
| 2011 | assertMatrixDeploysEnabledByEnv(useDistrib, useGpu, useMultithread, env, caller); |
| 2012 | assertMatrixNonEmpty(numQubits, caller); |
| 2013 | assertMatrixTotalNumElemsDontExceedMaxIndex(numQubits, isDenseType, caller); |
| 2014 | assertMatrixLocalMemDoesntExceedMaxSizeof(numQubits, isDenseType, useDistrib, env.numNodes, caller); |
| 2015 | assertMatrixNotDistributedOverTooManyNodes(numQubits, isDenseType, useDistrib, env.numNodes, caller); |
| 2016 | assertMatrixFitsInCpuMem(numQubits, isDenseType, useDistrib, env.numNodes, caller); |
| 2017 | assertMatrixFitsInGpuMem(numQubits, isDenseType, useDistrib, useGpu, env.numNodes, caller); |
| 2018 | } |
| 2019 | |
| 2020 | void validate_newCompMatrParams(int numQubits, const char* caller) { |
| 2021 | validate_envIsInit(caller); |
no test coverage detected