Skip to content
This repository has been archived by the owner on Dec 20, 2023. It is now read-only.

4 benchmark suite setup #9

Merged
merged 47 commits into from
Jun 9, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
bb6a28b
Merge branch 'main' into 4-benchmark-suite-setup
tyi1025 May 9, 2023
a7ba06e
✅ add Task, Executor and Result classes
tyi1025 May 15, 2023
f13c774
🎨 pre-commit fixes
pre-commit-ci[bot] May 15, 2023
5b501ea
First review suggestions taken
tyi1025 May 16, 2023
adf6e81
Merge remote-tracking branch 'origin/4-benchmark-suite-setup' into 4-…
tyi1025 May 16, 2023
ce8ba49
🎨 pre-commit fixes
pre-commit-ci[bot] May 16, 2023
3db7fe5
Refactored executor-task architecture
tyi1025 May 18, 2023
4e13383
Refactored naming
tyi1025 May 18, 2023
26c31d4
Merge remote-tracking branch 'origin/main' into 4-benchmark-suite-setup
tyi1025 May 24, 2023
d602218
Refactor simulation executor
tyi1025 May 24, 2023
d5000f4
Refactored executor and simulatorexecutor
tyi1025 May 31, 2023
0091d35
Added dummy test (other tests WIP)
tyi1025 May 31, 2023
19883eb
Refactored test code to not let the task consume the qc
tyi1025 Jun 1, 2023
62db93e
Fixed a getter function in SimulationExecutor to address a warning
tyi1025 Jun 1, 2023
e54c574
Move non-parameterized simple test case to a separate file
tyi1025 Jun 1, 2023
7911477
Clean up the test suite for SimulatorExecutors
tyi1025 Jun 1, 2023
032226e
Remove redundant comments
tyi1025 Jun 2, 2023
60c8c09
Replace absolute path with relative path
tyi1025 Jun 2, 2023
30350b2
Refactor the results json
tyi1025 Jun 2, 2023
d03e661
Added verification executor classes and a simple test
tyi1025 Jun 2, 2023
2f7032d
Delete temporarily obsolete Results class
tyi1025 Jun 2, 2023
ed137ab
Add qcec tests (incl. refactoring ddsim tests to avoid name collisions)
tyi1025 Jun 2, 2023
10cfd3b
Refactored exec and task identifier
tyi1025 Jun 2, 2023
9ae7715
Refactor Task and Executor inheritance
tyi1025 Jun 2, 2023
505053c
Clean-up
tyi1025 Jun 2, 2023
8bfad92
Make sure the alternating checker was run in alternating executor
tyi1025 Jun 2, 2023
3927554
Make sure the alternating checker was run in alternating executor
tyi1025 Jun 2, 2023
3712b00
Merge remote-tracking branch 'origin/4-benchmark-suite-setup' into 4-…
tyi1025 Jun 2, 2023
a7fea9a
Fix CI issues (WIP)
tyi1025 Jun 2, 2023
1bb3de7
Refactor architecture: set all necessary members inside of constructor
tyi1025 Jun 2, 2023
11c5ecf
Refactor simulator test to avoid empty circuits
tyi1025 Jun 2, 2023
f80e730
Refactor verification tests to avoid empty circuits
tyi1025 Jun 2, 2023
f3fea11
Remove obsolete code for coverage
tyi1025 Jun 2, 2023
e737f71
Apply suggestions from code review
tyi1025 Jun 6, 2023
0a3f956
🎨 pre-commit fixes
pre-commit-ci[bot] Jun 6, 2023
2688923
Refactoring the source code according to the review suggestions
tyi1025 Jun 8, 2023
a397089
Refactor test files to remove redundant copy
tyi1025 Jun 8, 2023
a4e752f
Track both times in execution
tyi1025 Jun 8, 2023
61c45d0
Fix ci issues
tyi1025 Jun 9, 2023
49f92f1
Fix CI issues (continued)
tyi1025 Jun 9, 2023
fa3c7e5
Refactor tests to be more flexible
tyi1025 Jun 9, 2023
37592a6
🎨 assorted cleanups
burgholzer Jun 9, 2023
f8e3dec
⚗️ try newer cpp-linter config
burgholzer Jun 9, 2023
7a96d3c
🩹 fix CI coverage configuration
burgholzer Jun 9, 2023
1b750ea
🚨 another clang-tidy warning fixed
burgholzer Jun 9, 2023
f68f5fb
♻️ remove expected output from simulation test
burgholzer Jun 9, 2023
bf32253
♻️ some restructuring
burgholzer Jun 9, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions include/Executor.hpp
burgholzer marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//
// Created by Tianyi Wang on 5/14/23.
//
burgholzer marked this conversation as resolved.
Show resolved Hide resolved

