Windows
April 13, 2020 ยท View on GitHub
Below are instructions for compiling QuESTlink from source on Windows, using only the command line. These instructions will install the Microsoft Visual Studio Compiler (MSVC), the Chocolatey package manager, and a Windows-compatible GNUMake.
1 - Build Tools for VS
Download Build Tools for Visual Studio from this page, and install it.
This will provide both the Developer Powershell for VS and the Developer Command Prompt for VS.
Open Developer Command Prompt and check that commands
cl
and
link -help
are correctly recognised.
2 - Choco
Open Developer Powershell as an administrator and enter
Set-ExecutionPolicy AllSigned
then
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
If you are unable to paste this command via ctrl-v, click the icon top-left of the powershell window and select paste
This downloads Chocolatey, a Windows package manager.
3 - GNUMake
Still in Developer Powershell, enter
choco install make
This creates the make command in the Developer Command Prompt.
4 - Compile
We're now ready to compile. Open Developer Command Prompt and make sure
make --version
is a recognised command; you may have to close and re-open the command prompt first.
Next, open the makefile in any editor, and set:
OS = WINDOWSCOMPILER = clCOMPILER_TYPE = MSVCWINDOWS_ARCH = 64if using 64-bit Windows, else32(for x86)
If using 64-bit Windows, you must use a 64-bit Developer Command Prompt for the following instructions. E.g.
VS2019 x64 Native Tools Command Prompt. You can find this prompt in the same directory as the developer command prompt.
To compile for GPU mode, install the CUDA toolkit (to get the nvcc command), and additionally set
GPUACCELERATED = 1GPU_COMPUTE_CAPABILITY =to the value corresponding to your GPU (look up here) with no decimal-point (e.g.7.1becomes71).
Then, in the Developer Command Prompt, navigate to the root QuESTlink directory (where makefile is located) and run
make
If successful, the quest_link.exe executable will be created, along with several leftover .o files which can be safely removed with
make tidy
To recompile after changing a setting in the makefile, run
make clean
make
Note that trying to run
quest_link.exedirectly at this stage will report a DLL error.
5 - Run
5.1 - Locally
You can now open Mathematica and run
SetDirectory["path/to/QuESTlink/"]
Import["Link/QuESTlink.m"]
CreateLocalQuESTEnv["quest_link.exe"]
and use all facilities of QuEST.
5.2 - Remotely
The created quest_link.exe can be used as a server, accessed by Mathematica on another machine. To do this, after compiling, you must copy one of the following DLLs (depending on whether WINDOWS_ARCH is 32 or 64 bit) to the same location as quest_link.exe.
copy WSTP\Windows\wstp32i4.dll .
copy WSTP\Windows\wstp64i4.dll .
Running quest_link.exe directly now will create a network prompt, which can be ignored/closed.
To launch the server from the Developer Command Prompt, run
quest_link.exe -linkcreate -linkprotocol TCPIP -linkname <PORT1>@<IP>,<PORT2>@<IP>
substituting
Then in your Mathematica kernel on another machine, connect to it via
CreateRemoteQuESTEnv[<IP>, <PORT1>, <PORT2>];