From 40dcf8c01273ff7e23a7105d5cdc410ada067001 Mon Sep 17 00:00:00 2001 From: Craig Gidney Date: Wed, 13 Dec 2023 19:02:26 -0800 Subject: [PATCH] Bump stim git tag to latest version of stim (#83) - Add prefixes for enums that became class enums - Fix a few struct-vs-class disagreements - Fix cmake install not including header files --- CMakeLists.txt | 5 ++++- WORKSPACE | 4 +++- .../sparse_blossom/driver/mwpm_decoding.test.cc | 8 ++++---- src/pymatching/sparse_blossom/flooder/graph.h | 2 +- src/pymatching/sparse_blossom/flooder/match.h | 2 +- .../flooder_matcher_interop/compressed_edge.h | 2 +- .../sparse_blossom/flooder_matcher_interop/mwpm_event.h | 2 +- .../sparse_blossom/flooder_matcher_interop/region_edge.h | 2 +- src/pymatching/sparse_blossom/matcher/alternating_tree.h | 2 +- src/pymatching/sparse_blossom/matcher/mwpm.h | 2 +- src/pymatching/sparse_blossom/tracker/flood_check_event.h | 4 ++-- 11 files changed, 20 insertions(+), 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5e82c634..2b81dbbc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,7 +24,7 @@ FetchContent_MakeAvailable(googletest) FetchContent_Declare(stim GIT_REPOSITORY https://github.com/quantumlib/stim.git - GIT_TAG c135a6129963031b5c05f974e9c5e8def83f8316) + GIT_TAG 3e38d12d0a0fb3022646b694137b733a4700d300) FetchContent_MakeAvailable(stim) if (NOT (MSVC)) target_compile_options(libstim PRIVATE -fno-strict-aliasing -fPIC ${ARCH_OPT}) @@ -102,6 +102,7 @@ if (NOT (MSVC)) target_link_options(pymatching PRIVATE -pthread ${ARCH_OPT}) endif () target_link_libraries(pymatching libstim) +install(TARGETS pymatching RUNTIME DESTINATION bin) enable_testing() @@ -129,6 +130,8 @@ if(NOT(MSVC)) target_link_options(libpymatching PRIVATE -pthread -O3) endif() target_link_libraries(libpymatching libstim) +install(TARGETS libpymatching LIBRARY DESTINATION) +install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/src/" DESTINATION "include" FILES_MATCHING PATTERN "*.h" PATTERN "*.inl") include(GoogleTest) gtest_discover_tests(pymatching_tests) diff --git a/WORKSPACE b/WORKSPACE index 301e4403..e6a9861f 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -3,7 +3,7 @@ load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") git_repository( name = "stim", - commit = "c135a6129963031b5c05f974e9c5e8def83f8316", + commit = "3e38d12d0a0fb3022646b694137b733a4700d300", remote = "https://github.com/quantumlib/stim.git", ) @@ -37,7 +37,9 @@ http_archive( ) load("@rules_python//python:repositories.bzl", "py_repositories") + py_repositories() load("@pybind11_bazel//:python_configure.bzl", "python_configure") + python_configure(name = "local_config_python") diff --git a/src/pymatching/sparse_blossom/driver/mwpm_decoding.test.cc b/src/pymatching/sparse_blossom/driver/mwpm_decoding.test.cc index 530859b2..036c35c3 100644 --- a/src/pymatching/sparse_blossom/driver/mwpm_decoding.test.cc +++ b/src/pymatching/sparse_blossom/driver/mwpm_decoding.test.cc @@ -56,7 +56,7 @@ DecodingTestCase load_test_case( fclose(dem_file); auto reader = stim::MeasureRecordReader::make( - shots_in, stim::SAMPLE_FORMAT_B8, 0, dem.count_detectors(), dem.count_observables()); + shots_in, stim::SampleFormat::SAMPLE_FORMAT_B8, 0, dem.count_detectors(), dem.count_observables()); std::ifstream is(find_test_data_file(weights_fn).c_str()); std::istream_iterator start(is), end; @@ -441,7 +441,7 @@ TEST(MwpmDecoding, NegativeEdgeWeightFromStim) { size_t num_distinct_weights = 1000; auto mwpm = pm::detector_error_model_to_mwpm(dem, num_distinct_weights); auto reader = stim::MeasureRecordReader::make( - shots_in, stim::SAMPLE_FORMAT_B8, 0, dem.count_detectors(), dem.count_observables()); + shots_in, stim::SampleFormat::SAMPLE_FORMAT_B8, 0, dem.count_detectors(), dem.count_observables()); stim::SparseShot sparse_shot; size_t num_mistakes = 0; @@ -474,7 +474,7 @@ TEST(MwpmDecoding, NegativeEdgeWeightFromStimDecodeToEdges) { size_t num_distinct_weights = 1000; auto mwpm = pm::detector_error_model_to_mwpm(dem, num_distinct_weights, true); auto reader = stim::MeasureRecordReader::make( - shots_in, stim::SAMPLE_FORMAT_B8, 0, dem.count_detectors(), dem.count_observables()); + shots_in, stim::SampleFormat::SAMPLE_FORMAT_B8, 0, dem.count_detectors(), dem.count_observables()); stim::SparseShot sparse_shot; size_t num_mistakes = 0; @@ -520,7 +520,7 @@ TEST(MwpmDecoding, InvalidSyndromeForToricCode) { size_t num_distinct_weights = 1000; auto mwpm = pm::detector_error_model_to_mwpm(dem, num_distinct_weights); auto reader = stim::MeasureRecordReader::make( - shots_in, stim::SAMPLE_FORMAT_B8, 0, dem.count_detectors(), dem.count_observables()); + shots_in, stim::SampleFormat::SAMPLE_FORMAT_B8, 0, dem.count_detectors(), dem.count_observables()); stim::SparseShot sparse_shot; size_t num_shots = 0; diff --git a/src/pymatching/sparse_blossom/flooder/graph.h b/src/pymatching/sparse_blossom/flooder/graph.h index 3cf4093b..6d771f71 100644 --- a/src/pymatching/sparse_blossom/flooder/graph.h +++ b/src/pymatching/sparse_blossom/flooder/graph.h @@ -25,7 +25,7 @@ namespace pm { -class GraphFillRegion; +struct GraphFillRegion; /// A collection of detector nodes. It's expected that all detector nodes in the graph /// will only refer to other detector nodes within the same graph. diff --git a/src/pymatching/sparse_blossom/flooder/match.h b/src/pymatching/sparse_blossom/flooder/match.h index b146179c..e7b26f66 100644 --- a/src/pymatching/sparse_blossom/flooder/match.h +++ b/src/pymatching/sparse_blossom/flooder/match.h @@ -21,7 +21,7 @@ namespace pm { -class GraphFillRegion; +struct GraphFillRegion; /// A Match is a partnered graph fill region. /// diff --git a/src/pymatching/sparse_blossom/flooder_matcher_interop/compressed_edge.h b/src/pymatching/sparse_blossom/flooder_matcher_interop/compressed_edge.h index 88d8f11f..46458857 100644 --- a/src/pymatching/sparse_blossom/flooder_matcher_interop/compressed_edge.h +++ b/src/pymatching/sparse_blossom/flooder_matcher_interop/compressed_edge.h @@ -19,7 +19,7 @@ namespace pm { -struct DetectorNode; +class DetectorNode; /// A compressed edge is a summary of a path between two detection events. /// Specifically, it tracks which observables the path has crossed. diff --git a/src/pymatching/sparse_blossom/flooder_matcher_interop/mwpm_event.h b/src/pymatching/sparse_blossom/flooder_matcher_interop/mwpm_event.h index a1a34fca..1c29709d 100644 --- a/src/pymatching/sparse_blossom/flooder_matcher_interop/mwpm_event.h +++ b/src/pymatching/sparse_blossom/flooder_matcher_interop/mwpm_event.h @@ -20,7 +20,7 @@ namespace pm { -struct DetectorNode; +class DetectorNode; struct GraphFillRegion; struct RegionHitRegionEventData { diff --git a/src/pymatching/sparse_blossom/flooder_matcher_interop/region_edge.h b/src/pymatching/sparse_blossom/flooder_matcher_interop/region_edge.h index e3508408..8fba107b 100644 --- a/src/pymatching/sparse_blossom/flooder_matcher_interop/region_edge.h +++ b/src/pymatching/sparse_blossom/flooder_matcher_interop/region_edge.h @@ -21,7 +21,7 @@ namespace pm { -class GraphFillRegion; +struct GraphFillRegion; struct RegionEdge { GraphFillRegion* region; diff --git a/src/pymatching/sparse_blossom/matcher/alternating_tree.h b/src/pymatching/sparse_blossom/matcher/alternating_tree.h index 095c2a92..4d9fa52f 100644 --- a/src/pymatching/sparse_blossom/matcher/alternating_tree.h +++ b/src/pymatching/sparse_blossom/matcher/alternating_tree.h @@ -23,7 +23,7 @@ namespace pm { class AltTreeNode; -class GraphFillRegion; +struct GraphFillRegion; struct AltTreeEdge { AltTreeNode* alt_tree_node; diff --git a/src/pymatching/sparse_blossom/matcher/mwpm.h b/src/pymatching/sparse_blossom/matcher/mwpm.h index 5106ac99..a2067101 100644 --- a/src/pymatching/sparse_blossom/matcher/mwpm.h +++ b/src/pymatching/sparse_blossom/matcher/mwpm.h @@ -21,7 +21,7 @@ namespace pm { -struct AltTreeNode; +class AltTreeNode; struct MatchingResult { pm::obs_int obs_mask; diff --git a/src/pymatching/sparse_blossom/tracker/flood_check_event.h b/src/pymatching/sparse_blossom/tracker/flood_check_event.h index ed3c3e4f..d7019ef3 100644 --- a/src/pymatching/sparse_blossom/tracker/flood_check_event.h +++ b/src/pymatching/sparse_blossom/tracker/flood_check_event.h @@ -19,9 +19,9 @@ namespace pm { -struct DetectorNode; +class DetectorNode; struct GraphFillRegion; -struct SearchDetectorNode; +class SearchDetectorNode; enum FloodCheckEventType : uint8_t { /// A placeholder value indicating there was no event.