Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ORNL Quantum Computing Institute
qcor
Commits
029affec
Commit
029affec
authored
Jul 15, 2019
by
Mccaskey, Alex
Browse files
fixing bug in lambda visitor test, moved algorithm and optimizer to xacc
Signed-off-by:
Alex McCaskey
<
mccaskeyaj@ornl.gov
>
parent
c17b8200
Pipeline
#78610
canceled with stage
Changes
7
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
compiler/clang/QCORASTConsumer.cpp
View file @
029affec
...
...
@@ -16,21 +16,10 @@ QCORASTConsumer::QCORASTConsumer(CompilerInstance &c, Rewriter &rw)
rewriter
(
rw
)
{}
bool
QCORASTConsumer
::
HandleTopLevelDecl
(
DeclGroupRef
DR
)
{
using
namespace
std
::
chrono
;
auto
start
=
std
::
chrono
::
high_resolution_clock
::
now
();
LambdaVisitor
visitor
(
ci
,
rewriter
);
for
(
DeclGroupRef
::
iterator
b
=
DR
.
begin
(),
e
=
DR
.
end
();
b
!=
e
;
++
b
)
{
// if (std::string((*b)->getDeclKindName()) == "Function") {
// std::cout << (*b)->getDeclKindName() << "\n";
// (*b)->dumpColor();
visitor
.
TraverseDecl
(
*
b
);
// }
}
auto
stop
=
std
::
chrono
::
high_resolution_clock
::
now
();
auto
duration
=
std
::
chrono
::
duration_cast
<
microseconds
>
(
stop
-
start
);
// std::cout << "Visitor time: " << duration.count() << ", " << std::endl;
return
true
;
}
}
// namespace compiler
...
...
compiler/clang/qcor-driver.in.cpp
View file @
029affec
...
...
@@ -69,6 +69,7 @@ protected:
for
(
auto
&
p
:
pragmaHandlers
)
{
CI
.
getSema
().
getPreprocessor
().
RemovePragmaHandler
(
p
.
get
());
}
CI
.
getDiagnosticClient
().
EndSourceFile
();
std
::
string
outName
(
fileName
);
...
...
compiler/clang/tests/LambdaVisitorTester.in.cpp
View file @
029affec
...
...
@@ -49,6 +49,7 @@ protected:
CompilerInstance
&
CI
=
getCompilerInstance
();
CI
.
createSema
(
getTranslationUnitKind
(),
nullptr
);
compiler
::
FuzzyParsingExternalSemaSource
fuzzyParser
;
fuzzyParser
.
initialize
();
fuzzyParser
.
setASTContext
(
&
CI
.
getASTContext
());
CI
.
getSema
().
addExternalSource
(
&
fuzzyParser
);
...
...
runtime/CMakeLists.txt
View file @
029affec
...
...
@@ -31,9 +31,9 @@ else()
set_target_properties
(
${
LIBRARY_NAME
}
PROPERTIES LINK_FLAGS
"-shared"
)
endif
()
file
(
GLOB HEADERS
*
.hpp
)
file
(
GLOB HEADERS
qcor.hpp qpu_handler
.hpp
)
install
(
FILES
${
HEADERS
}
DESTINATION include/qcor
)
install
(
TARGETS
${
LIBRARY_NAME
}
DESTINATION lib
)
add_subdirectory
(
algorithms
)
add_subdirectory
(
nlopt-optimizers
)
\ No newline at end of file
#add_subdirectory(algorithms)
#add_subdirectory(nlopt-optimizers)
\ No newline at end of file
runtime/qcor.cpp
View file @
029affec
...
...
@@ -200,7 +200,7 @@ submit(HandlerLambda &&totalJob, std::shared_ptr<AcceleratorBuffer> buffer) {
std
::
shared_ptr
<
Optimizer
>
getOptimizer
(
const
std
::
string
&
name
)
{
return
xacc
::
getService
<
qcor
::
Optimizer
>
(
name
);
return
xacc
::
getService
<
xacc
::
Optimizer
>
(
name
);
}
std
::
shared_ptr
<
Optimizer
>
getOptimizer
(
const
std
::
string
&
name
,
...
...
@@ -241,8 +241,8 @@ getObservable(const std::string &type,
observable
->
fromOptions
(
options
);
return
observable
;
}
std
::
shared_ptr
<
algorithm
::
Algorithm
>
getAlgorithm
(
const
std
::
string
name
)
{
return
xacc
::
getService
<
qcor
::
algorithm
::
Algorithm
>
(
name
);
std
::
shared_ptr
<
xacc
::
Algorithm
>
getAlgorithm
(
const
std
::
string
name
)
{
return
xacc
::
getService
<
xacc
::
Algorithm
>
(
name
);
}
}
// namespace qcor
runtime/qcor.hpp
View file @
029affec
...
...
@@ -3,8 +3,8 @@
#include
<future>
#include
"
o
ptimizer.hpp"
#include
"
a
lgorithm.hpp"
#include
"
O
ptimizer.hpp"
#include
"
A
lgorithm.hpp"
#include
"Observable.hpp"
...
...
@@ -54,7 +54,7 @@ std::shared_ptr<Observable> getObservable();
std
::
shared_ptr
<
Observable
>
getObservable
(
const
std
::
string
&
representation
);
std
::
shared_ptr
<
Observable
>
getObservable
(
const
std
::
string
&
type
,
std
::
map
<
std
::
string
,
InstructionParameter
>
&&
options
);
std
::
shared_ptr
<
algorithm
::
Algorithm
>
getAlgorithm
(
const
std
::
string
name
);
std
::
shared_ptr
<
Algorithm
>
getAlgorithm
(
const
std
::
string
name
);
}
// namespace qcor
#include
"qpu_handler.hpp"
...
...
runtime/qpu_handler.hpp
View file @
029affec
...
...
@@ -32,8 +32,10 @@ public:
}
auto
vqeAlgo
=
qcor
::
getAlgorithm
(
"vqe"
);
vqeAlgo
->
initialize
(
function
,
accelerator
,
buffer
);
vqeAlgo
->
execute
(
*
observable
.
get
(),
*
optimizer
.
get
());
if
(
!
vqeAlgo
->
initialize
({{
"ansatz"
,
function
},
{
"accelerator"
,
accelerator
},
{
"observable"
,
observable
},{
"optimizer"
,
optimizer
}}))
{
xacc
::
error
(
"Error initializing VQE algorithm."
);
}
vqeAlgo
->
execute
(
buffer
);
}
template
<
typename
QuantumKernel
>
void
execute
(
QuantumKernel
&&
kernel
)
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment