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

✨ SiDB Operational Domain Computation #255

Merged
merged 99 commits into from
Sep 14, 2023
Merged
Show file tree
Hide file tree
Changes from 95 commits
Commits
Show all changes
99 commits
Select commit Hold shift + click to select a range
94c481d
:sparkles: Initial algorithm for the detection of I/O BDL pairs
marcelwa Jul 21, 2023
4b28c87
:memo: Added docstrings and RST documentation
marcelwa Jul 21, 2023
84eae22
:white_check_mark: Incorporated Jan's comments
marcelwa Jul 24, 2023
90fa30d
:art: Added some more documentation and fixed some inconsistencies
marcelwa Jul 24, 2023
619268c
:art: ClangFormat changes
Jul 24, 2023
4923565
:art: Added lower bound `minimum_distance` parameter for BDL pairs to…
marcelwa Jul 24, 2023
8ee9536
:art: Rewrote detection function to detect any given kind of BDL pair
marcelwa Jul 24, 2023
23e1b23
:sparkles: Added a `bdl_input_iterator` that can iterate over all pos…
marcelwa Jul 24, 2023
365c9e7
:art: Added `operator>` and `operator>=`
marcelwa Jul 25, 2023
cc28547
:art: Made `bdl_input_iterator` into a random access iterator
marcelwa Jul 25, 2023
c532ac2
:art: ClangFormat changes
Jul 25, 2023
f0b3065
:bug: Fixed a bug resulting from the misinterpretation of the subscri…
marcelwa Jul 25, 2023
675b45c
Merge remote-tracking branch 'origin/opdomain' into opdomain
marcelwa Jul 25, 2023
caf0d8d
:bug: Fixed test case to be independent of `Lyt`'s implementation
marcelwa Jul 27, 2023
a011fda
:art: Added missing include
marcelwa Jul 27, 2023
f1d2bb3
:sparkles: Initial operational domain computation algorithm via grid …
marcelwa Jul 27, 2023
7f0ac04
:memo: Added `operational_domain` documentation
marcelwa Jul 28, 2023
92b0120
Merge branch 'main' into opdomain
marcelwa Jul 28, 2023
1e10ea9
:alien: Accommodated the removal of the units library
marcelwa Jul 28, 2023
8a7d7f2
:white_check_mark: Added a test case for a 2-input gate
marcelwa Jul 28, 2023
836cc58
:sparkles: Added random sampling operational domain computation
marcelwa Jul 31, 2023
776ef28
:art: Reduced code duplication
marcelwa Jul 31, 2023
0c40472
:art: Added missing `const`
marcelwa Aug 2, 2023
0c18ac9
:art: Revive `csv_writer`
marcelwa Aug 2, 2023
e7a4422
:sparkles: Add functionality to write an operational domain to a CSV …
marcelwa Aug 2, 2023
d7263f8
:art: Added `const`
marcelwa Aug 2, 2023
19f7dd6
:rotating_light: Fixed warning
marcelwa Aug 2, 2023
0cc545a
:bug: Removed superfluous template parameter
marcelwa Aug 2, 2023
d7378ba
:art: ClangFormat changes
Aug 2, 2023
a7efc70
:bug: Removed blank space in CSV delimiter
marcelwa Aug 2, 2023
382488c
Merge remote-tracking branch 'origin/opdomain' into opdomain
marcelwa Aug 2, 2023
2d80e78
:bug: Changed the default min values to `1.0` to prevent division by …
marcelwa Aug 2, 2023
73504de
:bug: If no physically-valid charge distributions exist, the layout i…
marcelwa Aug 2, 2023
3138abd
:art: Minor updates to documentation and code consistency
marcelwa Aug 3, 2023
7a70958
Merge branch 'main' into opdomain
marcelwa Aug 3, 2023
ae9d7d3
:twisted_rightwards_arrows: Merge `main` into this branch
marcelwa Aug 3, 2023
001352c
:art: Restructured code to avoid further code duplication
marcelwa Aug 3, 2023
9d609ef
:sparkles: Added an operational domain computation algorithm based on…
marcelwa Aug 7, 2023
7f39544
:bug: Correct boundary check in operational domain computation
marcelwa Aug 7, 2023
c3bdfb9
:bug: Fixed compiler issues by preventing the use of the C++20 extens…
marcelwa Aug 7, 2023
269570e
:art: Avoid code duplication in `read_sqd_layout`
marcelwa Aug 8, 2023
374f045
:sparkles: Add support for cell types in SQD layout files
marcelwa Aug 8, 2023
b09f5ee
:memo: Added documentation on the OpDomain flood fill algorithm
marcelwa Aug 8, 2023
76593a4
:art: Made `bdl_input_iterator` thread-safe by preventing it to work …
marcelwa Aug 8, 2023
f2afa19
:thread: Added multi-threading support to `operational_domain_grid_se…
marcelwa Aug 8, 2023
6064ca2
:pencil2: Fixed a typo
marcelwa Aug 8, 2023
0ef0df6
:art: ClangFormat changes
Aug 8, 2023
6b6e1d1
:bug: Fixed a bug in SQD parsing with SiQAD coordinates
marcelwa Aug 8, 2023
2d3e800
Merge remote-tracking branch 'origin/opdomain' into opdomain
marcelwa Aug 8, 2023
5e2dc8b
:art: Allow statistics collection via atomics instead of using a mutex
marcelwa Aug 11, 2023
0d8e4a4
:sparkles: Added an `sidb_simulation_engine` toggle to enable the use…
marcelwa Aug 11, 2023
78d0a35
:art: ClangFormat changes
Aug 11, 2023
d5c3177
:bug: Fixed potential data race bug
marcelwa Aug 11, 2023
7ee049e
:bug: Fixed QuickSim parameter passing
marcelwa Aug 11, 2023
b99847d
:sparkles: Check for the occurrence of positive charges before simula…
marcelwa Aug 14, 2023
9a1a16a
Merge remote-tracking branch 'origin/opdomain' into opdomain
marcelwa Aug 14, 2023
5145ff9
:construction: Added TODO and fixed a compiler warning
marcelwa Aug 14, 2023
c56720e
:construction: Added operational domain computation via contour tracing
marcelwa Aug 14, 2023
9cf3751
:art: Simplified code, removed duplication
marcelwa Aug 14, 2023
d1fd37a
:art: Simplified code, removed duplication, improved performance, mad…
marcelwa Aug 14, 2023
d85ab58
:thread: Made `random_sampling` multithreaded
marcelwa Aug 14, 2023
db0edf9
Merge branch 'opdomain' into opdomain-contour-tracing
marcelwa Aug 14, 2023
5e6fc1c
:alien: Updated `contour_tracing` based on the previous changes to `o…
marcelwa Aug 14, 2023
1951d21
:art: Consider the determination of positive charges a simulator call
marcelwa Aug 15, 2023
0f5ccdc
:art: Cleaned up and refactored code
marcelwa Aug 30, 2023
b0795ef
:art: Use Moore Neighborhood in `flood_fill`
marcelwa Aug 30, 2023
6978e7b
:bug: Fixed parallel random sampling
marcelwa Aug 30, 2023
5d12e8d
Merge branch 'opdomain' into opdomain-contour-tracing
marcelwa Aug 30, 2023
f835e9b
:art: Implemented `clang-tidy`'s suggestions
marcelwa Aug 30, 2023
6f8fee6
:art: Implemented `clang-tidy`'s suggestions
marcelwa Aug 30, 2023
68b07bb
Merge remote-tracking branch 'origin/opdomain' into opdomain
marcelwa Aug 30, 2023
0c5fe8b
:art: Implemented CodeQL's suggestions
marcelwa Aug 30, 2023
1fc09b9
:art: Create designated types for `step_point` and `parameter_point` …
marcelwa Aug 31, 2023
c578c80
:bug: Fixed the counter boundary finding algorithm for contour tracin…
marcelwa Aug 31, 2023
033f56f
:art: ClangFormat
marcelwa Aug 31, 2023
93154ec
:white_check_mark: Extend test cases to semi-operational areas
marcelwa Sep 4, 2023
7a3a69e
:art: Decreased code duplication
marcelwa Sep 4, 2023
4ca1822
:art: Reduced further code duplication
marcelwa Sep 4, 2023
b2dbe03
:bug: Fixed a data race bug in the logging of statistics
marcelwa Sep 4, 2023
6bf9826
Merge branch 'main' into opdomain
marcelwa Sep 4, 2023
cc7f08e
:twisted_rightwards_arrows: Merge `main` into `opdomain`
marcelwa Sep 4, 2023
ad2e829
:memo: Updated documentation on the adjusted flood fill operational d…
marcelwa Sep 4, 2023
15647db
:pencil2: Fix typos
marcelwa Sep 4, 2023
84d118e
:art: Incorporated Jan's feedback
marcelwa Sep 4, 2023
acffee3
:bug: Fixed rarely occurring bug that caught contour tracing in an en…
marcelwa Sep 5, 2023
4085da2
:art: ClangFormat changes
Sep 5, 2023
75ad346
Merge branch 'main' into opdomain
marcelwa Sep 5, 2023
552b465
Merge branch 'main' into opdomain
marcelwa Sep 12, 2023
24b59f1
:alien: Updated code due to changes introduced in the QuickExact PR
marcelwa Sep 12, 2023
f2e7eb7
:memo: Removed TODOs
marcelwa Sep 12, 2023
6c50345
:art: ClangFormat changes
Sep 12, 2023
692386b
:art: Added a check for ground-state degeneracy
marcelwa Sep 12, 2023
5572c02
Merge remote-tracking branch 'origin/opdomain' into opdomain
marcelwa Sep 12, 2023
af49cea
:memo: Added missing contour tracing operational domain algorithm to …
marcelwa Sep 12, 2023
ff6d51b
:bug: Fixed degeneracy check
marcelwa Sep 12, 2023
8b19b0b
:rotating_light: Fixed `clang-tidy` warnings
marcelwa Sep 13, 2023
cac9713
:alembic: Added the experiment code for the paper
marcelwa Sep 13, 2023
b123aa2
:rotating_light: Incorporated `clang-tidy` suggestions
marcelwa Sep 13, 2023
9a7b3b3
:rotating_light: Incorporated `clang-tidy` suggestions
marcelwa Sep 14, 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
2 changes: 1 addition & 1 deletion .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ IncludeCategories:
Priority: 2
- Regex: '<fiction\/[a-zA-Z0-9_]+.+>$'
Priority: 3
- Regex: '<(alice|lorina|mockturtle|kitty|bill|nlohmann|fmt|z3|phmap|tinyxml2|units)(\/[a-zA-Z0-9_])*.+>$'
- Regex: '<(alice|lorina|mockturtle|kitty|bill|nlohmann|fmt|z3|phmap|btree|tinyxml2|units)(\/[a-zA-Z0-9_])*.+>$'
Priority: 4
- Regex: '<z3[a-zA-Z0-9_\+]+.+>$'
Priority: 5
Expand Down
9 changes: 9 additions & 0 deletions docs/algorithms/iterators.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,12 @@ Gray Code Iterator

