Package: hybridq
HybridQ: A Hybrid Simulator for Quantum CircuitsHybridQis a highly extensible platform designed to provide a common framework
to integrate multiple state-of-the-art techniques to simulate large scale
quantum circuits on a variety of hardware.HybridQprovides tools to manipulate,
develop, and extend noiseless and noisy circuits for different hardware
architectures.HybridQalso supports large-scale high-performance computing (HPC)
simulations, automatically balancing workload among different processor nodes
and enabling the use of multiple backends to maximize parallel efficiency.
Everything is then glued together by a simple and expressive language that
allows seamless switching from one technique to another as well as from one
hardware to the next, without the need to write lengthy translations, thus
greatly simplifying the development of new hybrid algorithms and techniques.Getting StartedTutorials on how to useHybridQcan be found inhybridq/tutorials.ContributorsSalvatore MandràJeffrey Marshall(noise models)How To Cite[1] S. Mandrà, J. Marshall, E. Rieffel, and R. Biswas,"HybridQ: A Hybrid
Simulator for Quantum Circuits",
IEEE/ACM Second International Workshop on Quantum Computing Software (QCS) (2021)Publications UsingHybridQ[1] X. Mi, P. Roushan, C. Quintana, S. Mandrà, J. Marshall,et al.,"Information scrambling in quantum circuits",
Science 374, 6574 (2021)DocumentationFor technical documentation on how to useHybridQ, seehybridq/docs.InstallationHybridQcan be installed by either usingpip:pip install hybridqdirectly from theGitHubrepository (to locally compileHybridQC++
libraries):pip install git+https://github.com/nasa/hybridqusing azipfile:pip install hybridq.zipor by usingconda:conda env create -f envinronment.ymlHybridQis also available asdockercontainer (compiled for a genericx86-64architecture):docker pull smandra/hybridqInstallation TroubleshootsHybridQdepends onKaHyPar, which
requires theBoost C++ Libraryinstalled in the
system. To properly install KaHyPar, the following steps usually work:Clone KaHyPar:git clone git@github.com:SebastianSchlag/kahypar.git /tmp/kahypar \
    --depth=1 \
    --recursive \
    --branch 1.2.1Force installation of minimal Boost library:BSD:sed -i '' -e "$(echo -e '/option(KAHYPAR_USE_MINIMAL_BOOST/,/)/c\' \
                "\noption(KAHYPAR_USE_MINIMAL_BOOST \"\" ON)")" \
          /tmp/kahypar/CMakeLists.txtGNU:sed -i '/option(KAHYPAR_USE_MINIMAL_BOOST/,/)/c\option(KAHYPAR_USE_MINIMAL_BOOST \"\" ON)'  \
          /tmp/kahypar/CMakeLists.txtInstall KaHyPar:export CXXFLAGS='-fPIC' && pip install -U /tmp/kahypar/ --force-reinstallAlternatively, it is possible to use Conda to properly install KaHyPar:Clone/unzipHybridQrepository and enter local copy of repositoryCreate new Conda environment:conda env create -f environment.ymlActivate environment:conda activate hybridqInstall dependencies:conda install make cmake libboostExport Boost library:export BOOST_ROOT=$CONDA_PREFIXReinstall KaHyPar:pip install -U git+https://github.com/kahypar/kahypar@1.2.1 --force-reinstallDepending on the system, the user may still need to install an updated version
ofgcc/g++to complete the installation of KaHyPar. On MacOSX, it is suggested to useclang++as compiler for KaHyPar because of potential linking problems. To force
the use ofclang++to compile KaHyPar, runexport CXX=clang++before point 6.OpenMPHybridQusesOpenMPto parallelize the C++ evolution core. However,clangon MacOSX does not directly supportOpenMP. The easiest way to
overcome this limitation is to install a version ofg++which support the
standard C++17. Otherwise,HybridQwill be installed withoutOpenMPsupport.MPI Auto-detectionHybridQis able to auto-detect the use ofMPIby checking ifHybridQhas been launched by either usingmpiexecormpirun. However, auto-detection
may be interfere with other libraries/software. To this end,HybridQwill ignore
the auto-detection ofMPIifDISABLE_MPI_AUTODETECTis set to any values, that
isexport DISABLE_MPI_AUTODETECT=1.RuntimeError: Cannot set NUMBA_NUM_THREADS to a different value once the threads have been launchedAfter its first launch,quimbpre-compiles some parts of its library usingnumba. Such error arises whenNUMBA_NUM_THREADSis changed after thequimblibrary is pre-cached. The error may be removed by clearingquimbcache as:Locatequimbinstallation folder:python -m pip show quimbClear cache:rm -fr /path/to/quimb/__pycache__If the problem persists, try to cleanquimbcache and setNUMBA_NUM_THREADSto the desired number (typically, the number of physical cores).Run HybridQ in a Docker ContainerHybridQsupports the installation in Docker containers. To create a Docker
container, it is sufficient to run:docker-compose buildwhich will installHybridQin thehybridqcontainer (source files will be
stored in/opt/hybridq/). The baseline for the Docker container isquay.io/pypa/manylinux2014_x86_64.  By
default,hybridqcontainer is built by using the generalnativearchitecture.  To use a different architecture, run for instance:docker-compose build --build-arg ARCH=x86-64withARCHbeing any availablegccarchitecture. The container is built usingpython3.7. If a different version ofpythonis needed, it is possible to
specify its version in building time:docker-compose build --build-arg PYTHON=cp38-cp38Available versions are:cp37-cp37mcp38-cp38cp39-cp39Once the container is built,HybridQcan be directly used as follows:docker run --rm hybridq -c 'hybridq /opt/hybridq/examples/circuit.qasm /dev/null --verbose'and tests can be run as follows:docker run --rm hybridq -c 'pytest -vx /opt/hybridq/tests/tests.py'LicenceCopyright © 2021, United States Government, as represented by the Administrator
of the National Aeronautics and Space Administration. All rights reserved.The HybridQ: A Hybrid Simulator for Quantum Circuits platform is licensed under
the Apache License, Version 2.0 (the "License"); you may not use this file
except in compliance with the License. You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0.Unless required by applicable law or agreed to in writing, software distributed
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.