![]() |
The Quantum Exact Simulation Toolkit v4.3.0
|
Data structures for managing the QuEST execution environment. More...
Classes | |
| struct | QuESTEnv |
Functions | |
| void | finalizeQuESTEnv () |
| QuESTEnv | getQuESTEnv () |
| void | initCustomQuESTEnv (int useDistrib, int useGpuAccel, int useMultithread) |
| void | initQuESTEnv () |
| int | isQuESTEnvInit () |
| void | reportQuESTEnv () |
| void | syncQuESTEnv () |
Data structures for managing the QuEST execution environment.
| void finalizeQuESTEnv | ( | ) |
Finalises the active QuEST execution environment.
This synchronises outstanding GPU/MPI work, clears QuEST's GPU cache, finalises cuQuantum if active, and finalises MPI if QuEST initialised it. It does not destroy any existing QuEST structs, such as Qureg or CompMatr, which should be prior destroyed to avoid a leak.
| error |
|
Definition at line 457 of file environment.cpp.
| QuESTEnv getQuESTEnv | ( | ) |
Returns a copy of the active QuEST execution environment.
The returned QuESTEnv describes the active deployment and MPI rank information. This can be useful for making programmatical decisions based on the environment.
| error |
|
Definition at line 449 of file environment.cpp.
Referenced by clearQuESTGpuCache(), createCompMatr(), createDiagMatr(), createForcedDensityQureg(), createForcedQureg(), deleteFilesWithPrefixSynch(), getQuESTGpuCacheSize(), setQuESTNumGpuThreadsPerBlock(), TEST_CASE(), TEST_CASE(), TEST_CASE(), TEST_CASE(), TEST_CASE(), TEST_CASE(), TEST_CASE(), TEST_CASE(), TEST_CASE(), TEST_CASE(), TEST_CASE(), TEST_CASE(), TEST_CASE(), TEST_CASE(), TEST_CASE(), TEST_CASE(), TEST_CASE(), TEST_CASE(), TEST_CASE(), TEST_CASE(), TEST_CASE(), TEST_CASE(), TEST_CASE(), TEST_CASE(), and writeToFileSynch().
| void initCustomQuESTEnv | ( | int | useDistrib, |
| int | useGpuAccel, | ||
| int | useMultithread ) |
Initialises the QuEST execution environment with the specified deployments.
Each deployment flag may be 1 to force the deployment, 0 to disable it, or -1 to let QuEST choose automatically. The environment must be initialised exactly once, and cannot be re-initialised after finalizeQuESTEnv().
| [in] | useDistrib | whether to force (=1), disable (=0), or automate (=-1) distribution. |
| [in] | useGpuAccel | whether to force (=1), disable (=0), or automate (=-1) GPU acceleration. |
| [in] | useMultithread | whether to force (=1), disable (=0), or automate (=-1) multithreading. |
| error |
|
Definition at line 429 of file environment.cpp.
| void initQuESTEnv | ( | ) |
Initialises the QuEST execution environment.
This must be called before any other QuEST function, and performs tasks like validating the environment, reading environment variables, initialising external libraries like MPI or cuQuantum (when available), and seeding random number generators.
This function prepares usage of all of QuEST's parallelisation facilities, such as multithreading, GPU-acceleration and distribution, provided they are compiled and appropriate hardware is available. The used facilities can be controlled with initCustomQuESTEnv().
When distributed execution is initialised with this function, QuEST takes control of MPI, including its initialisation and finalization. User-owned MPI is possible through initCustomMpiQuESTEnv().
Note that when cuQuantum was compiled, and a GPU is available at runtime, the cuQuantum backend is always used over the custom GPU backend (which, infact, was not compiled!). This means the GPU must be compatible with cuQuantum.
| error |
|
Definition at line 436 of file environment.cpp.
Referenced by TEST_CASE().
| int isQuESTEnvInit | ( | ) |
Indicates whether the QuEST execution environment is currently initialised.
Unlike other QuEST functions, this can be called at any time, including before QuEST initialisation, and after finalisation.
1 if the environment is initialised, otherwise 0. Definition at line 443 of file environment.cpp.
Referenced by setRandomTestStateSeeds().
| void reportQuESTEnv | ( | ) |
Prints a summary of the active QuEST execution environment.
The report includes precision, compilation, deployment, CPU, GPU, distribution, Qureg size-limit and automatic-deployment information.
An example output:
| error |
|
Definition at line 495 of file environment.cpp.
| void syncQuESTEnv | ( | ) |
Synchronises QuEST across all processes and machines, waiting for outstanding work to complete.
| error |
|
Definition at line 484 of file environment.cpp.
Referenced by areEqual(), areEqual(), areEqual(), deleteFilesWithPrefixSynch(), toQMatrix(), toQureg(), toQureg(), toQVector(), and writeToFileSynch().