.. doxygenclass:: fiction::gray_code_iterator
:members:


BDL Input Iterator
------------------

**Header:** ``fiction/algorithms/iter/bdl_input_iterator.hpp``

.. doxygenclass:: fiction::bdl_input_iterator
:members:
49 changes: 44 additions & 5 deletions docs/algorithms/sidb_simulation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ Exhaustive Ground State Simulation

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

.. doxygenenum:: fiction::automatic_base_number_detection
.. doxygenstruct:: fiction::quickexact_params
:members:
.. doxygenfunction:: fiction::quickexact
Expand All @@ -50,6 +49,15 @@ Exhaustive Ground State Simulation
.. doxygenfunction:: fiction::exhaustive_ground_state_simulation


Engine Selectors
################

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

.. doxygenenum:: fiction::sidb_simulation_engine
.. doxygenenum:: fiction::exhaustive_sidb_simulation_engine


Energy Calculation
##################

Expand All @@ -76,8 +84,6 @@ Temperature Behavior

**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
Expand Down Expand Up @@ -108,7 +114,6 @@ Time-to-Solution (TTS) Statistics

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

.. doxygenenum:: fiction::exhaustive_algorithm
.. doxygenstruct:: fiction::time_to_solution_params
:members:
.. doxygenfunction:: fiction::sim_acc_tts
Expand All @@ -119,7 +124,41 @@ Random SiDB Layout Generator

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

