![]() |
The Quantum Exact Simulation Toolkit v4.3.0
|
Version 4 of QuEST includes reworked CMake to support library builds, CMake export, and installation. Here we detail useful variables to configure the compilation of QuEST. If using a Unix-like operating system, any of these variables can be set using the -D flag when invoking CMake, for example:
Then, as detailed in compile.md, one need only move to the build directory and compile by invoking make:
--config Release during compilation to enable optimisations.| Variable | (Default) Values | Notes |
|---|---|---|
QUEST_OUTPUT_LIB_NAME | (QuEST), String | The QuEST library will be named lib${QUEST_OUTPUT_LIB_NAME}.so. Can be used to differentiate multiple versions of QuEST which have been compiled. |
QUEST_APPEND_CONFIG_TO_LIB_NAME | (OFF), ON | When turned on QUEST_OUTPUT_LIB_NAME will be modified according to the other configuration options chosen. For example compiling QuEST with multithreading, distribution, and double precision with QUEST_APPEND_CONFIG_TO_LIB_NAME turned on creates libQuEST-fp2+mt+mpi.so. |
QUEST_FLOAT_PRECISION | (2), 1, 4 | Determines which floating-point precision QuEST will use: double, single, or quad. Note: Quad precision is not supported when also compiling for GPU. |
QUEST_BUILD_EXAMPLES | (OFF), ON | Determines whether the example programs will be built alongside QuEST. Note that min_example is always built. |
QUEST_INSTALL_BINARIES | (OFF), ON | Determines whether compiled binaries such as the examples will be installed as well as the QuEST library. |
QUEST_ENABLE_OMP | (ON), OFF | Determines whether QuEST will be built with support for parallelisation with OpenMP. |
QUEST_ENABLE_NUMA | (ON), OFF | Determines whether QuEST will attempt to build with NUMA awareness when OpenMP is also enabled. |
QUEST_ENABLE_MPI | (OFF), ON | Determines whether QuEST will be built with support for parallelisation with MPI. |
QUEST_ENABLE_SUBCOMM | (OFF), ON | Determines whether QuEST will be built with support for custom MPI communicators. Note: This has the unfortunate side-effect of requiring the MPI header in the public header for QuEST, meaning MPI will become a dependency of any application or library which includes the QuEST header whether it uses MPI or not. |
QUEST_ENABLE_CUDA | (OFF), ON | Determines whether QuEST will be built with support for NVIDIA GPU acceleration. If turned on, CMAKE_CUDA_ARCHITECTURES should probably also be set. |
QUEST_ENABLE_CUQUANTUM | (OFF), ON | Determines whether QuEST will make use of the NVIDIA CuQuantum library. Cannot be turned on if QUEST_ENABLE_CUDA is off. |
QUEST_ENABLE_HIP | (OFF), ON | Determines whether QuEST will be built with support for AMD GPU acceleration. If turned on, CMAKE_HIP_ARCHITECTURES should probably also be set. |
QUEST_ENABLE_BMI2 | (OFF), ON | Determines whether QuEST will be built with BMI2 intrinsics to accelerate CPU simulation of few-qubit Quregs. This is not compatible with all compilers and CPUs. Beware that if enabled, and the compiled QuEST executable is later run upon a different machine which lacks the BMI2 instructions, execution will crash. |
QUEST_ENABLE_ADIOS2 | (OFF), ON | Determines whether QuEST will be built with ADIOS2 to enable checkpointing, via functions saveQuregToFile() and createQuregFromFile(). |
QUEST_DOWNLOAD_ADIOS2 | (ON), OFF | Determines whether to download ADIOS2 from Github, when ADIOS2 is enabled but not found. |
QUEST_ENABLE_DEPRECATED_API | (OFF), ON | Determines whether QuEST will be built with support for the deprecated (v3) API. ***Note**: this will generate compiler warnings and is not supported by MSVC.* |
QUEST_DISABLE_DEPRECATION_WARNINGS | (OFF), ON | Whether to disable the compile-time deprecation warnings when using the deprecated (v3) API. |
USER_SOURCE_NAMES | (Undefined), String | The source file for a user program which will be compiled alongside QuEST. USER_OUTPUT_EXE_NAME must also be defined. |
USER_OUTPUT_EXE_NAME | (Undefined), String | The name of the executable which will be created from the provided USER_SOURCE_NAMES. USER_SOURCE_NAMES must also be defined. |
QUEST_DEFAULT_NUM_GPU_THREADS_PER_BLOCK | (128), Number | The default number of threads per block QuEST will use when offloading to a GPU. Must be a multiple of 32 (on NVIDIA GPUs) or 64 (on AMD GPUs). This CMake variable sets the default if not later overridden. The number can be overridden at process launch time using an environment variable of the same name, or during runtime using setQuESTNumGpuThreadsPerBlock(). |
| Variable | (Default) Values | Notes |
|---|---|---|
QUEST_BUILD_TESTS | (OFF), ON | Determines whether to additionally build QuEST's unit and integration tests. If built, tests can be run from the build directory with make test, or ctest, or manually launched with ./tests/tests which enables distribution (i.e. mpirun -np 8 ./tests/tests) |
QUEST_ENABLE_DEPRECATED_API | (OFF), ON | As described above. When enabled alongside testing, the v3 deprecated unit tests will additionally be compiled and can be run from within build via cd tests/deprecated; ctest, or manually launched with ./tests/deprecated/dep_tests (enabling distribution, as above). |
QUEST_TESTS_DOWNLOAD_CATCH2 | (ON), OFF | QuEST's tests require Catch2. By default, if you don't have Catch2 installed (or CMake doesn't find it) it will be downloaded from Github and built for you. If you don't want that to happen, for example because you do have Catch2 installed, set this to OFF. |
As of
v4.2, macros which configure the unit tests such asQUEST_TEST_MAX_NUM_QUBIT_PERMUTATIONShave become environment variables specified before launch. Seelaunch.md
| Variable | Description | CMake Doc Page |
|---|---|---|
CMAKE_BUILD_TYPE | Whether QuEST will be built with or without optimisations and debugging info. QuEST defaults to a Release build which is with optimisation and without debugging info. | CMAKE_BUILD_TYPE |
CMAKE_CXX_COMPILER | The C++ compiler that will be used to compile QuEST. | CMAKE_<LANG>_COMPILER |
CMAKE_C_COMPILER | The C compiler that will be used to compile QuEST. | CMAKE_<LANG>_COMPILER |
CMAKE_INSTALL_PREFIX | The directory to which QuEST will be installed when make install is invoked. A standard GNU directory structure (lib, bin, include) will be used inside the prefix directory. | CMAKE_INSTALL_PREFIX GNUInstallDirs |
CMAKE_CUDA_ARCHITECTURES | Used to set the value of arch when compiling for NVIDIA GPU. This is also known as the target GPU's "compute capability" and can be discovered here. | CMAKE_CUDA_ARCHITECTURES |
CMAKE_HIP_ARCHITECTURES | Used to set the HIP platform which QuEST is compiled for when compiling for AMD GPU. | CMAKE_HIP_ARCHITECTURES |
CMAKE_RUNTIME_OUTPUT_DIRECTORY | The output directory to which to save compiled executables, overriding the default build folder | CMAKE_RUNTIME_OUTPUT_DIRECTORY. |