#ifndef DD_EVAL_EXECUTOR_HPP
#define DD_EVAL_EXECUTOR_HPP

#endif // DD_EVAL_EXECUTOR_HPP
burgholzer marked this conversation as resolved.
Show resolved Hide resolved

#include "Task.hpp"

class Executor {
private:
Task* task;
burgholzer marked this conversation as resolved.
Show resolved Hide resolved
};
burgholzer marked this conversation as resolved.
Show resolved Hide resolved

void executeTask(Task* task) { task->execute(); }
burgholzer marked this conversation as resolved.
Show resolved Hide resolved
27 changes: 27 additions & 0 deletions include/Result.hpp
burgholzer marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//
// Created by Tianyi Wang on 5/14/23.
//

#ifndef DD_EVAL_RESULT_HPP
#define DD_EVAL_RESULT_HPP

#include "ResultBase.hpp"

#include <nlohmann/json.hpp>
#include <string>

using json = nlohmann::json;

class Result : public ResultBase {
public:
Result(const std::string& name, double value);

json toJson() const override;
std::string toString() const override;

private:
std::string name_;
double value_;
burgholzer marked this conversation as resolved.
Show resolved Hide resolved
};

#endif // DD_EVAL_RESULT_HPP
20 changes: 20 additions & 0 deletions include/ResultBase.hpp
burgholzer marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//
// Created by Tianyi Wang on 5/15/23.
//

#ifndef DD_EVAL_RESULTBASE_HPP
#define DD_EVAL_RESULTBASE_HPP

#include <nlohmann/json.hpp>

using json = nlohmann::json;

class ResultBase {
public:
virtual ~ResultBase() = default;

virtual json toJson() const = 0;
virtual std::string toString() const = 0;
burgholzer marked this conversation as resolved.
Show resolved Hide resolved
};

#endif // DD_EVAL_RESULTBASE_HPP
17 changes: 17 additions & 0 deletions include/SimulationTask.hpp
burgholzer marked this conversation as resolved.
Show resolved Hide resolved
burgholzer marked this conversation as resolved.
Show resolved Hide resolved
burgholzer marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//
// Created by Tianyi Wang on 5/14/23.
//

#ifndef DD_EVAL_SIMULATIONTASK_HPP
#define DD_EVAL_SIMULATIONTASK_HPP

#endif // DD_EVAL_SIMULATIONTASK_HPP

#include "Task.hpp"

class SimulationTask : public Task {
// public:
// SimulationTask(QuantumCircuit qc);
// private:
// QuantumCircuit qc_;
};
15 changes: 15 additions & 0 deletions include/Task.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//
// Created by Tianyi Wang on 5/14/23.
//

#ifndef DD_EVAL_TASK_HPP
#define DD_EVAL_TASK_HPP

#endif // DD_EVAL_TASK_HPP

#include "Result.hpp"

class Task {
public:
virtual Result execute() = 0;
burgholzer marked this conversation as resolved.
Show resolved Hide resolved
burgholzer marked this conversation as resolved.
Show resolved Hide resolved
burgholzer marked this conversation as resolved.
Show resolved Hide resolved
};
18 changes: 18 additions & 0 deletions include/VerificationTask.hpp
burgholzer marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//
// Created by Tianyi Wang on 5/14/23.
//

#ifndef DD_EVAL_VERIFICATIONTASK_HPP
#define DD_EVAL_VERIFICATIONTASK_HPP

#endif // DD_EVAL_VERIFICATIONTASK_HPP

#include "Task.hpp"

