Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 lib/3rdparty/pybind11
Submodule pybind11 updated 91 files
+1 −1 .github/CONTRIBUTING.md
+9 −1 .github/dependabot.yml
+111 −74 .github/workflows/ci.yml
+3 −3 .github/workflows/configure.yml
+4 −4 .github/workflows/format.yml
+1 −1 .github/workflows/labeler.yml
+8 −8 .github/workflows/pip.yml
+7 −7 .github/workflows/upstream.yml
+21 −19 .pre-commit-config.yaml
+19 −2 .readthedocs.yml
+57 −6 CMakeLists.txt
+5 −4 README.rst
+1 −1 docs/advanced/embedding.rst
+11 −11 docs/advanced/exceptions.rst
+1 −1 docs/advanced/functions.rst
+29 −0 docs/advanced/misc.rst
+1 −1 docs/benchmark.py
+182 −2 docs/changelog.rst
+12 −4 docs/compiling.rst
+86 −42 docs/release.rst
+28 −0 docs/upgrade.rst
+142 −9 include/pybind11/cast.h
+18 −13 include/pybind11/detail/class.h
+16 −4 include/pybind11/detail/common.h
+1 −1 include/pybind11/detail/init.h
+16 −5 include/pybind11/detail/internals.h
+51 −10 include/pybind11/detail/type_caster_base.h
+3 −2 include/pybind11/eigen/tensor.h
+2 −1 include/pybind11/functional.h
+9 −1 include/pybind11/gil.h
+91 −0 include/pybind11/gil_safe_call_once.h
+157 −22 include/pybind11/numpy.h
+121 −48 include/pybind11/pybind11.h
+22 −5 include/pybind11/pytypes.h
+8 −7 include/pybind11/stl.h
+28 −56 include/pybind11/stl_bind.h
+125 −0 include/pybind11/typing.h
+1 −1 noxfile.py
+1 −1 pybind11/_version.py
+3 −1 pybind11/setup_helpers.py
+8 −11 pyproject.toml
+9 −4 tests/CMakeLists.txt
+1 −0 tests/conftest.py
+2 −2 tests/cross_module_interleaved_error_already_set.cpp
+2 −0 tests/extra_python_package/test_files.py
+4 −4 tests/pybind11_cross_module_tests.cpp
+9 −3 tests/pybind11_tests.cpp
+14 −8 tests/requirements.txt
+7 −0 tests/test_buffers.py
+2 −2 tests/test_builtin_casters.py
+7 −0 tests/test_callbacks.py
+14 −0 tests/test_class.py
+1 −2 tests/test_cmake_build/CMakeLists.txt
+3 −3 tests/test_cmake_build/installed_embed/CMakeLists.txt
+3 −3 tests/test_cmake_build/installed_function/CMakeLists.txt
+3 −3 tests/test_cmake_build/installed_target/CMakeLists.txt
+9 −3 tests/test_cmake_build/subdirectory_embed/CMakeLists.txt
+9 −3 tests/test_cmake_build/subdirectory_function/CMakeLists.txt
+9 −3 tests/test_cmake_build/subdirectory_target/CMakeLists.txt
+4 −0 tests/test_constants_and_functions.cpp
+12 −0 tests/test_custom_type_casters.cpp
+17 −0 tests/test_eigen_matrix.cpp
+8 −1 tests/test_eigen_matrix.py
+6 −3 tests/test_enum.py
+54 −13 tests/test_exceptions.cpp
+1 −1 tests/test_exceptions.h
+21 −2 tests/test_exceptions.py
+2 −2 tests/test_factory_constructors.py
+46 −0 tests/test_kwargs_and_defaults.cpp
+37 −1 tests/test_kwargs_and_defaults.py
+19 −15 tests/test_methods_and_attributes.py
+9 −3 tests/test_numpy_array.py
+29 −4 tests/test_numpy_dtypes.cpp
+11 −3 tests/test_numpy_dtypes.py
+45 −0 tests/test_python_multiple_inheritance.cpp
+35 −0 tests/test_python_multiple_inheritance.py
+26 −3 tests/test_pytypes.cpp
+57 −1 tests/test_pytypes.py
+19 −0 tests/test_sequences_and_iterators.cpp
+13 −0 tests/test_sequences_and_iterators.py
+15 −12 tests/test_smart_ptr.cpp
+12 −12 tests/test_stl.py
+80 −0 tests/test_stl_binders.cpp
+44 −6 tests/test_stl_binders.py
+2 −2 tests/test_type_caster_pyobject_ptr.cpp
+24 −1 tools/FindPythonLibsNew.cmake
+29 −1 tools/make_changelog.py
+30 −16 tools/pybind11Common.cmake
+1 −1 tools/pybind11Config.cmake.in
+77 −22 tools/pybind11NewTools.cmake
+13 −7 tools/pybind11Tools.cmake
21 changes: 19 additions & 2 deletions lib/vistle/core/shm_reference.h
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,11 @@ class ShmArrayProxy {
: m_data(arr ? arr->data() : nullptr)
#endif
, m_size(arr ? arr->size() : 0)
#ifdef NO_SHMEM
, m_handle(s_nullHandle)
#else
, m_handle(arr ? arr->handle() : s_nullHandle)
#endif
{}

ShmArrayProxy &operator=(std::nullptr_t p)
Expand Down Expand Up @@ -297,11 +301,12 @@ class ShmArrayProxy {
#ifdef NO_SHMEM
m_arr = &*ref;
m_data = nullptr;
m_handle = s_nullHandle;
#else
m_data = ref->data();
m_handle = ref->handle();
#endif
m_size = ref->size();
m_handle = ref->handle();
} else {
#ifdef NO_SHMEM
m_arr = nullptr;
Expand Down Expand Up @@ -340,6 +345,7 @@ class ShmArrayProxy {
}
const vtkm::cont::ArrayHandle<handle_type> &handle() const
{
updateFromHandle();
return m_handle;
}

Expand All @@ -361,11 +367,22 @@ class ShmArrayProxy {
if (m_data) {
return;
}
m_data = m_arr->data();
if (m_arr) {
// order is important: handle() may shrink_to_fit
m_handle = m_arr->handle();
m_data = m_arr->data();
} else {
m_handle = s_nullHandle;
m_data = nullptr;
}
#endif
}
size_t m_size = 0;
#ifdef NO_SHMEM
mutable vtkm::cont::ArrayHandle<handle_type> m_handle;
#else
vtkm::cont::ArrayHandle<handle_type> m_handle;
#endif
static inline vtkm::cont::ArrayHandle<handle_type> s_nullHandle =
vtkm::cont::make_ArrayHandle<handle_type>(static_cast<handle_type *>(nullptr), 0, vtkm::CopyFlag::Off);
};
Expand Down
102 changes: 51 additions & 51 deletions lib/vistle/manager/clustermanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -364,16 +364,16 @@ bool ClusterManager::checkBarrier(const message::uuid_t &uuid) const
}
}
#ifdef BARRIER_DEBUG
CERR << "checkBarrier " << uuid << ": #local=" << numLocal << ", #reached=" << reachedSet.size() << std::endl;
CERR << "checkBarrier " << uuid << ": #local=" << numLocal << ", #reached=" << m_reachedSet.size() << std::endl;
#endif
return reachedSet.size() == numLocal;
return m_reachedSet.size() == numLocal;
}

