Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix icpc pybind11. #173

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 1 addition & 4 deletions src/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,11 @@ CXXFLAGS += -Idocopt/ -fPIC
# The flags for the compilation of the Pybind11 interface
PYBINDFLAGS = -shared `python3 -m pybind11 --includes`

# commented out because pip install pybind11
#-Ipybind11/include

$(TARGET1): main.cpp $(OBJS1)
$(CXX) -o $(@).x $< $(OBJS1) $(CXXFLAGS)

pybind: $(OBJS1) pybind_main.h
$(CXX) pybind_main.cpp -o $(QFLEXLIB) $^ $(CXXFLAGS) $(PYBINDFLAGS)
g++ -std=c++17 -O3 -fPIC pybind_main.cpp -o $(QFLEXLIB) $^ $(PYBINDFLAGS)

%.o: %.cpp %.h
$(CXX) -c $< $(CXXFLAGS) -o $@
Expand Down
17 changes: 1 addition & 16 deletions src/evaluate_circuit.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,25 +33,10 @@
#include "read_circuit.h"
#include "circuit.h"
#include "tensor.h"
#include "input.h"

namespace qflex {

struct QflexGrid {
int I{0}, J{0};
std::vector<std::vector<int>> qubits_off;
void load(std::istream& istream);
void load(const std::string& filename);
};

struct QflexInput {
std::istream* ordering_data;
QflexCircuit circuit;
QflexGrid grid;
std::string initial_state;
std::string final_state;
bool enable_timing_logs = false;
};

/**
* Reads in grid layout from a file, which should be formatted as an I x J grid
* of zeroes (for "off" qubits) and ones (for "on" qubits).\
Expand Down
26 changes: 26 additions & 0 deletions src/input.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#ifndef INPUT__H
#define INPUT__H

#include "circuit.h"

namespace qflex {

struct QflexGrid {
int I{0}, J{0};
std::vector<std::vector<int>> qubits_off;
void load(std::istream& istream);
void load(const std::string& filename);
};

struct QflexInput {
std::istream* ordering_data;
QflexCircuit circuit;
QflexGrid grid;
std::string initial_state;
std::string final_state;
bool enable_timing_logs = false;
};

}

#endif
7 changes: 5 additions & 2 deletions src/pybind_main.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@ namespace py = pybind11;

#include <vector>

#include "evaluate_circuit.h"
#include "read_circuit.h"
#include "input.h"

namespace qflex {
extern std::vector<std::pair<std::string, std::complex<double>>> EvaluateCircuit(QflexInput* input);
}

std::vector<std::pair<std::string, std::complex<double>>> simulate(
const py::dict &options);
Expand Down