class VerificationTask : public Task {
// public:
// VerificationTask(QuantumCircuit qc1, QuantumCircuit qc2);
// private:
// QuantumCircuit qc1_;
// QuantumCircuit qc2_;
Fixed Show fixed Hide fixed
burgholzer marked this conversation as resolved.
Show resolved Hide resolved
};
46 changes: 27 additions & 19 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,34 @@ add_subdirectory("${PROJECT_SOURCE_DIR}/extern/ddsim" "extern/ddsim"
add_subdirectory("${PROJECT_SOURCE_DIR}/extern/qcec" "extern/qcec"
EXCLUDE_FROM_ALL)

# add_library( ${PROJECT_NAME} ${PROJECT_SOURCE_DIR}/include/checker
# ${PROJECT_SOURCE_DIR}/include/Configuration.hpp
# ${PROJECT_SOURCE_DIR}/include/EquivalenceCriterion.hpp
# ${PROJECT_SOURCE_DIR}/include/EquivalenceCheckingManager.hpp
# ${PROJECT_SOURCE_DIR}/include/ThreadSafeQueue.hpp
# EquivalenceCheckingManager.cpp checker/EquivalenceChecker.cpp
# checker/dd/DDEquivalenceChecker.cpp checker/dd/DDConstructionChecker.cpp
# checker/dd/DDSimulationChecker.cpp checker/dd/DDAlternatingChecker.cpp
# checker/dd/applicationscheme/GateCostApplicationScheme.cpp
# checker/dd/simulation/StateGenerator.cpp checker/zx/ZXChecker.cpp)
if(NOT TARGET nlohmann_json)
add_subdirectory("${PROJECT_SOURCE_DIR}/extern/ddsim/extern/qfr/extern/json"
"qfr/json" EXCLUDE_FROM_ALL)
endif()
burgholzer marked this conversation as resolved.
Show resolved Hide resolved

add_library(${PROJECT_NAME} INTERFACE)
if(NOT TARGET ${PROJECT_NAME})
add_library(
${PROJECT_NAME}
${PROJECT_SOURCE_DIR}/include/Executor.hpp
${PROJECT_SOURCE_DIR}/include/Result.hpp
${PROJECT_SOURCE_DIR}/include/ResultBase.hpp
${PROJECT_SOURCE_DIR}/include/SimulationTask.hpp
${PROJECT_SOURCE_DIR}/include/Task.hpp
${PROJECT_SOURCE_DIR}/include/VerificationTask.hpp
Result.cpp
SimulationTask.cpp
VerificationTask.cpp)

# set include directories
target_include_directories(
${PROJECT_NAME} INTERFACE ${PROJECT_SOURCE_DIR}/include
${PROJECT_BINARY_DIR}/include)
# set include directories
target_include_directories(
${PROJECT_NAME} INTERFACE ${PROJECT_SOURCE_DIR}/include
burgholzer marked this conversation as resolved.
Show resolved Hide resolved
${PROJECT_BINARY_DIR}/include)

# link to the MQT libraries
target_link_libraries(${PROJECT_NAME} INTERFACE MQT::ddsim MQT::qcec)
# link to the MQT libraries
target_link_libraries(${PROJECT_NAME} INTERFACE MQT::ddsim MQT::qcec)
burgholzer marked this conversation as resolved.
Show resolved Hide resolved

# add MQT alias
add_library(MQT::${PROJECT_NAME} ALIAS ${PROJECT_NAME})
target_link_libraries(${PROJECT_NAME} PUBLIC nlohmann_json)
burgholzer marked this conversation as resolved.
Show resolved Hide resolved

# add MQT alias
add_library(MQT::${PROJECT_NAME} ALIAS ${PROJECT_NAME})
endif()
17 changes: 17 additions & 0 deletions src/Result.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//
// Created by Tianyi Wang on 5/14/23.
//

#include "../include/Result.hpp"
burgholzer marked this conversation as resolved.
Show resolved Hide resolved

Result::Result(const std::string& name, double value)
: name_(name), value_(value) {}

json Result::toJson() const {
json resultJson;
resultJson["name"] = name_;
resultJson["value"] = value_;
return resultJson;
}

std::string Result::toString() const { return toJson().dump(); }
6 changes: 6 additions & 0 deletions src/SimulationTask.cpp
burgholzer marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
//
// Created by Tianyi Wang on 5/14/23.
//

#include "../include/SimulationTask.hpp"
// take one circuit
6 changes: 6 additions & 0 deletions src/VerificationTask.cpp
burgholzer marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
//
// Created by Tianyi Wang on 5/14/23.
//

#include "../include/VerificationTask.hpp"
// take two circuits