.. doxygenenum:: fiction::positive_charges
.. doxygenstruct:: fiction::generate_random_sidb_layout_params
.. doxygenfunction:: fiction::generate_random_sidb_layout
.. doxygenfunction:: fiction::generate_multiple_random_sidb_layouts


Operational Domain Computation
##############################

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

.. doxygenstruct:: fiction::operational_domain
:members:

.. doxygenstruct:: fiction::operational_domain_params
:members:
.. doxygenstruct:: fiction::operational_domain_stats
:members:

.. doxygenfunction:: fiction::operational_domain_grid_search
.. doxygenfunction:: fiction::operational_domain_random_sampling
.. doxygenfunction:: fiction::operational_domain_flood_fill
.. doxygenfunction:: fiction::operational_domain_contour_tracing


Utility Functions
#################


Binary-dot Logic (BDL) Pair Detection
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

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

.. doxygenstruct:: fiction::bdl_pair
:members:
.. doxygenstruct:: fiction::detect_bdl_pairs_params
:members:
.. doxygenfunction:: fiction::detect_bdl_pairs
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ Let there be a *fiction*
io/input.rst
io/visualization.rst
io/physical_simulation.rst
io/utility.rst

.. toctree::
:maxdepth: 2
Expand Down
10 changes: 10 additions & 0 deletions docs/io/physical_simulation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,13 @@ SiQAD
.. doxygenfunction:: fiction::read_sqd_layout(Lyt& lyt, const std::string_view& filename)

