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 1 commit
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
Prev Previous commit
Next Next commit
🎨 pre-commit fixes
  • Loading branch information
pre-commit-ci[bot] committed May 16, 2023
commit ce8ba49ab95298a16d5c04541f856a195da8c89b
18 changes: 9 additions & 9 deletions include/Executor.hpp
burgholzer marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
#pragma once

#include "Task.hpp"
#include <memory>

#include <memory>
burgholzer marked this conversation as resolved.
Show resolved Hide resolved

class Executor {
public:
virtual ~Executor() = default;
virtual json executeTask() = 0;
virtual ~Executor() = default;
virtual json executeTask() = 0;

const std::shared_ptr<Task>& getTask() const;

const std::shared_ptr<Task> &getTask() const;
explicit Executor(){};

explicit Executor(){
};
void setTask(const std::shared_ptr<Task>& task);
virtual std::string getIdentifier() = 0;

void setTask(const std::shared_ptr<Task> &task);
virtual std::string getIdentifier() = 0;
private:
std::shared_ptr<Task> task;
std::shared_ptr<Task> task;
};
20 changes: 10 additions & 10 deletions include/Results.hpp
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
#pragma once

#include <nlohmann/json.hpp>
#include "Task.hpp"
#include "Executor.hpp"
#include "Task.hpp"

#include <nlohmann/json.hpp>

using json = nlohmann::json;

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

virtual json toJson() const = 0;
virtual std::string toString() const { return toJson().dump(2); }
virtual ~Results() = default;

Results(Task task, Executor executor) {
identifier = task.getIdentifier() + "_" + executor.getIdentifier();
}
virtual json toJson() const = 0;
virtual std::string toString() const { return toJson().dump(2); }

Results(Task task, Executor executor) {
identifier = task.getIdentifier() + "_" + executor.getIdentifier();
}

private:
std::string identifier;
std::string identifier;
};
9 changes: 4 additions & 5 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
@@ -1,13 +1,12 @@
#pragma once

#include "Task.hpp"
#include "QuantumComputation.hpp"
#include "Task.hpp"

class SimulationTask : public Task {
public:
explicit SimulationTask(qc::QuantumComputation qc) {
this->qc = qc.clone();
};
explicit SimulationTask(qc::QuantumComputation qc) { this->qc = qc.clone(); };

private:
qc::QuantumComputation qc;
qc::QuantumComputation qc;
};
4 changes: 2 additions & 2 deletions include/Task.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ using json = nlohmann::json;

class Task {
public:
virtual ~Task() = default;
virtual std::string getIdentifier() = 0;
virtual ~Task() = default;
virtual std::string getIdentifier() = 0;
};
15 changes: 8 additions & 7 deletions include/VerificationTask.hpp
burgholzer marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
#pragma once

#include "Task.hpp"
#include "QuantumComputation.hpp"
#include "Task.hpp"

class VerificationTask : public Task {
public:
VerificationTask(qc::QuantumComputation qc1, qc::QuantumComputation qc2) {
this->qc1 = qc1.clone();
this->qc2 = qc2.clone();
};
VerificationTask(qc::QuantumComputation qc1, qc::QuantumComputation qc2) {
this->qc1 = qc1.clone();
this->qc2 = qc2.clone();
};

private:
qc::QuantumComputation qc1;
qc::QuantumComputation qc2;
qc::QuantumComputation qc1;
qc::QuantumComputation qc2;
};
44 changes: 25 additions & 19 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,32 @@ add_subdirectory("${PROJECT_SOURCE_DIR}/extern/qcec" "extern/qcec"
EXCLUDE_FROM_ALL)

if(NOT TARGET ${PROJECT_NAME})
add_library(
${PROJECT_NAME}
${PROJECT_SOURCE_DIR}/include/Executor.hpp
${PROJECT_SOURCE_DIR}/include/Results.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
Executor.cpp CircuitSimulatorExecutor.cpp ../include/CircuitSimulatorExecutor.hpp VerificationExecutor.cpp ../include/VerificationExecutor.hpp AlternatingVerificationExecutor.cpp ../include/AlternatingVerificationExecutor.hpp)
add_library(
${PROJECT_NAME}
${PROJECT_SOURCE_DIR}/include/Executor.hpp
${PROJECT_SOURCE_DIR}/include/Results.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
Executor.cpp
CircuitSimulatorExecutor.cpp
../include/CircuitSimulatorExecutor.hpp
VerificationExecutor.cpp
../include/VerificationExecutor.hpp
AlternatingVerificationExecutor.cpp
../include/AlternatingVerificationExecutor.hpp)

# set include directories
target_include_directories(
${PROJECT_NAME} PUBLIC ${PROJECT_SOURCE_DIR}/include
${PROJECT_BINARY_DIR}/include)
# set include directories
target_include_directories(
${PROJECT_NAME} PUBLIC ${PROJECT_SOURCE_DIR}/include
${PROJECT_BINARY_DIR}/include)

# link to the MQT libraries
target_link_libraries(${PROJECT_NAME} PUBLIC MQT::ddsim MQT::qcec)
# link to the MQT libraries
target_link_libraries(${PROJECT_NAME} PUBLIC MQT::ddsim MQT::qcec)

# add MQT alias
add_library(MQT::${PROJECT_NAME} ALIAS ${PROJECT_NAME})
# add MQT alias
add_library(MQT::${PROJECT_NAME} ALIAS ${PROJECT_NAME})
endif()
46 changes: 22 additions & 24 deletions src/Executor.cpp
Original file line number Diff line number Diff line change
@@ -1,32 +1,30 @@
#include "Executor.hpp"

#include <chrono>

class Executor::Executor {
json executeTask() {
json result;
auto start = std::chrono::high_resolution_clock::now();

this->executeTask();
// Add memory usage later

auto stop = std::chrono::high_resolution_clock::now();
auto runtime = std::chrono::duration_cast<std::chrono::microseconds>(stop-start);
result["runtime"] = runtime.count();
std::string const identifier = this->getTask()->getIdentifier() + "_" + this->getIdentifier();
result["identifier"] = identifier;
return result;
// what about the Results class?
}
json executeTask() {
json result;
auto start = std::chrono::high_resolution_clock::now();

this->executeTask();
// Add memory usage later

auto stop = std::chrono::high_resolution_clock::now();
auto runtime =
std::chrono::duration_cast<std::chrono::microseconds>(stop - start);
result["runtime"] = runtime.count();
std::string const identifier =
this->getTask()->getIdentifier() + "_" + this->getIdentifier();
result["identifier"] = identifier;
return result;
// what about the Results class?
}
};

//add adapter for simulators
const std::shared_ptr<Task> &Executor::getTask() const {
return task;
}
// add adapter for simulators
const std::shared_ptr<Task>& Executor::getTask() const { return task; }

void Executor::setTask(const std::shared_ptr<Task> &newTask) {
this->task = newTask;
void Executor::setTask(const std::shared_ptr<Task>& newTask) {
this->task = newTask;
}



2 changes: 1 addition & 1 deletion src/SimulationTask.cpp
burgholzer marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#include "SimulationTask.hpp"
//take one circuit
// take one circuit
2 changes: 1 addition & 1 deletion src/VerificationTask.cpp
burgholzer marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#include "VerificationTask.hpp"
//take two circuits
// take two circuits