Skip to content
This repository has been archived by the owner on Dec 10, 2024. It is now read-only.

Core: Lazy MIFs #129

Merged
merged 28 commits into from
Nov 12, 2024
Merged

Core: Lazy MIFs #129

merged 28 commits into from
Nov 12, 2024

Conversation

iopapamanoglou
Copy link
Contributor

Core: Lazy MIFs

Description

Second iteration of lazy MIFs, running directly on C++ core.

Fixes # (issue)

Checklist

Please read and execute the following:

  • My code follows the coding guidelines of this project
  • My PR title is following the contribution guidelines
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (if applicable)
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works (if applicable)
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • I ran Black to format my code

Code of Conduct

By submitting this issue, you agree to follow our Code of Conduct:

@iopapamanoglou iopapamanoglou mentioned this pull request Nov 8, 2024
11 tasks
@iopapamanoglou iopapamanoglou marked this pull request as ready for review November 12, 2024 17:53
@iopapamanoglou iopapamanoglou enabled auto-merge (squash) November 12, 2024 18:13
@mawildoer
Copy link
Contributor

Error log rebuilding minimal led w/ old build artifacts lying around causes an error:

error.log

}

PathData &BFSPath::get_path_data_mut() {
if (!path_data.unique()) {
Copy link
Contributor

@mawildoer mawildoer Nov 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deprecated method causing build errors on modern compilers: https://en.cppreference.com/w/cpp/memory/shared_ptr/unique

Obtaining file:///Users/mattwildoer/Projects/faebryk
  Installing build dependencies ... done
  Checking if build backend supports build_editable ... done
  Getting requirements to build editable ... done
  Installing backend dependencies ... done
  Preparing editable metadata (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Preparing editable metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [60 lines of output]
      *** scikit-build-core 0.9.2 using CMake 3.27.8 (wheel)
      *** Configuring CMake...
      2024-11-12 11:24:30,939 - scikit_build_core - WARNING - libdir/ldlibrary: /opt/homebrew/opt/[email protected]/Frameworks/Python.framework/Versions/3.12/lib/Python.framework/Versions/3.1
2/Python is not a real file!                                                                                                                                                                   loading initial cache file /private/var/folders/8v/zd4990r94sj86c3cz5gszwcc0000gn/T/tmpdptqu5gm/build/CMakeInit.txt
      -- The CXX compiler identification is AppleClang 15.0.0.15000309
      -- Detecting CXX compiler ABI info
      -- Detecting CXX compiler ABI info - done
      -- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ - skipped
      -- Detecting CXX compile features
      -- Detecting CXX compile features - done
      -- Found Python: /Users/mattwildoer/Projects/faebryk/.venv/bin/python3.12 (found version "3.12.7") found components: Interpreter Development.Module
      -- Python_EXECUTABLE: /Users/mattwildoer/Projects/faebryk/.venv/bin/python3.12
      -- Python_INCLUDE_DIR: /opt/homebrew/Cellar/[email protected]/3.12.7_1/Frameworks/Python.framework/Versions/3.12/include/python3.12
      -- Python_LIBRARY: /opt/homebrew/opt/[email protected]/Frameworks/Python.framework/Versions/3.12/Python
      -- Configuring done (14.5s)
      -- Generating done (0.0s)
      -- Build files have been written to: /private/var/folders/8v/zd4990r94sj86c3cz5gszwcc0000gn/T/tmpdptqu5gm/build
      *** Building project with Ninja...
      [1/24] Building CXX object CMakeFiles/faebryk_core_cpp.dir/src/pathfinder/bfs.cpp.o
      FAILED: CMakeFiles/faebryk_core_cpp.dir/src/pathfinder/bfs.cpp.o
      /Library/Developer/CommandLineTools/usr/bin/c++ -DEDITABLE=0 -Dfaebryk_core_cpp_EXPORTS -I/Users/mattwildoer/Projects/faebryk/src/faebryk/core/cpp/include -I/opt/homebrew/Cellar/p
[email protected]/3.12.7_1/Frameworks/Python.framework/Versions/3.12/include/python3.12 -I/private/var/folders/8v/zd4990r94sj86c3cz5gszwcc0000gn/T/pip-build-env-jorra5vc/overlay/lib/python3.12/site-packages/nanobind/include -O2 -O3 -DNDEBUG -std=gnu++20 -arch x86_64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX15.1.sdk -fPIC -fvisibility=hidden -fno-stack-protector -Os -MD -MT CMakeFiles/faebryk_core_cpp.dir/src/pathfinder/bfs.cpp.o -MF CMakeFiles/faebryk_core_cpp.dir/src/pathfinder/bfs.cpp.o.d -o CMakeFiles/faebryk_core_cpp.dir/src/pathfinder/bfs.cpp.o -c /Users/mattwildoer/Projects/faebryk/src/faebryk/core/cpp/src/pathfinder/bfs.cpp                                                                                                   /Users/mattwildoer/Projects/faebryk/src/faebryk/core/cpp/src/pathfinder/bfs.cpp:78:20: error: no member named 'unique' in 'std::shared_ptr<PathData>'
          if (!path_data.unique()) {
               ~~~~~~~~~ ^
      1 error generated.
      [2/24] Building CXX object CMakeFiles/faebryk_core_cpp.dir/src/pathfinder/pathcounter.cpp.o
      [3/24] Building CXX object CMakeFiles/faebryk_core_cpp.dir/src/graph/link.cpp.o
      [4/24] Building CXX object CMakeFiles/faebryk_core_cpp.dir/src/graph/path.cpp.o
      [5/24] Building CXX object CMakeFiles/faebryk_core_cpp.dir/src/graph/links.cpp.o
      [6/24] Building CXX object CMakeFiles/faebryk_core_cpp.dir/src/graph/graphinterfaces.cpp.o
      [7/24] Building CXX object CMakeFiles/faebryk_core_cpp.dir/src/graph/graphinterface.cpp.o
      [8/24] Building CXX object CMakeFiles/faebryk_core_cpp.dir/src/graph/node.cpp.o
      [9/24] Building CXX object CMakeFiles/faebryk_core_cpp.dir/src/graph/graph.cpp.o
      [10/24] Building CXX object CMakeFiles/faebryk_core_cpp.dir/src/main.cpp.o
      ninja: build stopped: subcommand failed.
      Traceback (most recent call last):
        File "/Users/mattwildoer/Projects/faebryk/.venv/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/Users/mattwildoer/Projects/faebryk/.venv/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/Users/mattwildoer/Projects/faebryk/.venv/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 176, in prepare_metadata_for_build_edi
table                                                                                                                                                                                              whl_basename = build_hook(metadata_directory, config_settings)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/private/var/folders/8v/zd4990r94sj86c3cz5gszwcc0000gn/T/pip-build-env-jorra5vc/overlay/lib/python3.12/site-packages/hatchling/build.py", line 83, in build_editable
          return os.path.basename(next(builder.build(directory=wheel_directory, versions=['editable'])))
                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/private/var/folders/8v/zd4990r94sj86c3cz5gszwcc0000gn/T/pip-build-env-jorra5vc/overlay/lib/python3.12/site-packages/hatchling/builders/plugin/interface.py", line 147, in 
build                                                                                                                                                                                              build_hook.initialize(version, build_data)
        File "/private/var/folders/8v/zd4990r94sj86c3cz5gszwcc0000gn/T/pip-build-env-jorra5vc/overlay/lib/python3.12/site-packages/scikit_build_core/hatch/plugin.py", line 121, in initi
alize                                                                                                                                                                                              self._initialize(build_data=build_data)
        File "/private/var/folders/8v/zd4990r94sj86c3cz5gszwcc0000gn/T/pip-build-env-jorra5vc/overlay/lib/python3.12/site-packages/scikit_build_core/hatch/plugin.py", line 237, in _init
ialize                                                                                                                                                                                             builder.build(build_args=build_args)
        File "/private/var/folders/8v/zd4990r94sj86c3cz5gszwcc0000gn/T/pip-build-env-jorra5vc/overlay/lib/python3.12/site-packages/scikit_build_core/builder/builder.py", line 229, in bu
ild                                                                                                                                                                                                self.config.build(
        File "/private/var/folders/8v/zd4990r94sj86c3cz5gszwcc0000gn/T/pip-build-env-jorra5vc/overlay/lib/python3.12/site-packages/scikit_build_core/cmake.py", line 243, in build
          self._build(*local_args, *build_args)
        File "/private/var/folders/8v/zd4990r94sj86c3cz5gszwcc0000gn/T/pip-build-env-jorra5vc/overlay/lib/python3.12/site-packages/scikit_build_core/cmake.py", line 254, in _build
          raise FailedLiveProcessError(msg) from None
      scikit_build_core.errors.FailedLiveProcessError: CMake build failed
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.

[notice] A new release of pip is available: 24.2 -> 24.3.1
[notice] To update, run: pip install --upgrade pip
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

}

PathData &BFSPath::get_path_data_mut() {
if (!path_data.use_count() == 1) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See dangers on multithreading for future here: https://en.cppreference.com/w/cpp/memory/shared_ptr/use_count

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an odd thing to enforce, but we can discuss it another time

@@ -115,6 +118,7 @@ def compile_and_load():
is_pyi=True,
)
)
subprocess.check_output(["ruff", "check", "--fix", pyi_out])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Making this run_live in case there's error output we're gonna want to see

@mawildoer mawildoer disabled auto-merge November 12, 2024 19:51
@mawildoer mawildoer merged commit c5338b8 into main Nov 12, 2024
6 checks passed
@mawildoer mawildoer deleted the feature/lazy_mifs_2 branch November 12, 2024 20:17
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants