Doc
March 11, 2024 ยท View on GitHub
If you wish to run QuESTlink in multithreaded or GPU-accelerated modes, or as a server, you will need to download and manually compile it. Below are instructions for getting QuESTlink up and running, when it doesn't quite run out-of-the-box.
Tools
Don't have a compiler handy? We recommend the comprehensive guide for the parent QuEST project to obtain the tools needed below.
Download
The best way to download the QuESTlink source code is through git at the command-line.
git clone --recurse-submodules https://github.com/QTechTheory/QuESTlink.git
cd QuESTlink
This will also download the QuEST submodule source-code. You are thereafter in the root directory of QuESTlink and ready to compile.
If you wish to compile a specific Github branch like
develop, simply additionally rungit checkout developYou can also perform this within the
/QuESTsubdirectory to change the branch of the QuEST submodule and access in-development features.
Compile
Compiling is trivial with GNUMake and the provided makefile, and a C++ compiler (which supports C++11).
See here for a comprehensive guide to compiling QuESTlink on Windows, including how to obtain the necessary compilers.
Note Linux users should first run
sudo apt-get install uuid-devbefore compiling. If this fails (and/or compiling sayscannot find -luuid), also try to installuuid,uuid-develandlibuuid-devel. On a SLURM cluster, this can often be resolved withmodule load util-linux.
Within the root directory, edit the makefile and set:
-
OSto your operating system (LINUX,MACOSorWINDOWS) -
COMPILERto your C++11 compiler command.If in doubt, leave this as
g++ -
COMPILER_TYPEto the type of your compiler (GNU,INTEL,CLANGorMSVC).If in doubt, run
g++ --versionin terminal for a clue. Otherwise,COMPILER_TYPEwill likely match yourOS, as:LINUX&GNU,MACOS&CLANG,WINDOWS&MSVC. -
MULTITHREADED = 1to compile in multithreaded modeAfter compiling, and before calling
CreateLocalQuESTEnv[], you should set (in terminal)export OMP_NUM_THREADS=<nthreads>replacing
<nthreads>with the number of CPU cores of your machine, minus a few (sparing them for the Mathematica kernel itself).Note
MULTITHREADEDmode requires an OpenMP-compatible compiler. MacOS users should thus avoidclang, and download/use a GNU compiler (e.g.gcc@8). -
GPUACCELERATED = 1to use an NVIDIA GPU.This requires an
nvcccompiler compatible with your chosenCOMPILER. Thenvcccompiler command can be changed by overwritingCUDA_COMPILERin the makefile. Annvcccompiler can be obtained on Linux withsudo apt install nvidia-cuda-toolkitNote you must also set
GPU_COMPUTE_CAPABILITYin the makefile to the CC corresponding to your GPU. You can look this up here.
With these settings set, QuESTlink is compiled from terminal, in the root directory QuESTlink/, via
make
Compiling will create an executable quest_link, and some other build files. These other unneeded files can be removed with
make tidy
leaving only quest_link.
Should you wish to remove all compiled files and start again, run
make clean
From within Mathematica, the compiled quest_link environment is connected to via
Import[...]
CreateLocalQuESTEnv["path/to/quest_link"];
Launch offline
QuESTlink can be launched without an internet connection, using a copy of this repository. In Mathematica, simply run
Import["path/to/QuESTlink/Link/QuESlink.m"];
CreateLocalQuESTEnv["path/to/quest_link"];
where quest_link has been compiled as above, or previously obtained using
CreateDownloadedQuESTEnv[];
Launch as a server
To launch quest_link as a server, to access remotely from a local kernel, run
./quest_link -linkcreate -linkprotocol TCPIP -linkname <PORT1>@<IP>,<PORT2>@<IP>
substituting <PORT1> and <PORT2> with two open and available ports, and
<IP> with the server IP or domain name.
Then in your local Mathematica kernel, connect to it via
CreateRemoteQuESTEnv[<IP>, <PORT1>, <PORT2>];