.. doxygenclass:: fiction::sqd_parsing_error

SiDB Operational Domain
#######################

**Header:** ``fiction/io/write_operational_domain.hpp``

.. doxygenstruct:: fiction::write_operational_domain_params
:members:
.. doxygenfunction:: fiction::write_operational_domain(const operational_domain& opdom, std::ostream& os, const write_operational_domain_params& params = {})
.. doxygenfunction:: fiction::write_operational_domain(const operational_domain& opdom, const std::string_view& filename, const write_operational_domain_params& params = {})
9 changes: 9 additions & 0 deletions docs/io/utility.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Utility
-------

Utility code for I/O.


**Header:** ``fiction/io/csv_writer.hpp``

.. doxygenclass:: fiction::csv_writer
8 changes: 8 additions & 0 deletions docs/utils/utils.rst
Original file line number Diff line number Diff line change
Expand Up @@ -180,3 +180,11 @@ Hashing
This header defines implementations for ``std::hash`` for several data types.

.. doxygenfunction:: fiction::hash_combine


`phmap`
-------

**Header:** ``fiction/utils/phmap_utils.hpp``

.. doxygentypedef:: fiction::locked_parallel_flat_hash_map
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,9 @@ int main(int argc, const char* argv[]) // NOLINT
// specifies whether positively charged SiDBs are allowed ("ALLOWED") or forbidden ("FORBIDDEN")
const std::string charges_str = options["--positive_charges"];
// specifies whether positively charged SiDBs are allowed ("ALLOWED") or forbidden ("FORBIDDEN")
const positive_charges charges =
(charges_str == "ALLOWED") ? positive_charges::ALLOWED : positive_charges::FORBIDDEN;
const generate_random_sidb_layout_params<sidb_cell_clk_lyt>::positive_charges charges =
(charges_str == "ALLOWED") ? generate_random_sidb_layout_params<sidb_cell_clk_lyt>::positive_charges::ALLOWED :
generate_random_sidb_layout_params<sidb_cell_clk_lyt>::positive_charges::FORBIDDEN;
// sets the number of SiDBs for the first bunch of layouts
const uint64_t lower_limit = std::stoull(options["--lower"]);
// sets the number of SiDBs for the last bunch of layouts
Expand All @@ -118,8 +119,6 @@ int main(int argc, const char* argv[]) // NOLINT
std::cout << "step: " << step << std::endl;

