Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
projects:quantum:distributed [2024/12/05 14:24] – kymki | projects:quantum:distributed [2024/12/06 16:05] (current) – kymki | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | {{ :wiki:distributed_quantum_computing:qcqc.png? | + | < |
+ | < | ||
+ | <meta charset=" | ||
+ | <meta name=" | ||
+ | < | ||
+ | < | ||
+ | /* Container for the entire Ramble Meter */ | ||
+ | .ramble-meter-container | ||
+ | display: flex; | ||
+ | align-items: center; | ||
+ | justify-content: center; | ||
+ | margin: 20px 0; | ||
+ | | ||
- | Massive investments are being made in the European landscape of quantum computing. The question is what frameworks that enable orchestration of calculations | + | /* Ramble Meter */ |
+ | | ||
+ | position: relative; | ||
+ | width: 200px; /* Scaled down */ | ||
+ | height: 40px; /* Scaled down */ | ||
+ | background: linear-gradient(to right, green, yellow, orange, red); | ||
+ | border-radius: | ||
+ | overflow: hidden; | ||
+ | box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3); | ||
+ | } | ||
- | ==== Problem statement ==== | + | /* Needle */ |
+ | .needle { | ||
+ | position: absolute; | ||
+ | top: 5px; /* Adjust for centering */ | ||
+ | left: 50%; /* Default position */ | ||
+ | width: 4px; /* Visible width */ | ||
+ | height: 30px; | ||
+ | background: black; | ||
+ | border-radius: | ||
+ | z-index: 2; | ||
+ | box-shadow: 0 0 10px rgba(0, 0, 0, 0.5); /* Glow effect */ | ||
+ | } | ||
- | < | + | /* Label in the middle of the meter */ |
- | < | + | |
- | <!-- Include Google Fonts --> | + | |
- | < | + | top: 50%; |
+ | left: 50%; | ||
+ | transform: translate(-50%, -50%); | ||
+ | font-family: Arial, sans-serif; | ||
+ | | ||
+ | font-weight: | ||
+ | color: #fff; | ||
+ | text-shadow: | ||
+ | z-index: 3; | ||
+ | } | ||
- | <!-- Include Prism.js CSS --> | + | /* Tooltip styling */ |
- | < | + | |
+ | visibility: hidden; | ||
+ | width: 250px; | ||
+ | background-color: #222; | ||
+ | color: #fff; | ||
+ | text-align: center; | ||
+ | | ||
+ | border-radius: | ||
+ | position: absolute; | ||
+ | top: 50%; /* Vertically aligned */ | ||
+ | left: 110%; /* Position to the right of the meter */ | ||
+ | transform: translateY(-50%); | ||
+ | font-size: 12px; | ||
+ | z-index: 10; | ||
+ | box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3); | ||
+ | } | ||
- | <!-- Include Prism.js JavaScript | + | /* Show tooltip on hover */ |
- | <script src=" | + | |
- | < | + | |
+ | } | ||
- | < | + | |
- | | + | .ramble-wrapper |
- | .code-block { | + | |
- | | + | |
- | font-size: 50px; | + | |
- | line-height: | + | |
- | background-color: | + | |
- | color: #f8f8f2; /* Light text */ | + | |
- | padding: 1px; | + | |
- | border-radius: 8px; | + | |
- | | + | |
- | | + | |
} | } | ||
</ | </ | ||
+ | < | ||
+ | document.addEventListener(" | ||
+ | const needle = document.querySelector(" | ||
+ | const rambleMeter = document.querySelector(" | ||
+ | const level = rambleMeter.getAttribute(" | ||
+ | needle.style.left = `${Math.min(Math.max(level, | ||
+ | }); | ||
+ | </ | ||
</ | </ | ||
+ | < | ||
+ | <!-- Ramble Meter --> | ||
+ | <div class=" | ||
+ | <div class=" | ||
+ | <div class=" | ||
+ | <div class=" | ||
+ | <div class=" | ||
+ | </ | ||
+ | <div class=" | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | Massive investments are being made in the European landscape of quantum computing. The question is what frameworks that enable orchestration of calculations to only deploy the most optimal problem formulation on the most suitable piece of hardware. | ||
+ | |||
+ | ==== Problem statement ==== | ||
As a researcher and innovator in the quantum life-science area, I want to be able to develop or test an algorithm locally on my laptop and iteratively expand on it in terms of parameters, noise models used, systems analysed etc. I want to define a grid of parameters, something like: | As a researcher and innovator in the quantum life-science area, I want to be able to develop or test an algorithm locally on my laptop and iteratively expand on it in terms of parameters, noise models used, systems analysed etc. I want to define a grid of parameters, something like: | ||
- | < | ||
- | <pre class=" | ||
hyperparam_grid = [ | hyperparam_grid = [ | ||
{ | { | ||
Line 50: | Line 125: | ||
... | ... | ||
] | ] | ||
- | </ | ||
- | </ | ||
over which i want to find the optimal combination with respect to evaluation criteria. From this, a test deployment on a actual quantum computer backend would be made. I would then like to collect details on the calculation and build a " | over which i want to find the optimal combination with respect to evaluation criteria. From this, a test deployment on a actual quantum computer backend would be made. I would then like to collect details on the calculation and build a " | ||
Line 58: | Line 131: | ||
Define: | Define: | ||
- | < | + | |
- | <pre class=" | + | |
ansatz_types = [' | ansatz_types = [' | ||
optimizers = [' | optimizers = [' | ||
hyperparams_list = [{' | hyperparams_list = [{' | ||
noise_models = [' | noise_models = [' | ||
- | </ | + | |
- | </ | + | |
For each ansatz_type: | For each ansatz_type: | ||
- | <code python> | ||
Create and append ansatz_spec (function: prepare_ansatz, | Create and append ansatz_spec (function: prepare_ansatz, | ||
- | </ | + | |
For each optimizer: | For each optimizer: | ||
- | + | | |
- | Set vqe_dependencies = [" | + | |
Create nodename_prefix = " | Create nodename_prefix = " | ||
For each hyperparams: | For each hyperparams: | ||
- | |||
Create and append vqe_spec (function: run_vqe_simulation, | Create and append vqe_spec (function: run_vqe_simulation, | ||
- | | + | noise_dependencies = [vqe_spec.node_name] |
Create noise_nodename_prefix = " | Create noise_nodename_prefix = " | ||
For each noise_model: | For each noise_model: | ||
- | |||
Create and append noise_spec (function: apply_noise_model, | Create and append noise_spec (function: apply_noise_model, | ||
- | | + | |
- | Such that for each wavefunction anzats we get a workflow of dependencies | + | Which yields |
+ | |||
+ | " | ||
{{: | {{: | ||
Line 282: | Line 352: | ||
As mentioned earlier, we use ColonyOS features to create and schedule workflows of processes. This can be done in one go through using the Python interface ** pycolonies **: | As mentioned earlier, we use ColonyOS features to create and schedule workflows of processes. This can be done in one go through using the Python interface ** pycolonies **: | ||
- | <code python> | + | < |
+ | < | ||
+ | <link href=" | ||
+ | <script src=" | ||
+ | < | ||
+ | </ | ||
+ | < | ||
+ | <pre>< | ||
def build_workflow(): | def build_workflow(): | ||
step_name = " | step_name = " | ||
Line 377: | Line 453: | ||
workflow_graph = colonies.submit_workflow(workflow, | workflow_graph = colonies.submit_workflow(workflow, | ||
print(f" | print(f" | ||
- | </ | + | |
+ | </ | ||
+ | </ | ||
+ | </ | ||
This workflow generates a graph much like the one described earlier. Each function spec takes a node identified and generates data for instantiating a FuncSpec object, like for instance the one electron integral: | This workflow generates a graph much like the one described earlier. Each function spec takes a node identified and generates data for instantiating a FuncSpec object, like for instance the one electron integral: | ||
- | <code python> | + | < |
+ | < | ||
+ | <link href=" | ||
+ | <script src=" | ||
+ | < | ||
+ | </ | ||
+ | < | ||
+ | <pre>< | ||
def generate_one_electron_integrals_spec(nodename): | def generate_one_electron_integrals_spec(nodename): | ||
one_electron_uuid = str(uuid.uuid4()) | one_electron_uuid = str(uuid.uuid4()) | ||
Line 393: | Line 480: | ||
) | ) | ||
) | ) | ||
- | </ | + | </ |
+ | |||
+ | </ | ||
+ | </html> | ||
The executor used in this example, in turn, imports the required functions and calls them with appropriate arguments: | The executor used in this example, in turn, imports the required functions and calls them with appropriate arguments: | ||
- | <code python> | + | < |
+ | < | ||
+ | <link href=" | ||
+ | <script src=" | ||
+ | < | ||
+ | </ | ||
+ | < | ||
+ | <pre>< | ||
from quantum_workflow.hamiltonian import ( | from quantum_workflow.hamiltonian import ( | ||
calculate_one_electron_integrals, | calculate_one_electron_integrals, | ||
Line 485: | Line 582: | ||
| | ||
etc.. | etc.. | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
- | </ | ||
calculate_one_electron_integrals and other functions under the executor is what contains the actual qiskit implementation: | calculate_one_electron_integrals and other functions under the executor is what contains the actual qiskit implementation: | ||
- | <code python> | + | < |
+ | < | ||
+ | <link href=" | ||
+ | <script src=" | ||
+ | < | ||
+ | </ | ||
+ | < | ||
+ | <pre>< | ||
from pyscf import gto, scf, ao2mo | from pyscf import gto, scf, ao2mo | ||
Line 535: | Line 641: | ||
raise e | raise e | ||
return uuid | return uuid | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
- | </ | ||
Clearly, for simplicity here I'm using PySCF to do my integral calculations, | Clearly, for simplicity here I'm using PySCF to do my integral calculations, | ||
The workflow output is stored in a local sqlite database, and subsequent nodes in the workflow can, upon successful completion of its dependencies (and only then) access the data in the database. If the database transactions are atomic and a particular node in the workflow has succeeded, we can trust this to be a safe operation that will yield clear errors if it fails. | The workflow output is stored in a local sqlite database, and subsequent nodes in the workflow can, upon successful completion of its dependencies (and only then) access the data in the database. If the database transactions are atomic and a particular node in the workflow has succeeded, we can trust this to be a safe operation that will yield clear errors if it fails. | ||
- | |||
- | === Visibility Stack === | ||