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

✨ Temperature-aware physical SiDB simulation #120

Merged
merged 100 commits into from
May 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
100 commits
Select commit Hold shift + click to select a range
d96fd38
:sparkles: header for temperature simulation
Feb 6, 2023
3311934
:sparkles: header for temperature simulation
Feb 6, 2023
fb002ce
:white_check_mark: occupation function with tests
Feb 6, 2023
c0cc5b3
:construction: "critical temperature function" is implemented. Test a…
Feb 7, 2023
9914fa1
:construction: CT of "bestagon gates" can be simulated correctly
Feb 8, 2023
17b0b85
:white_check_mark: tests updated
Feb 8, 2023
e7748ca
:white_check_mark: tests updated
Feb 8, 2023
69e80ca
:white_check_mark: tests updated
Feb 9, 2023
d233fd5
:art: map replaced by vector
Feb 9, 2023
7faaeef
:memo: docu for new functions
Feb 9, 2023
3bec9be
:memo: docu for new functions
Feb 9, 2023
25674ce
:art: ClangFormat changes
Feb 9, 2023
b40396c
Merge branch 'main' into sidb_temperature_simulation
marcelwa Feb 9, 2023
994d8f7
:rocket:
Feb 9, 2023
3c267e0
:arrow_up: submodules upgraded
Feb 9, 2023
24ab8bb
:art: ClangFormat changes
Feb 9, 2023
3ffce0c
:art: small cahnges
Feb 10, 2023
635e821
:art: ClangFormat changes
Feb 10, 2023
2b81235
Merge branch 'main' into sidb_temperature_simulation
Drewniok Feb 10, 2023
d5774b4
:art: replaced std::rand(), caused problem at temperature implementation
Feb 10, 2023
a1b51f4
:art: small changes here and there
Feb 11, 2023
282d26c
Merge branch 'main' into sidb_temperature_simulation
Drewniok Feb 11, 2023
2595625
Merge remote-tracking branch 'origin/sidb_temperature_simulation' int…
Feb 11, 2023
0f2f891
:art: reformat code
Feb 13, 2023
a8f0896
Merge branch 'main' into sidb_temperature_simulation
Drewniok Feb 13, 2023
4776108
:art: ClangFormat changes
Feb 13, 2023
be8da3e
Merge branch 'main' into sidb_temperature_simulation
Feb 21, 2023
0345c92
:art: renaming function
Feb 21, 2023
22977ad
:sparkles: flag added to decide between gate and random layout
Feb 21, 2023
da80d25
:sparkles: flag added to decide between gate and random layout
Feb 21, 2023
c15a8d1
:sparkles: flag added to decide between gate and random layout
Feb 21, 2023
956b000
Merge branch 'main' into sidb_temperature_simulation
Feb 22, 2023
9c1a69b
:sparkles: min_energy added in occupation_probability.hpp
Feb 22, 2023
92b676c
Merge branch 'main' into sidb_temperature_simulation
Drewniok Feb 23, 2023
f2c29eb
Merge branch 'main' into sidb_temperature_simulation
Drewniok Feb 24, 2023
1f21e32
:art: Reformatted and cleaned up code
marcelwa Mar 2, 2023
e11866b
Merge branch 'main' into sidb_temperature_simulation
marcelwa Mar 2, 2023
76e1545
:art: ClangFormat changes
Mar 2, 2023
c3cd162
Merge branch 'main' into sidb_temperature_simulation
Drewniok Mar 6, 2023
dc2cae3
Merge branch 'main' into sidb_temperature_simulation
marcelwa Mar 7, 2023
014ab72
Merge branch 'main' into sidb_temperature_simulation
marcelwa Mar 12, 2023
cb7dfa8
Merge branch 'main' into sidb_temperature_simulation
marcelwa Mar 12, 2023
436463a
Merge branch 'main' into sidb_temperature_simulation
Mar 13, 2023
a15a833
Merge branch 'main' into sidb_temperature_simulation
Mar 15, 2023
7b6134b
Merge branch 'main' into sidb_temperature_simulation
Mar 20, 2023
0c3cde8
Merge branch 'main' into sidb_temperature_simulation
marcelwa Mar 27, 2023
1741f0f
:twisted_rightwards_arrows: main merged in current branch
Mar 31, 2023
c67992d
:art: Slight revision for consistency
marcelwa Apr 4, 2023
0da8e9c
:art: renaming
Apr 14, 2023
3835e14
Merge branch 'main' into sidb_temperature_simulation
Drewniok Apr 18, 2023
aa1841e
Merge branch 'main' into sidb_temperature_simulation
Drewniok Apr 19, 2023
282dc92
:art: larger architectural changes.
Drewniok Apr 20, 2023
ae4dde5
Merge branch 'main' into sidb_temperature_simulation
Drewniok Apr 20, 2023
4133316
:art: reformat code and documentation.
Drewniok Apr 20, 2023
a5d8fb1
:memo: added docu.
Drewniok Apr 21, 2023
566e71b
Merge branch 'main' into sidb_temperature_simulation
Drewniok Apr 24, 2023
07e17fb
:art: ClangFormat changes
Apr 24, 2023
8a8b79f
:art: changes after review.
Drewniok Apr 24, 2023
04e54d0
Merge branch 'main' into sidb_temperature_simulation
Drewniok Apr 24, 2023
65f4b62
:art: ClangFormat changes
Apr 24, 2023
803e351
:art: changes after review.
Drewniok Apr 25, 2023
e2f3203
:art: use data type for energy distribution.
Drewniok Apr 25, 2023
c901c3c
:art: additional ``else`` to try to fix windows build issue.
Drewniok Apr 25, 2023
b5db840
:memo: add links for RST.
Drewniok Apr 25, 2023
8162ecc
Merge branch 'main' into sidb_temperature_simulation
Drewniok Apr 25, 2023
3ddc2fa
:memo: add links for RST.
Drewniok Apr 25, 2023
7813776
:memo: add named anchor.
Drewniok Apr 25, 2023
bf3dc50
:memo: use ``-`` instead of ``_``.
Drewniok Apr 25, 2023
84cecf9
:bug: add missing ``$`` in docstring.
Drewniok Apr 25, 2023
99c93d5
:art: ClangFormat changes
Apr 25, 2023
2487fc5
Merge remote-tracking branch 'origin/sidb_temperature_simulation' int…
Drewniok Apr 25, 2023
e5a6354
:art: copy enum class to try to solve window build issue.
Drewniok Apr 25, 2023
41a3bd8
:art: tiny change in docu.
Drewniok Apr 25, 2023
7109965
:art: ClangFormat changes
Apr 25, 2023
6703758
:twisted_rightwards_arrows: merge.
Drewniok Apr 25, 2023
926dd95
:art: ClangFormat changes
Apr 25, 2023
ff785b1
:art: change to scoped enumerator.
Drewniok Apr 26, 2023
e67ed41
:art: ClangFormat changes
Apr 26, 2023
ab1497b
:art: use enum struct.
Drewniok Apr 26, 2023
14e2946
Merge remote-tracking branch 'origin/sidb_temperature_simulation' int…
Drewniok Apr 26, 2023
e173661
:fire: remove ``enum class``due to windows CI issue.
Drewniok Apr 26, 2023
1d7534d
:art: ClangFormat changes
Apr 26, 2023
c240099
:art: replace reference.
Drewniok Apr 26, 2023
a5ab4a5
Merge remote-tracking branch 'origin/sidb_temperature_simulation' int…
Drewniok Apr 26, 2023
69f3119
:sparkles: Temperature-aware simulation can be conducted with ``exgs`…
Drewniok Apr 27, 2023
efa5e46
:art: ClangFormat changes
Apr 27, 2023
f63d9cf
:art: rename struct member.
Drewniok Apr 27, 2023
c583c68
Merge branch 'main' into sidb_temperature_simulation
Drewniok May 1, 2023
582554d
:art: update after review (main change: replace stats_pointer as inpu…
Drewniok May 1, 2023
ebf7925
Merge branch 'main' into sidb_temperature_simulation
Drewniok May 1, 2023
40b4f77
:art: ClangFormat changes
May 1, 2023
fb734f2
:art: remove ``const``keyword.
Drewniok May 2, 2023
e741662
:art: add ``const``keyword.
Drewniok May 3, 2023
ea5f152
:art: change order of ``const``keyword and type.
Drewniok May 4, 2023
01fd7ae
Merge branch 'main' into sidb_temperature_simulation
Drewniok May 10, 2023
af97ea3
Merge branch 'main' into sidb_temperature_simulation
Drewniok May 10, 2023
c1a6545
:art: implement Marcel's suggestions.
Drewniok May 11, 2023
169e44b
:art: remove ``state_type`` variable.
Drewniok May 11, 2023
090664d
:art: add ``const``.
Drewniok May 11, 2023
b961438
Merge branch 'main' into sidb_temperature_simulation
marcelwa May 11, 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
26 changes: 26 additions & 0 deletions docs/algorithms/sidb_simulation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ Energy Calculation

**Header:** ``fiction/algorithms/simulation/sidb/energy_distribution.hpp``

.. doxygentypedef:: fiction::sidb_energy_distribution
.. doxygenfunction:: fiction::energy_distribution


Expand All @@ -62,6 +63,31 @@ Energy Calculation
.. doxygenfunction:: fiction::is_ground_state


Temperature Behavior
####################

.. _critical-temperature:

**Header:** ``fiction/algorithms/simulation/sidb/critical_temperature.hpp``

.. doxygenenum:: fiction::critical_temperature_mode
.. doxygenenum:: fiction::simulation_engine
.. doxygenstruct:: fiction::critical_temperature_params
:members:
.. doxygenfunction:: fiction::critical_temperature
Drewniok marked this conversation as resolved.
Show resolved Hide resolved

**Header:** ``fiction/algorithms/simulation/sidb/occupation_probability_excited_states.hpp``

.. doxygenfunction:: fiction::occupation_probability_gate_based
Drewniok marked this conversation as resolved.
Show resolved Hide resolved
.. doxygenfunction:: fiction::occupation_probability_non_gate_based

**Header:** ``fiction/algorithms/simulation/sidb/calculate_energy_and_state_type.hpp``

.. doxygentypedef:: fiction::sidb_energy_and_state_type
.. doxygenfunction:: fiction::calculate_energy_and_state_type



Time-to-Solution (TTS) Statistics
#################################

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
//
// Created by Jan Drewniok on 20.04.23.
//

#ifndef FICTION_CALCULATE_ENERGY_AND_STATE_TYPE_HPP
#define FICTION_CALCULATE_ENERGY_AND_STATE_TYPE_HPP

#include "fiction/algorithms/simulation/sidb/energy_distribution.hpp"
#include "fiction/technology/charge_distribution_surface.hpp"
#include "fiction/utils/math_utils.hpp"

#include <cstdint>
#include <map>
#include <string>
#include <utility>
#include <vector>

namespace fiction
{

/**
* Data type to collect electrostatic potential energies of charge distributions with corresponding state types (i.e.,
* true = transparent, false = erroneous).
*/
using sidb_energy_and_state_type = std::vector<std::pair<double, bool>>;
Drewniok marked this conversation as resolved.
Show resolved Hide resolved

/**
* This function takes in an SiDB energy distribution. For each charge distribution, the state type is determined (i.e.
* erroneous, transparent).
*
* @tparam Lyt SiDB cell-level layout type (representing a gate).
* @param energy_distribution Energy distribution.
* @param output_cells SiDBs in the layout from which the output is read.
* @param output_bits Truth table entry for a given input (e.g. 0 for AND (00 as input) or 1 for a wire (input 1)).
* @return sidb_energy_and_state_type Electrostatic potential energy of all charge distributions with state type.
*/
template <typename Lyt>
[[nodiscard]] sidb_energy_and_state_type
calculate_energy_and_state_type(const sidb_energy_distribution& energy_distribution,
const std::vector<charge_distribution_surface<Lyt>>& valid_lyts,
const std::vector<typename Lyt::cell>& output_cells,
const std::vector<bool>& output_bits) noexcept

{
static_assert(is_cell_level_layout_v<Lyt>, "Lyt is not a cell-level layout");
static_assert(has_sidb_technology_v<Lyt>, "Lyt is not an SiDB layout");
static_assert(has_siqad_coord_v<Lyt>, "Lyt is not based on SiQAD coordinates");

assert(!output_cells.empty() && "No output cell provided.");
assert(!output_bits.empty() && "No output bits provided.");

sidb_energy_and_state_type energy_and_state_type{};

for (const auto& [energy, occurrence] : energy_distribution)
{
// round the energy value to six decimal places to overcome potential rounding errors.
const auto energy_value = round_to_n_decimal_places(energy, 6);
for (const auto& valid_layout : valid_lyts)
{
// round the energy value of the given valid_layout to six decimal places to overcome possible rounding
// errors and to provide comparability with the energy_value from before.
if (round_to_n_decimal_places(valid_layout.get_system_energy(), 6) == energy_value)
Fixed Show fixed Hide fixed
{
// collect the charge state of the output SiDBs.
std::vector<sidb_charge_state> charge_states(output_cells.size());
std::transform(output_cells.cbegin(), output_cells.cend(), charge_states.begin(),
[&](const auto& cell) { return valid_layout.get_charge_state(cell); });

// Convert the charge states of the output SiDBs to bits (-1 -> 1, 0 -> 0).
std::vector<bool> charge(charge_states.size());
std::transform(charge_states.cbegin(), charge_states.cend(), charge.begin(),
[](const auto& state) { return static_cast<bool>(-charge_state_to_sign(state)); });

if (charge == output_bits)
{
// The output SiDB matches the truth table entry. Hence, state is called transparent.
energy_and_state_type.emplace_back(energy, true);
}
else
{
energy_and_state_type.emplace_back(energy, false);
}
}
}
}

return energy_and_state_type;
Drewniok marked this conversation as resolved.
Show resolved Hide resolved
}

} // namespace fiction

#endif // FICTION_CALCULATE_ENERGY_AND_STATE_TYPE_HPP
Loading