// generates random SiDB layouts as .sqd file
using cell_level_layout = cell_level_layout<sidb_technology, clocked_layout<cartesian_layout<siqad::coord_t>>>;

try
{
std::filesystem::path folder_path(EXPERIMENTS_PATH);
Expand Down Expand Up @@ -165,11 +164,11 @@ int main(int argc, const char* argv[]) // NOLINT
std::cout << "Folder already exists." << std::endl;
}

const generate_random_sidb_layout_params<cell_level_layout> params{
const generate_random_sidb_layout_params<sidb_cell_clk_lyt> params{
{{nw_x, nw_y}, {se_x, se_y}}, number_of_placed_sidbs, charges, 2,
static_cast<uint64_t>(10E6), number_of_layouts};
const auto unique_lyts =
generate_multiple_random_sidb_layouts<cell_level_layout>(cell_level_layout{}, params);
generate_multiple_random_sidb_layouts<sidb_cell_clk_lyt>(sidb_cell_clk_lyt{}, params);
for (auto i = 0u; i < unique_lyts.size(); i++)
{
write_sqd_layout(unique_lyts[i], fmt::format("{}/layout_{}.sqd", dir_path_sqd.string(), i));
Expand Down
20 changes: 10 additions & 10 deletions include/fiction/algorithms/iter/aspect_ratio_iterator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
#ifndef FICTION_ASPECT_RATIO_ITERATOR_HPP
#define FICTION_ASPECT_RATIO_ITERATOR_HPP

#include <algorithm>
#include <cmath>
#include <cstdint>
#include <iterator>
#include <vector>

namespace fiction
Expand Down Expand Up @@ -75,47 +75,47 @@ class aspect_ratio_iterator
return result;
}

AspectRatio operator*() const
[[nodiscard]] AspectRatio operator*() const
{
return *it;
}

bool operator==(const uint64_t m) const noexcept
[[nodiscard]] bool operator==(const uint64_t m) const noexcept
{
return num == m;
}

bool operator==(const aspect_ratio_iterator& other) const
[[nodiscard]] bool operator==(const aspect_ratio_iterator& other) const
{
return (num == other.num) && (*it == *(other.it));
}

bool operator!=(const uint64_t m) const noexcept
[[nodiscard]] bool operator!=(const uint64_t m) const noexcept
{
return num != m;
}

bool operator!=(const aspect_ratio_iterator& other) const
[[nodiscard]] bool operator!=(const aspect_ratio_iterator& other) const
{
return !(*this == other);
}

bool operator<(const uint64_t m) const noexcept
[[nodiscard]] bool operator<(const uint64_t m) const noexcept
{
return num < m;
}

bool operator<(const aspect_ratio_iterator& other) const
[[nodiscard]] bool operator<(const aspect_ratio_iterator& other) const
{
return (num < other.num) || (num == other.num && *it < *(other.it));
}

bool operator<=(const uint64_t m) const noexcept
[[nodiscard]] bool operator<=(const uint64_t m) const noexcept
{
return num <= m;
}

bool operator<=(const aspect_ratio_iterator& other) const
[[nodiscard]] bool operator<=(const aspect_ratio_iterator& other) const
{
return (num <= other.num) || (num == other.num && *it <= *(other.it));
}
Expand Down
Loading
Loading