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

2nd release of messaging refactor #407

Open
wants to merge 206 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 178 commits
Commits
Show all changes
206 commits
Select commit Hold shift + click to select a range
e62d846
Add submodule: pybind11
hexu33 Aug 5, 2022
4586654
Add initial abstract cpp classes declaration
hexu33 Aug 5, 2022
3e50a99
Add multiprocessing example & document for using py_wrapper
hexu33 Aug 5, 2022
c267de4
Add License header for some code files
hexu33 Aug 5, 2022
789caf0
Follow Google coding style for test/test_example.py file
hexu33 Aug 5, 2022
ed172e4
Update wrapper name to MessageInfrastructurePywrapper
hexu33 Aug 5, 2022
5265c60
Add alias for pointer type & use smart pointers
hexu33 Aug 5, 2022
5548d96
Add message_infrastructure namespace
hexu33 Aug 5, 2022
e0e09b1
add space betwen namespace & {
hexu33 Aug 5, 2022
aa2fd5d
Change py_wrapper name to message_infrastructure_py_wrapper
hexu33 Aug 5, 2022
bceccfc
Merge pull request #292 from hexu33/messaging_refactor_develop
hexu33 Aug 5, 2022
f945e60
add cpplint dependence (#296)
killight98 Aug 10, 2022
2465098
update cpplint cmd with repository arg
killight98 Aug 10, 2022
36d8cc6
Cpp APIs design for classes
hexu33 Aug 10, 2022
81052dc
Merge branch 'lava-nc:messaging_refactor_develop' into messaging_refa…
hexu33 Aug 10, 2022
b3302fc
fix template bug
hexu33 Aug 10, 2022
9b8fdd7
add classes to py_module
hexu33 Aug 10, 2022
15e8250
Convert cpp_message_infrastructure to message_infrastructure and orig…
hexu33 Aug 11, 2022
8458486
Merge branch 'messaging_refactor_develop' of https://github.com/hexu3…
hexu33 Aug 11, 2022
d37c39d
Unify class template usage
hexu33 Aug 11, 2022
8cf8496
Add abstract class details for shmem channel and ports
hexu33 Aug 11, 2022
49ae35d
Fix cpplint warnings & errors
hexu33 Aug 11, 2022
ffa07c8
Change project structure for message infrastracture
hongdami Aug 11, 2022
9096bb9
Fix cpplint errors for new project structure (#302)
hexu33 Aug 11, 2022
c78d0ed
Update message infrastructure project folder:
hongdami Aug 11, 2022
d41e412
Merge pull request #303 from hongdami/messaging_refactor_develop
hongdami Aug 12, 2022
5ca249f
Setup sub project for message_infrastructure (#305)
killight98 Aug 12, 2022
fc15bbd
Messaging refactor develop (#310)
hongdami Aug 17, 2022
4fe5a70
Convert CppIn/Out/Ref/Var-Ports (#297)
seowwj Aug 18, 2022
94265ef
Shmem Ports & Channel refactor development (#307)
hexu33 Aug 19, 2022
548e457
Update the var name and fix some feature:
hongdami Aug 30, 2022
adda93a
MultiProcessing&Actor Implementation (#321)
hongdami Sep 7, 2022
3196b6f
ShmemChannel& Port implementation (#324)
hexu33 Sep 8, 2022
b72e1fa
Middle Layer (#333)
hongdami Sep 19, 2022
9fa3d87
Merge branch 'messaging_refactor_develop' into messaging_refactor_dev…
hongdami Sep 19, 2022
7024d01
Restore ports api (#347)
killight98 Sep 19, 2022
3e76cf4
Actor management (#349)
hongdami Sep 19, 2022
03f1a29
Debug test_channel.py unit test (#346)
hexu33 Sep 19, 2022
732cbde
Fix build error (#350)
hexu33 Sep 19, 2022
eeb6458
refactor the structure of msg passing lib (#348)
killight98 Sep 20, 2022
ee6c3e9
Update ports implement (#352)
killight98 Sep 20, 2022
04a82e4
fix fail at test_channel_builder.py (#356)
killight98 Sep 21, 2022
57aba77
change void return at target_fn
killight98 Sep 21, 2022
7ffaaad
channel updates (#357)
killight98 Sep 21, 2022
e435c84
align some apis for Channel and Port
killight98 Sep 21, 2022
a94ac92
align src_port, dst_port, name api
killight98 Sep 22, 2022
bc2d026
fix bytes error at channel_builder
killight98 Sep 22, 2022
18b3f57
Remove extra print info
hexu33 Sep 22, 2022
7de3c2a
Feature/selector (#358)
hongdami Sep 22, 2022
4c1bac0
add actor ctrl into runtime_service
killight98 Sep 22, 2022
48d5b02
Skip running ci at windows and macos
killight98 Sep 23, 2022
4a7fc88
Make shm name random && Update test_channel
hexu33 Sep 23, 2022
6816855
amend test_channel.py
killight98 Sep 23, 2022
34b4c55
Set random name for shm
hexu33 Sep 23, 2022
5185a33
Use rand_r() instead of srand()&&rand(). Fix lint.
hexu33 Sep 23, 2022
b5d3805
Support sending data with block (#366)
killight98 Sep 26, 2022
6345115
Fix copy size bug for Metadata
hexu33 Sep 27, 2022
0799c6e
skip status setting when actor is stopped/terminated
killight98 Sep 27, 2022
ad05314
Fix/runtime (#377)
hongdami Sep 27, 2022
c36aee5
replace mm_pause by stl interface
killight98 Sep 27, 2022
a20b0fc
fix fail at test_runtime_service.py
killight98 Sep 27, 2022
0b0620c
fix cpplint fail
killight98 Sep 27, 2022
faa55ed
add checking status into inter loop of LoihiPyRuntimeService
killight98 Sep 27, 2022
ee00082
Amend Channel constructor to assign name for ports
hexu33 Sep 27, 2022
0324e68
Update python files with new channel constructor
hexu33 Sep 27, 2022
7704c6b
Pausing pipeline enabling (#387)
killight98 Sep 30, 2022
c2cad56
Update msg lib ut
hexu33 Sep 30, 2022
b34c50b
Fix test_multiprocessing.py ci error
hexu33 Sep 30, 2022
353ce82
Clean message infrastructure lib at 1st release (#394)
killight98 Sep 30, 2022
351d175
code lava clean (#395)
hongdami Sep 30, 2022
fce0baa
Message infrastructure ci task enabling (#402)
killight98 Oct 10, 2022
47eab8f
Remove skip labels at sdn/test_models.py (#403)
killight98 Oct 10, 2022
a9f0014
merge main
hongdami Oct 10, 2022
4faf8f7
Merge branch 'messaging_refactor_release2' into msglib/merge_v5
hongdami Oct 10, 2022
039285f
Fix unit-test dtype error
hexu33 Oct 10, 2022
ff02791
Fix lint error
hexu33 Oct 10, 2022
d9ba1f5
Merge branch 'messaging_refactor_release2' into msglib/merge_v5
hongdami Oct 10, 2022
7e1d230
test_tutorial maybe hang
hongdami Oct 10, 2022
1186ea7
Fix Dense PM dtype error
hexu33 Oct 10, 2022
a7d8da6
Change structure and restore ports file (#416)
killight98 Oct 15, 2022
aff63a6
Cpp ut ci flow (#410)
hongdami Oct 17, 2022
7c4d775
Add SocketChannel Implementaion (#424)
hexu33 Oct 17, 2022
9ecbfe5
Updates cpplint command for GitHub Actions (#429)
seowwj Oct 19, 2022
e054bbb
Cpplint release2nd (#430)
hongdami Oct 20, 2022
879fc2c
Refactor logging (#425)
intel-whye Oct 21, 2022
2e1079b
call destructor before child exit
killight98 Oct 25, 2022
02206cf
fix fd unclose and add test_file_descriptors.py (#442)
intel-whye Oct 27, 2022
6bc020f
grpc channel enabling (#426)
szc321 Oct 28, 2022
aa87031
change default sleep time to 1ns
killight98 Oct 31, 2022
1529e24
Grpc channel enhancement (#455)
szc321 Nov 1, 2022
703687f
Add UTs and fix bugs (#450)
intel-whye Nov 2, 2022
04ca7e6
Remove test_single_process_grpcchannel (#458)
killight98 Nov 2, 2022
e8f0a0a
Add ShmemBlockRecvPort (#461)
killight98 Nov 3, 2022
0f607a1
Add ENABLE_MM_PAUSE option (#462)
killight98 Nov 3, 2022
cae01b7
Add gitignore into message_infrastructure lib
killight98 Nov 3, 2022
e8e4693
GRPC enhancement (#459)
szc321 Nov 4, 2022
1e0ecaf
Msglib fast dds (#451)
hongdami Nov 7, 2022
e5d7d79
fix recv memoryleak (#468)
intel-whye Nov 8, 2022
468de95
change all NULL to nullptr (#469)
intel-whye Nov 9, 2022
17bd3ef
Unified the metadata for cpput (#466)
szc321 Nov 10, 2022
2382563
Update README.md for msg_lib to add explaination
hexu33 Nov 10, 2022
80090cd
Add comments for using std::shared_ptr instead of std::unique_ptr
hexu33 Nov 10, 2022
4751757
Check whether PyObject is created correctly
hexu33 Nov 10, 2022
19738fe
Fix sem unclose (#473)
intel-whye Nov 11, 2022
579dd07
Convert c array to metadata (#477)
intel-whye Nov 14, 2022
ab36d06
Enhance data convert at grpc channel (#479)
szc321 Nov 14, 2022
074e259
Msglib cyclone dds (#474)
hongdami Nov 16, 2022
c8c5b9e
Fix test_exception_handling.py (#467)
shaline-koh Nov 16, 2022
c36820b
ROS2 talking with DDS implementation (#486)
hexu33 Nov 16, 2022
d54ea33
disable grpc channel at msg-infr-unit-tests
killight98 Nov 17, 2022
a86a7f9
Msglib following comments from Brian (#490)
hexu33 Nov 17, 2022
aa245dd
fix fails at test_tutorials (#489)
killight98 Nov 18, 2022
5d89d8a
Fix cpplint error
hexu33 Nov 18, 2022
f8f9496
Fix/dds py delivery (#495)
hongdami Nov 22, 2022
1cf7b2e
Fix hang issue when queue size is 1 (#496)
hexu33 Nov 23, 2022
c025053
Update delivery uts (#494)
szc321 Nov 23, 2022
ba9454c
Enable CycloneDDS talking with ROS2 & add ROS2 Python package(#498)
hexu33 Nov 25, 2022
2fc4812
Temporary channel for data transfer (#503)
hongdami Nov 28, 2022
f6d40d8
Restore stop cmd between service and model (#504)
killight98 Nov 29, 2022
9e30d36
update version v0.2.1 (#505)
killight98 Nov 30, 2022
14e7f53
Merge pull request #506 from lava-nc/messaging_refactor_release2-1
killight98 Nov 30, 2022
087e1cd
Amend msglib based on comments (#507)
hongdami Nov 30, 2022
c5051dd
Fix/msglib comments (#509)
hongdami Dec 1, 2022
ff2d032
Fix test_ref_var_ports.py bug
hexu33 Dec 2, 2022
9371757
Merge/release2 1 (#517)
hongdami Dec 5, 2022
e2cd317
Merge main branch to msglib release2nd
hongdami Dec 5, 2022
b333a2c
Refactor message_infrastructure project structure for distribution (#…
killight98 Dec 9, 2022
307c060
Delete depricated files
hongdami Dec 9, 2022
ea0c7fa
Update ros example README.md
hexu33 Dec 9, 2022
1a560e7
Merge branch 'main' into messaging_refactor_release2nd
hongdami Dec 9, 2022
44531a9
Fix test_stdp_sim fail (#534)
hongdami Dec 9, 2022
29a9a01
Merge branch 'main' into messaging_refactor_release2nd
hexu33 Dec 16, 2022
4c33699
update poetry.lock
killight98 Dec 16, 2022
d3ef1ed
Update prebuild (#541)
killight98 Dec 16, 2022
07aeb77
Fix dtype bug (#564)
hexu33 Jan 6, 2023
1216c54
Merge branch 'main' into messaging_refactor_release2nd
hongdami Jan 11, 2023
b9439f2
update README.md about fastdds dependences
killight98 Jan 18, 2023
ab83110
Merge branch 'main' into messaging_refactor_release2nd
ysingh7 Jan 24, 2023
48fc8ab
Update README file for communication between ROS and DDS (#590)
hongdami Jan 30, 2023
c08fc50
Merge branch 'main' into messaging_refactor_release2nd
hongdami Jan 30, 2023
98d13b1
fix async loihi proto ut error
hongdami Jan 30, 2023
fb438cc
Fix ros2 packages bugs (#593)
hexu33 Feb 1, 2023
78a621c
Fix channel broker for Lava-loihi
hongdami Feb 7, 2023
5d75570
Fix channel broker port logic
hongdami Feb 8, 2023
deb217b
Enable Lava-loihi NxSdk flow, for test_integration_hc_lif.py
hongdami Feb 8, 2023
35fc190
Fix lava loihi DataCType Error. Note:This is a workaround, the proper…
hongdami Feb 9, 2023
049f663
Enable shape and type for ProxyPort
hongdami Feb 10, 2023
d3360fe
Squashed commit of the following:
hongdami Feb 13, 2023
4ba47f1
Enable shape and type for ProxyPort (#618)
hongdami Feb 13, 2023
bb1e39d
Integrate pure python implementation for msg passing (#610)
killight98 Feb 17, 2023
d595ea7
Merge branch 'main' into messaging_refactor_release2nd
hexu33 Feb 17, 2023
8ddf8a3
Fix py lint error
hexu33 Feb 17, 2023
be6e496
Restore running=False logic for async runtime_service
hexu33 Feb 17, 2023
6c44052
fix get/set var fail with PyRuntimeService
killight98 Feb 17, 2023
64b83e1
Reserve default size for CPy and PyC channel
hongdami Feb 20, 2023
62889b4
fix ut fail at macos (#628)
killight98 Feb 20, 2023
2fba3bd
Fix ut fail
hexu33 Feb 20, 2023
1f9bbfa
Merge branch 'main' into messaging_refactor_release2nd
hexu33 Feb 20, 2023
11c194f
Fix static analysis scan error (#631)
hexu33 Feb 21, 2023
c1e9c9d
Update get var reshape for lava-loihi
hongdami Feb 21, 2023
87cadf5
Merge branch 'main' into messaging_refactor_release2nd
killight98 Feb 22, 2023
a1c277e
Add the checking for get_var data type in runtime side
hongdami Feb 22, 2023
06639a9
Merge branch 'messaging_refactor_release2nd' of https://github.com/la…
hongdami Feb 22, 2023
7a9f6ab
Remove useless type conversion
hexu33 Feb 23, 2023
55e4b1e
Remove useless import of msglib
hexu33 Feb 24, 2023
98a11bc
Merge branch 'main' into messaging_refactor_release2nd
hexu33 Feb 24, 2023
5074e71
Fix reshape for LoihiSynapseVarModel
hongdami Feb 24, 2023
570d546
recv the data send from mgmt_channel
hongdami Mar 1, 2023
12e23d2
Fix test_channel dtype error
hexu33 Mar 2, 2023
c123d12
Workaround for lava-loihi cpplib, need to change later
hongdami Mar 2, 2023
ee952ad
fix lint error
hongdami Mar 2, 2023
e6ac534
Replace print with warnings logging
hongdami Mar 3, 2023
bb37bf0
Fix loading dds libs error after install whl (#645)
hongdami Mar 7, 2023
cc63438
Fix LoihiSynapseVarModel reshape for pure python
hongdami Mar 7, 2023
c00bd8b
Merge branch 'main' into messaging_refactor_release2nd
mgkwill Mar 8, 2023
08667c8
Merge remote-tracking branch 'origin/main' into messaging_refactor_re…
ysingh7 Mar 14, 2023
7d7355b
Fixed lint and merge issues
ysingh7 Mar 14, 2023
ffe4e85
Pure python Modify for PR643
hongdami Mar 15, 2023
33b1c55
Add description of not supporting Porbe for Socket
hexu33 Mar 21, 2023
a548323
Add base class constructor descriptions
hexu33 Mar 21, 2023
57624c0
Example/c pingpong (#650)
Shouyin Mar 21, 2023
f8a46d9
Update README for msglib
hexu33 Mar 27, 2023
0da8752
Add probe for dds (#667)
szc321 Apr 23, 2023
264362a
Implement CppSelector (#705)
szc321 Jun 2, 2023
8c233f5
Enhance performacne of cpp msg lib (#709)
killight98 Jun 5, 2023
76227f0
fix static code analysis (#710)
szc321 Jun 7, 2023
b94818c
Merge main branch into messaging_refactor_release2nd
hexu33 Jun 19, 2023
f5b9076
Solve faults after merging
hexu33 Jun 19, 2023
559f9b0
Fix static analysis issue
hexu33 Jun 19, 2023
db6f186
fix static code analysis (#720)
szc321 Jun 20, 2023
3ee0379
Fix static analysis
hexu33 Jun 20, 2023
e8a19fd
fix static analysis (#722)
szc321 Jun 21, 2023
a464897
fix code analysis (#723)
szc321 Jun 21, 2023
ede4825
fix cppcheck ignore (#724)
szc321 Jun 26, 2023
8a52b8a
merge main branch
szc321 Jul 28, 2023
6a98b39
fix bugs
szc321 Jul 31, 2023
c7f88c8
Merge branch 'main' into release2nd_merge_main_july27
Sep 27, 2023
5de3a2b
Fix merge
Sep 27, 2023
426ebea
Merge branch 'main' into messaging_refactor_release2nd
mgkwill Sep 27, 2023
60a7b72
Fix imports for watchdog
Sep 27, 2023
7828613
Fix linting
Sep 27, 2023
22106fd
Fix messaging imports
Sep 27, 2023
d1f024a
Fix channel builder watchdog import
Sep 27, 2023
365b3cc
Fix import of Channel
Sep 27, 2023
1260165
Fix WatchdogManagerBuilder import
Sep 27, 2023
9ea929e
Merge branch 'main' into messaging_refactor_release2nd
mgkwill Oct 25, 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
5 changes: 3 additions & 2 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:

- name: Build artifacts
run: |
pipx run poetry build
poetry build

- name: Archive artifacts
uses: actions/upload-artifact@v3
Expand Down Expand Up @@ -57,6 +57,7 @@ jobs:
pip install --no-input $artifact
python -c 'import lava.magma.compiler.subcompilers'
python -c 'import lava.magma.core.model'
python -c 'from lava.magma.runtime.message_infrastructure.multiprocessing import MultiProcessing'
pip uninstall -y lava-nc
deactivate
rm -rf artifact-test
Expand All @@ -69,11 +70,11 @@ jobs:
pip install --no-input $artifact
python -c 'import lava.magma.compiler.subcompilers'
python -c 'import lava.magma.core.model'
python -c 'from lava.magma.runtime.message_infrastructure.multiprocessing import MultiProcessing'
pip uninstall -y lava-nc
deactivate
rm -rf artifact-test


test-artifact-use:
name: Test Artifact With Unit Tests
runs-on: ubuntu-latest
Expand Down
39 changes: 36 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,24 @@ jobs:
- name: setup CI
uses: lava-nc/[email protected]
with:
repository: 'Lava'
repository: 'Lava'

- name: Run flakeheaven (flake8)
run: poetry run flakeheaven lint src/lava tests/
run: poetry run flakeheaven lint src/lava tests/ prebuild.py

- name: Run cpplint (cpplint)
run: |
poetry run cpplint --recursive --quiet \
--repository=src/lava/magma/runtime/_c_message_infrastructure \
--root=csrc \
--exclude=src/lava/magma/runtime/_c_message_infrastructure/csrc/channel/dds/protos \
src/lava/magma/runtime/_c_message_infrastructure/ \
src/lava/magma/runtime/_c_message_infrastructure/test/

poetry run cpplint --recursive --quiet \
--repository=src/lava/magma/runtime/_c_message_infrastructure/examples/ros2/ros_talk_with_dds_cpp \
--root=src \
src/lava/magma/runtime/_c_message_infrastructure/examples/ros2/ros_talk_with_dds_cpp/src

security-lint:
name: Security Lint Code
Expand All @@ -45,7 +59,7 @@ jobs:
with:
targets: |
src/lava/.
options: "-r --format custom --msg-template '{abspath}:{line}: {test_id}[bandit]: {severity}: {msg}'"
options: "-r --exclude build --format custom --msg-template '{abspath}:{line}: {test_id}[bandit]: {severity}: {msg}'"

unit-tests:
name: Unit Test Code + Coverage
Expand All @@ -69,3 +83,22 @@ jobs:
poetry run git lfs pull
# poetry run pytest
poetry run python -m unittest discover -s tests/ -t . -vv

msg-infr-unit-tests:
name: Message Infrastructure Unit Test
runs-on: ubuntu-latest
env:
DEBUG: 1

steps:
- uses: actions/checkout@v3
with:
lfs: true

- name: setup CI
uses: lava-nc/[email protected]
with:
repository: 'Lava'

- name: Run message infrastructure cpp unit tests
run: ./build/test/test_messaging_infrastructure
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ src/lava/utils/dataloader/mnist.npy
# Distribution / packaging
.Python
build/
log/
develop-eggs/
dist/
downloads/
Expand Down
1,143 changes: 646 additions & 497 deletions poetry.lock

Large diffs are not rendered by default.

86 changes: 86 additions & 0 deletions prebuild.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
import os
import platform
import multiprocessing
import numpy
import subprocess # nosec
import sys


def build_msg_lib() -> bool:
pure_py_env = os.getenv("LAVA_PURE_PYTHON", 0)
system_name = platform.system().lower()
if system_name != "linux":
return False
return int(pure_py_env) == 0


class CMake:
def __init__(self, sourcedir, targetdir):
self.sourcedir = os.path.abspath(sourcedir)
self.targetdir = os.path.abspath(targetdir)
self.env = os.environ.copy()
self.from_poetry = self._check_poetry()
self.from_cd_action = self._check_cd_action()
self.cmake_command = ["poetry", "run", "cmake"] \
if self.from_cd_action and self.from_poetry else ["cmake"]
self.cmake_args = []
self.build_args = []

def _check_poetry(self):
exec_code = self.env.get('_', "").rsplit('/')[-1]
if exec_code == 'poetry':
return True
return False

def _check_cd_action(self):
event_name = self.env.get('GITHUB_EVENT_NAME', '')
return event_name == 'workflow_dispatch'

def _set_cmake_path(self):
self.temp_path = os.path.join(os.path.abspath(""), "build")
if not os.path.exists(self.temp_path):
os.makedirs(self.temp_path)

def _set_cmake_args(self):
debug = int(os.environ.get("DEBUG", 0))
cfg = "Debug" if debug else "Release"
if self.from_cd_action and self.from_poetry:
python_env = subprocess.check_output(["poetry", "env", "info", "-p"]) \
.decode().strip() + "/bin/python3" # nosec # noqa
numpy_include_dir = subprocess.check_output(["poetry", "run", # nosec # noqa
"python3", "-c", "import numpy; print(numpy.get_include())"]).decode().strip() # nosec # noqa
else:
python_env = sys.executable
numpy_include_dir = numpy.get_include()
self.cmake_args += [
f"-DCMAKE_LIBRARY_OUTPUT_DIRECTORY={self.targetdir}",
f"-DPYTHON_EXECUTABLE={python_env}",
f"-DCMAKE_BUILD_TYPE={cfg}", # not used on MSVC, but no harm
]
if "CMAKE_ARGS" in os.environ:
self.cmake_args += [item for item in
os.environ["CMAKE_ARGS"].split(" ") if item]
# Set numpy include header to cpplib
self.cmake_args += [
f"-DNUMPY_INCLUDE_DIRS={numpy_include_dir}"]

# Set CMAKE_BUILD_PARALLEL_LEVEL to control the parallel build level
# across all generators.
if "CMAKE_BUILD_PARALLEL_LEVEL" not in os.environ:
self.parallel = multiprocessing.cpu_count()
self.build_args += [f"-j{self.parallel}"]

def run(self):
self._set_cmake_path()
self._set_cmake_args()
subprocess.check_call([*self.cmake_command, self.sourcedir] + self.cmake_args, cwd=self.temp_path, env=self.env) # nosec # noqa
subprocess.check_call([*self.cmake_command, "--build", "."] + self.build_args, cwd=self.temp_path, env=self.env) # nosec # noqa


if __name__ == '__main__':
base_runtime_path = "src/lava/magma/runtime/"
sourcedir = f"{base_runtime_path}_c_message_infrastructure"
targetdir = f"{base_runtime_path}message_infrastructure"
if build_msg_lib():
cmake = CMake(sourcedir, targetdir)
cmake.run()
17 changes: 14 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

[build-system]
requires = ["poetry-core>=1.2.0"]
requires = ["poetry-core>=1.2.0", "wheel", "cmake>=3.12", "numpy>=1.22.2", "pybind11[global]>=2.10.1"]
build-backend = "poetry.core.masonry.api"

[tool.poetry]
Expand All @@ -9,8 +9,12 @@ packages = [
{include = "lava", from = "src"},
{include = "tests"}
]
include = ["tutorials"]

include = ["tutorials",
"src/lava/magma/runtime/message_infrastructure/*.so",
"src/lava/magma/runtime/message_infrastructure/install/lib/lib*"]
version = "0.6.0"

description = "A Software Framework for Neuromorphic Computing"
homepage = "https://lava-nc.org/"
repository = "https://github.com/lava-nc/lava"
Expand Down Expand Up @@ -51,6 +55,7 @@ numpy = "^1.22.2"
scipy = "^1.8.0"
networkx = "<=2.8.7"
asteval = "^0.9.27"
pybind11 = {extras = ["global"], version = "^2.10.1"}

[tool.poetry.dev-dependencies]
bandit = "1.7.4"
Expand Down Expand Up @@ -82,6 +87,12 @@ autopep8 = "^1.6.0"
ipykernel = "^6.15.0"
nbformat = "^5.3.0"
nbconvert = "^7.2.0"
cpplint = "^1.6.0"
psutil = "^5.9.4"

[tool.poetry.build]
generate-setup-file = false
script = "prebuild.py"

[tool.black]
line-length = 80
Expand Down Expand Up @@ -137,7 +148,7 @@ extended_default_ignore=[] # Fix for bug while using newer flake8 ver.
format = "grouped"
max_line_length = 80
show_source = true
exclude = ["./docs/"]
exclude = ["./docs/", "./src/lava/magma/runtime/message_infrastructure/install"]

[tool.flakeheaven.plugins]
flake8-bandit = ["+*", "-S322", "-B101", "-S404", "-S602"] # Enable a plugin, disable specific checks
Expand Down
60 changes: 22 additions & 38 deletions src/lava/magma/compiler/builders/channel_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,13 @@
AbstractProcessModel
from lava.magma.compiler.builders. \
runtimeservice_builder import RuntimeServiceBuilder
from lava.magma.compiler.channels.interfaces import (
from lava.magma.runtime.message_infrastructure import (
Channel,
ChannelType,
)
from lava.magma.compiler.utils import PortInitializer
from lava.magma.runtime.message_infrastructure \
.message_infrastructure_interface import (MessageInfrastructureInterface)

from lava.magma.runtime.message_infrastructure.interfaces import ChannelType
if ty.TYPE_CHECKING:
from lava.magma.core.process.process import AbstractProcess
from lava.magma.runtime.runtime import Runtime
Expand Down Expand Up @@ -54,17 +53,12 @@ def build(
Exception
Can't build channel of type specified
"""
channel_class = messaging_infrastructure.channel_class(
channel_type=self.channel_type
)
return channel_class(
messaging_infrastructure,
self.src_port_initializer.name,
self.dst_port_initializer.name,
self.src_port_initializer.shape,
self.src_port_initializer.d_type,
self.src_port_initializer.size,
)
return messaging_infrastructure.channel(self.channel_type,
self.src_port_initializer.name,
self.dst_port_initializer.name,
self.src_port_initializer.shape,
self.src_port_initializer.d_type, # noqa: E501
self.src_port_initializer.size)


@dataclass
Expand Down Expand Up @@ -99,19 +93,14 @@ def build(
Exception
Can't build channel of type specified
"""
channel_class = messaging_infrastructure.channel_class(
channel_type=self.channel_type
)

channel_name: str = self.port_initializer.name
return channel_class(
messaging_infrastructure,
channel_name + "_src",
channel_name + "_dst",
self.port_initializer.shape,
self.port_initializer.d_type,
self.port_initializer.size,
)
return messaging_infrastructure.channel(self.channel_type,
channel_name + "_src",
channel_name + "_dst",
self.port_initializer.shape,
self.port_initializer.d_type,
self.port_initializer.size,
sync=True)


@dataclass
Expand Down Expand Up @@ -144,19 +133,14 @@ def build(
Exception
Can't build channel of type specified
"""
channel_class = messaging_infrastructure.channel_class(
channel_type=self.channel_type
)

channel_name: str = self.port_initializer.name
return channel_class(
messaging_infrastructure,
channel_name + "_src",
channel_name + "_dst",
self.port_initializer.shape,
self.port_initializer.d_type,
self.port_initializer.size,
)
return messaging_infrastructure.channel(self.channel_type,
channel_name + "_src",
channel_name + "_dst",
self.port_initializer.shape,
self.port_initializer.d_type,
self.port_initializer.size,
sync=True)


@dataclass
Expand Down
Loading