void ClusterManager::barrierReached(const message::uuid_t &uuid)
{
assert(m_barrierActive);
m_comm.barrier();
reachedSet.clear();
m_reachedSet.clear();
CERR << "Barrier [" << uuid << "] reached" << std::endl;
message::BarrierReached m(uuid);
m.setDestId(message::Id::MasterHub);
Expand Down Expand Up @@ -414,15 +414,15 @@ bool ClusterManager::dispatch(bool &received)
const int modId = mod.id;

// keep messages from modules that have already reached a barrier on hold
if (reachedSet.find(modId) != reachedSet.end())
if (m_reachedSet.find(modId) != m_reachedSet.end())
continue;

if (mod.hub == hubId()) {
bool recv = false;
message::Buffer buf;
std::shared_ptr<message::MessageQueue> mq;
auto it = runningMap.find(modId);
if (it != runningMap.end()) {
auto it = m_runningMap.find(modId);
if (it != m_runningMap.end()) {
it->second.update();
mq = it->second.recvQueue;
}
Expand All @@ -449,10 +449,10 @@ bool ClusterManager::dispatch(bool &received)
}
#else
std::deque<MessageWithPayload> delayed;
for (auto &id_mod: runningMap) {
for (auto &id_mod: m_runningMap) {
auto &id = id_mod.first;
auto &mod = id_mod.second;
if (reachedSet.find(id) != reachedSet.end())
if (m_reachedSet.find(id) != m_reachedSet.end())
continue;
// process messages that have been delayed because of a previous barrier
auto &incoming = mod.incomingMessages;
Expand All @@ -471,27 +471,27 @@ bool ClusterManager::dispatch(bool &received)
}
while (!incoming.empty()) {
int sender = incoming.front().buf.senderId();
bool barrierReached = reachedSet.find(sender) != reachedSet.end();
bool barrierReached = m_reachedSet.find(sender) != m_reachedSet.end();
if (!barrierReached) {
if (!Communicator::the().handleMessage(incoming.front().buf, incoming.front().payload))
done = true;
}
auto it = runningMap.find(sender);
auto it = m_runningMap.find(sender);
if (barrierReached) {
if (it != runningMap.end()) {
if (it != m_runningMap.end()) {
it->second.incomingMessages.emplace_back(incoming.front().buf, incoming.front().payload);
}
} else {
if (it != runningMap.end()) {
if (it != m_runningMap.end()) {
it->second.update();
}
}
incoming.pop_front();
}
#endif

for (auto &mod: runningMap) {
bool barrierReached = reachedSet.find(mod.first) != reachedSet.end();
for (auto &mod: m_runningMap) {
bool barrierReached = m_reachedSet.find(mod.first) != m_reachedSet.end();
if (!barrierReached)
mod.second.update();
}
Expand Down Expand Up @@ -542,7 +542,7 @@ bool ClusterManager::sendAllOthers(int excluded, const message::Message &message
}

// handle messages to modules
for (auto it = runningMap.begin(), next = it; it != runningMap.end(); it = next) {
for (auto it = m_runningMap.begin(), next = it; it != m_runningMap.end(); it = next) {
// modules might be removed during message processing
next = it;
++next;
Expand Down Expand Up @@ -590,8 +590,8 @@ bool ClusterManager::sendMessage(const int moduleId, const message::Message &mes
if (hub == hubId()) {
//CERR << "local send to " << moduleId << ": " << buf << std::endl;
if (destRank == -1 || destRank == getRank()) {
RunningMap::const_iterator it = runningMap.find(moduleId);
if (it == runningMap.end()) {
RunningMap::const_iterator it = m_runningMap.find(moduleId);
if (it == m_runningMap.end()) {
CERR << "sendMessage: module " << moduleId << " not found" << std::endl;
std::cerr << " message: " << buf << std::endl;
return true;
Expand Down Expand Up @@ -935,7 +935,7 @@ bool ClusterManager::handlePriv(const message::Spawn &spawn)
int newId = spawn.spawnId();
std::string name(spawn.getName());

Module &mod = runningMap[newId];
Module &mod = m_runningMap[newId];
std::string smqName = message::MessageQueue::createName("send", newId, m_rank);
std::string rmqName = message::MessageQueue::createName("recv", newId, m_rank);

Expand All @@ -952,8 +952,8 @@ bool ClusterManager::handlePriv(const message::Spawn &spawn)
mod.sendQueue->makeNonBlocking();

std::thread mt([this, newId, name, &mod]() {
std::string mname = "vistle:mq" + std::to_string(newId);
setThreadName(mname);
std::string tname = std::to_string(newId) + "mq:" + name;
setThreadName(tname);

for (;;) {
message::Buffer buf;
Expand Down Expand Up @@ -1035,8 +1035,8 @@ bool ClusterManager::handlePriv(const message::Spawn &spawn)
if (mod.newModule) {
boost::mpi::communicator ncomm(m_comm, boost::mpi::comm_duplicate);
std::thread t([newId, name, ncomm, &mod]() {
std::string mname = "vistle:" + name + ":" + std::to_string(newId);
setThreadName(mname);
std::string tname = std::to_string(newId) + "mn:" + name;
setThreadName(tname);
//CERR << "thread for module " << name << ":" << newId << std::endl;
mod.instance = mod.newModule(name, newId, ncomm);
if (mod.instance)
Expand All @@ -1048,9 +1048,9 @@ bool ClusterManager::handlePriv(const message::Spawn &spawn)
prep.setAsPlugin(true);
} else {
CERR << "no newModule method for module " << name << std::endl;
auto it = runningMap.find(newId);
if (it != runningMap.end()) {
runningMap.erase(it);
auto it = m_runningMap.find(newId);
if (it != m_runningMap.end()) {
m_runningMap.erase(it);
}

// synthesize ModuleExit for module that has failed to start
Expand Down Expand Up @@ -1178,9 +1178,9 @@ bool ClusterManager::handlePriv(const message::ModuleExit &moduleExit)
if (moduleExit.isForwarded()) {
sendAllOthers(mod, moduleExit, MessagePayload(), true);

RunningMap::iterator it = runningMap.find(mod);
if (it != runningMap.end()) {
runningMap.erase(it);
RunningMap::iterator it = m_runningMap.find(mod);
if (it != m_runningMap.end()) {
m_runningMap.erase(it);
} else {
//CERR << " Module [" << mod << "] not found in map" << std::endl;
}
Expand All @@ -1190,7 +1190,7 @@ bool ClusterManager::handlePriv(const message::ModuleExit &moduleExit)

const bool local = isLocal(mod);
if (local) {
if (runningMap.find(mod) == runningMap.end()) {
if (m_runningMap.find(mod) == m_runningMap.end()) {
CERR << " Module [" << mod << "] quit, but not found in running map" << std::endl;
return true;
}
Expand All @@ -1200,9 +1200,9 @@ bool ClusterManager::handlePriv(const message::ModuleExit &moduleExit)
m_outputObjects.erase(port);
}

ModuleSet::iterator it = reachedSet.find(mod);
if (it != reachedSet.end()) {
reachedSet.erase(it);
ModuleSet::iterator it = m_reachedSet.find(mod);
if (it != m_reachedSet.end()) {
m_reachedSet.erase(it);
} else {
if (m_barrierActive && checkBarrier(m_barrierUuid))
barrierReached(m_barrierUuid);
Expand All @@ -1223,8 +1223,8 @@ bool ClusterManager::handlePriv(const message::ModuleExit &moduleExit)
bool ClusterManager::handlePriv(const message::Execute &exec)
{
assert(exec.getModule() >= Id::ModuleBase);
RunningMap::iterator i = runningMap.find(exec.getModule());
if (i == runningMap.end()) {
RunningMap::iterator i = m_runningMap.find(exec.getModule());
if (i == m_runningMap.end()) {
CERR << "did not find module to be executed: " << exec.getModule() << std::endl;
return true;
}
Expand Down Expand Up @@ -1321,8 +1321,8 @@ bool ClusterManager::handlePriv(const message::Execute &exec)
bool ClusterManager::handlePriv(const message::CancelExecute &cancel)
{
assert(cancel.getModule() >= Id::ModuleBase);
RunningMap::iterator i = runningMap.find(cancel.getModule());
if (i == runningMap.end()) {
RunningMap::iterator i = m_runningMap.find(cancel.getModule());
if (i == m_runningMap.end()) {
CERR << "did not find module to cancel execution: " << cancel.getModule() << std::endl;
return true;
}
Expand Down Expand Up @@ -1470,8 +1470,8 @@ bool ClusterManager::addObjectDestination(const message::AddObject &addObj, Obje
if (!obj) {
// block messages of receiving module until remote object is available
assert(!isLocal(addObj.senderId()));
auto it = runningMap.find(destId);
if (it != runningMap.end()) {
auto it = m_runningMap.find(destId);
if (it != m_runningMap.end()) {
Communicator::the().dataManager().requestObject(
addObj, addObj.objectName(), [this, addObj, addObj2, broadcast](Object::const_ptr newobj) mutable {
auto obj = addObj.getObject();
Expand Down Expand Up @@ -1630,9 +1630,9 @@ bool ClusterManager::handlePriv(const message::AddObjectCompleted &complete)
bool ClusterManager::handlePriv(const message::ExecutionProgress &prog)
{
const bool localSender = idToHub(prog.senderId()) == hubId();
RunningMap::iterator i = runningMap.find(prog.senderId());
RunningMap::iterator i = m_runningMap.find(prog.senderId());
ClusterManager::Module *mod = nullptr;
if (i == runningMap.end()) {
if (i == m_runningMap.end()) {
assert(localSender == false);
} else {
mod = &i->second;
Expand Down Expand Up @@ -1816,8 +1816,8 @@ bool ClusterManager::handlePriv(const message::ExecutionProgress &prog)
if (isLocal(destId)) {
if (it->second.schedulingPolicy == message::SchedulingPolicy::LazyGang) {
broadcast = true;
RunningMap::iterator i = runningMap.find(destId);
assert(i != runningMap.end());
RunningMap::iterator i = m_runningMap.find(destId);
assert(i != m_runningMap.end());
auto &destMod = i->second;

assert(destMod.prepared);
Expand Down Expand Up @@ -1889,7 +1889,7 @@ bool ClusterManager::handlePriv(const message::Busy &busy)
{
if (getRank() == 0) {
int id = busy.senderId();
auto &mod = runningMap[id];
auto &mod = m_runningMap[id];
if (mod.busyCount == 0) {
message::Buffer buf(busy);
buf.setDestId(Id::UI);
Expand All @@ -1906,7 +1906,7 @@ bool ClusterManager::handlePriv(const message::Idle &idle)
{
if (getRank() == 0) {
int id = idle.senderId();
auto &mod = runningMap[id];
auto &mod = m_runningMap[id];
--mod.busyCount;
if (mod.busyCount == 0) {
message::Buffer buf(idle);
Expand All @@ -1931,9 +1931,9 @@ bool ClusterManager::handlePriv(const message::SetParameter &setParam)
m_compressionSettingsValid = false;
int sender = setParam.senderId();
int dest = setParam.destId();
RunningMap::iterator i = runningMap.find(setParam.getModule());
RunningMap::iterator i = m_runningMap.find(setParam.getModule());
Module *mod = nullptr;
if (i == runningMap.end()) {
if (i == m_runningMap.end()) {
if (isLocal(setParam.getModule()) && setParam.getModule() != message::Id::Config) {
CERR << "did not find module for SetParameter: " << setParam.getModule() << ": " << setParam << std::endl;
}
Expand Down Expand Up @@ -2034,12 +2034,12 @@ bool ClusterManager::handlePriv(const message::BarrierReached &barrReached)

if (Id::isModule(barrReached.senderId())) {
assert(isLocal(barrReached.senderId()));
reachedSet.insert(barrReached.senderId());
m_reachedSet.insert(barrReached.senderId());
if (checkBarrier(m_barrierUuid)) {
barrierReached(m_barrierUuid);
#ifdef BARRIER_DEBUG
} else {
CERR << "BARRIER: reached by " << reachedSet.size() << "/" << numRunning() << std::endl;
CERR << "BARRIER: reached by " << m_reachedSet.size() << "/" << numRunning() << std::endl;
#endif
}
} else if (barrReached.senderId() == Id::MasterHub) {
Expand Down Expand Up @@ -2202,7 +2202,7 @@ void ClusterManager::replayMessages()
int ClusterManager::numRunning() const
{
int n = 0;
for (auto &m: runningMap) {
for (auto &m: m_runningMap) {
int state = m_stateTracker.getModuleState(m.first);
if ((state & StateObserver::Initialized) &&
/* !(state & StateObserver::Killed) && */ !(state & StateObserver::Quit))
Expand All @@ -2215,8 +2215,8 @@ bool ClusterManager::isReadyForExecute(int modId) const
{
//CERR << "checking whether " << modId << " can be executed: ";

auto i = runningMap.find(modId);
if (i == runningMap.end()) {
auto i = m_runningMap.find(modId);
if (i == m_runningMap.end()) {
//CERR << "module " << modId << " not found" << std::endl;
return false;
}
Expand Down
4 changes: 2 additions & 2 deletions lib/vistle/manager/clustermanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ class V_MANAGEREXPORT ClusterManager {
bool haveDelayed() const;
};
typedef std::unordered_map<int, Module> RunningMap;
RunningMap runningMap;
RunningMap m_runningMap;
int numRunning() const;
bool isReadyForExecute(int modId) const;
int m_numExecuting = 0;
Expand All @@ -211,7 +211,7 @@ class V_MANAGEREXPORT ClusterManager {
message::uuid_t m_barrierUuid;
int m_reachedBarriers;
typedef std::set<int> ModuleSet;
ModuleSet reachedSet;
ModuleSet m_reachedSet;

std::vector<int> m_numTransfering;
long m_totalNumTransferring = 0;
Expand Down
2 changes: 1 addition & 1 deletion lib/vistle/module/module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2662,7 +2662,7 @@ bool Module::compute()
m_tasks.push_back(task);

std::unique_lock<std::mutex> guard(task->m_mutex);
auto tname = name() + ":Block:" + std::to_string(m_tasks.size());
auto tname = std::to_string(id()) + "b" + std::to_string(m_tasks.size()) + ":" + name();
task->m_future = std::async(std::launch::async, [this, tname, task] {
PROF_FUNC();
setThreadName(tname);
Expand Down
Loading