This folder provides a wrapper to make DM-SIM (both GPU and CPU implementations) an Accelerator
for XACC
There are two ways to get this plugins installed: (1) automatic QCOR installation if having QCOR or (2) manual build and install.
Prerequisite: qcor
compiler (installation instructions here)
DM-SIM Plugin can then be installed by
qcor -install-plugin https://github.com/pnnl/DM-Sim.git
Prerequisite: XACC (see here for instructions)
These steps assume that you've installed XACC at the default location. If not, please provide -DXACC_DIR=<YOUR_XACC_INSTALL_DIR>
when configuring with CMake.
From the top-level DM-SIM directory:
cd xacc && mkdir build && cd build
cmake ..
make install
It will build the DM-SIM Accelerator
plugin and install the .so
files to the proper plugins
folder.
After installation, an Accelerator
with the name dm-sim
will be available for XACC and/or QCOR.
Specifically, there are two possible variances, dm-sim:gpu
and dm-sim:cpu
, based on the (OpenMP) GPU and CPU DM-SIM simulators. The GPU will only be available if CUDA is present.
In XACC, the DM-SIM accelerator can be requested by:
auto accelerator = xacc::getAccelerator("dm-sim");
or,
auto accelerator = xacc::getAccelerator("dm-sim:cpu");
or,
auto accelerator = xacc::getAccelerator("dm-sim:gpu");
whereby the first call (without gpu
or cpu
suffix) will automatically select the GPU implementation if present. Otherwise, it will fall back to the CPU implementation.
In QCOR, the DM-SIM simulator can be requested via the -qpu
compiler switch, e.g.,
qcor -qpu dm-sim <your_source_file>
where the source file can be a .cpp
file with embedded quantum kernels (QCOR language extension) or a OpenQASM2/3 source file.