Commit 258d050d authored by WrathfulSpatula's avatar WrathfulSpatula
Browse files

Qrack plugin: remove redundant casts, fix white space, move CL_HPP defines to QrackVisitor.hpp


Signed-off-by: default avatarWrathfulSpatula <stranoj@gmail.com>
parent c118f666
......@@ -35,3 +35,4 @@ else()
endif()
add_subdirectory(optimal_control)
......@@ -15,8 +15,6 @@ target_include_directories(${LIBRARY_NAME}
./accelerator/src/include
${CMAKE_SOURCE_DIR}/tpls/eigen)
set(_bundle_name xacc_qrack)
find_package(OpenCL)
if (OpenCL_FOUND)
target_link_libraries(${LIBRARY_NAME}
......@@ -25,26 +23,22 @@ if (OpenCL_FOUND)
qrack
OpenCL
)
set_target_properties(${LIBRARY_NAME}
PROPERTIES COMPILE_DEFINITIONS
US_BUNDLE_NAME=${_bundle_name}
US_BUNDLE_NAME
${_bundle_name}
CL_HPP_TARGET_OPENCL_VERSION=200
CL_HPP_MINIMUM_OPENCL_VERSION=100)
else()
target_link_libraries(${LIBRARY_NAME}
PUBLIC xacc
xacc-quantum-gate
qrack
)
set_target_properties(${LIBRARY_NAME}
PROPERTIES COMPILE_DEFINITIONS
US_BUNDLE_NAME=${_bundle_name}
US_BUNDLE_NAME
${_bundle_name})
endif()
set(_bundle_name xacc_qrack)
set_target_properties(${LIBRARY_NAME}
PROPERTIES COMPILE_DEFINITIONS
US_BUNDLE_NAME=${_bundle_name}
US_BUNDLE_NAME
${_bundle_name})
usfunctionembedresources(TARGET
${LIBRARY_NAME}
WORKING_DIRECTORY
......
......@@ -117,19 +117,19 @@ namespace quantum {
void QrackVisitor::visit(Rz& rz)
{
const auto angleTheta = InstructionParameterToDouble(rz.getParameter(0));
m_qReg->RZ((Qrack::real1)angleTheta, rz.bits()[0]);
m_qReg->RZ(angleTheta, rz.bits()[0]);
}
void QrackVisitor::visit(Ry& ry)
{
const auto angleTheta = InstructionParameterToDouble(ry.getParameter(0));
m_qReg->RY((Qrack::real1)angleTheta, ry.bits()[0]);
m_qReg->RY(angleTheta, ry.bits()[0]);
}
void QrackVisitor::visit(Rx& rx)
{
const auto angleTheta = InstructionParameterToDouble(rx.getParameter(0));
m_qReg->RX((Qrack::real1)angleTheta, rx.bits()[0]);
m_qReg->RX(angleTheta, rx.bits()[0]);
}
void QrackVisitor::visit(X& x)
......@@ -208,7 +208,7 @@ namespace quantum {
const auto theta = InstructionParameterToDouble(u.getParameter(0));
const auto phi = InstructionParameterToDouble(u.getParameter(1));
const auto lambda = InstructionParameterToDouble(u.getParameter(2));
m_qReg->U(u.bits()[0], (Qrack::real1)theta, (Qrack::real1)phi, (Qrack::real1)lambda);
m_qReg->U(u.bits()[0], theta, phi, lambda);
}
void QrackVisitor::visit(iSwap& in_iSwapGate)
......
......@@ -17,6 +17,10 @@
#include "AllGateVisitor.hpp"
#include "AcceleratorBuffer.hpp"
#include "OptionsProvider.hpp"
#define CL_HPP_TARGET_OPENCL_VERSION 200
#define CL_HPP_MINIMUM_OPENCL_VERSION 100
#include "qrack/qfactory.hpp"
using namespace xacc;
......
......@@ -14,8 +14,3 @@
add_xacc_test(QrackAccelerator)
target_link_libraries(QrackAcceleratorTester xacc-qrack)
find_package(OpenCL)
if (OpenCL_FOUND)
target_compile_definitions (QrackAcceleratorTester PUBLIC CL_HPP_TARGET_OPENCL_VERSION=200)
target_compile_definitions (QrackAcceleratorTester PUBLIC CL_HPP_MINIMUM_OPENCL_VERSION=100)
endif()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment