-
Notifications
You must be signed in to change notification settings - Fork 143
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Copy the python file from depricated_message_infrastructure/*.py * change multiprocessing.py to adapt interface * fix cpplint error * Update cpplib side MultiProcessing: 1. message_infrastructure_logging.h: logging for development 2. abstract_actor.h&posix_actor.cc: achieve stop function for signal 3. shm.h: Add SharedMemoryManager to cpplib 4. others: Update CMake, test and fix some type error' fix pylint error * Fix MultiProcessing Error and Cpplint Error * Remove Actor interface for python * Fix package path error * Update API Interface 1. multiprocessing.py: Fix bug for sharedmemmanager name 2. remove lava package dependency for message_infrastructure 3. multiprocessing.cc: Add shmm and actors function 4. abstract_actor.h: Modify the posix actor and interface design 5. add and update test for multiprocessing Signed-off-by: Miao, Hongda <[email protected]> * Update import from message_infrastructure: 1. Move message_interface_enum.py to message_infrastructure 2. Update import syntax 3. Others: change multiprocessing init Signed-off-by: Miao, Hongda <[email protected]> * Update test_runtime.py import Signed-off-by: Miao, Hongda <[email protected]> * Update bash setenv.sh to add message_infrastructure Signed-off-by: Miao, Hongda <[email protected]>
- Loading branch information
Showing
22 changed files
with
459 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
from MessageInfrastructurePywrapper import CppMultiProcessing | ||
from MessageInfrastructurePywrapper import SharedMemManager | ||
from MessageInfrastructurePywrapper import Actor | ||
from MessageInfrastructurePywrapper import ProcessType |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
...ntime/message_infrastructure/message_infrastructure/csrc/message_infrastructure_logging.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Copyright (C) 2021 Intel Corporation | ||
// SPDX-License-Identifier: BSD-3-Clause | ||
// See: https://spdx.org/licenses/ | ||
|
||
#ifndef MESSAGE_INFRASTRUCTURE_LOGGING_H_ | ||
#define MESSAGE_INFRASTRUCTURE_LOGGING_H_ | ||
|
||
#include <stdio.h> | ||
#define LOG_MP (1) // log for multiprocessing | ||
|
||
|
||
#define LAVA_LOG(_cond, _fmt, ...) { \ | ||
if ((_cond)) { \ | ||
printf("[CPP INFO]" _fmt, ## __VA_ARGS__); \ | ||
} \ | ||
} | ||
|
||
#define LAVA_LOG_WARN(_cond, _fmt, ...) { \ | ||
if ((_cond)) { \ | ||
printf("[CPP WARNING]" _fmt, __FUNCTION__, ## __VA_ARGS__); \ | ||
} \ | ||
} | ||
|
||
#define LAVA_LOG_ERR(_fmt, ...) { \ | ||
printf("[CPP ERROR]" _fmt, __FUNCTION__, ## __VA_ARGS__); \ | ||
} | ||
|
||
#endif // MESSAGE_INFRASTRUCTURE_LOGGING_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
src/lava/magma/runtime/message_infrastructure/message_infrastructure/csrc/posix_actor.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Copyright (C) 2021 Intel Corporation | ||
// SPDX-License-Identifier: BSD-3-Clause | ||
// See: https://spdx.org/licenses/ | ||
|
||
#include "abstract_actor.h" | ||
#include "message_infrastructure_logging.h" | ||
|
||
#include <sys/wait.h> | ||
#include <sys/types.h> | ||
|
||
namespace message_infrastructure { | ||
|
||
int PosixActor::Stop() { | ||
int status; | ||
// TODO: Add the options can be as args of the function | ||
int options = 0; | ||
int ret = waitpid(this->pid_, &status, options); | ||
|
||
if (ret < 0) { | ||
LAVA_LOG_ERR("process %d waitpid error\n", this->pid_); | ||
return -1; | ||
} | ||
|
||
// Check the status | ||
return 0; | ||
|
||
} | ||
|
||
int PosixActor::Wait() { | ||
return 0; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
src/lava/magma/runtime/message_infrastructure/message_infrastructure/factory.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Copyright (C) 2021-22 Intel Corporation | ||
# SPDX-License-Identifier: LGPL 2.1 or later | ||
# See: https://spdx.org/licenses/ | ||
from message_infrastructure.message_interface_enum import ActorType | ||
from message_infrastructure.multiprocessing import MultiProcessing | ||
|
||
"""Factory class to create the messaging infrastructure""" | ||
|
||
|
||
class MessageInfrastructureFactory: | ||
"""Creates the message infrastructure instance based on type""" | ||
@staticmethod | ||
def create(factory_type: ActorType): | ||
"""type of actor framework being chosen""" | ||
if factory_type == ActorType.MultiProcessing: | ||
return MultiProcessing() | ||
else: | ||
raise Exception("Unsupported factory_type") |
Oops, something went wrong.