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
4 changes: 2 additions & 2 deletions cmake/VistleConfig.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#Use this tho find vistle components
#e.g. with: find_package(Vistle REQUIRED COMPONENTS sensei sensei_vtk boost_mpi)
#Use this to find vistle components
#e.g. with: find_package(Vistle REQUIRED COMPONENTS insitu_adapter vtk boost_mpi)
macro(vistle_find_component comp req)

set(_VISTLE_REQUIRED)
Expand Down
2 changes: 1 addition & 1 deletion lib/vistle/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ vistle_target_link_libraries(
PUBLIC
vtkm::cont)
target_link_libraries(vistle_core PRIVATE vistle_config)
target_link_libraries(vistle_core PUBLIC Eigen3::Eigen)
target_link_libraries(vistle_core PRIVATE Eigen3::Eigen)

if(ZFP_FOUND)
target_compile_definitions(vistle_core PRIVATE HAVE_ZFP)
Expand Down
3 changes: 2 additions & 1 deletion lib/vistle/insitu/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ add_subdirectory(module) #depends on core and message

add_subdirectory(libsim)

add_subdirectory(sensei)
add_subdirectory(adapter)
add_subdirectory(catalyst2)
32 changes: 32 additions & 0 deletions lib/vistle/insitu/adapter/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
set(ADAPTER_SOURCES metaData.cpp objectRetriever.cpp adapter.cpp)
set(ADAPTER_HEADER exception.h export.h metaData.h objectRetriever.h adapter.h)

vistle_add_library(vistle_insitu_adapter EXPORT ${ADAPTER_SOURCES} ${ADAPTER_HEADER})

vistle_target_link_libraries(
vistle_insitu_adapter
PRIVATE
Boost::boost
PRIVATE
Boost::serialization
PUBLIC
${BOOST_MPI}
PUBLIC
vistle_core
PRIVATE
vistle_util
PRIVATE
vistle_util_mpi
PRIVATE
Threads::Threads
PUBLIC
vistle_insitu_core
PUBLIC
vistle_insitu_message
PUBLIC
MPI::MPI_C)
if(NOT VISTLE_MULTI_PROCESS)
vistle_target_link_libraries(vistle_insitu_adapter PRIVATE vistle_clustermanager)
target_compile_definitions(vistle_insitu_adapter INTERFACE VISTLE_SINGLE_PROCESS)
endif()
target_compile_features(vistle_insitu_adapter PUBLIC cxx_std_17)
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "sensei.h"
#include "adapter.h"
#include "exception.h"

#include <vistle/insitu/core/attachVistleShm.h>
Expand All @@ -24,15 +24,13 @@
#include <vistle/manager/manager.h>
#endif // MODULE_THREAD

#define CERR std::cerr << "[" << m_rank << "/" << m_mpiSize << " ] SenseiAdapter: "
#define CERR std::cerr << "[" << m_rank << "/" << m_mpiSize << " ] InSituAdapter: "
using std::endl;
using namespace vistle::insitu;
using namespace vistle::insitu::sensei;
using namespace vistle::insitu::message;

namespace vistle {
namespace insitu {
namespace sensei {
namespace detail {

int getRank(MPI_Comm Comm)
Expand All @@ -52,16 +50,15 @@ struct Internals {
std::vector<message::IntParam> moduleParams{{"frequency", 1}, {"keep_timesteps", false}};
};
} // namespace detail
} // namespace sensei
} // namespace insitu
} // namespace vistle

Adapter::Adapter(bool paused, MPI_Comm Comm, MetaData &&meta, ObjectRetriever cbs, const std::string &vistleRoot,
Adapter::Adapter(bool paused, MPI_Comm comm, MetaData &&meta, ObjectRetriever cbs, const std::string &vistleRoot,
const std::string &vistleBuildType, const std::string &options)
: m_callbacks(std::move(cbs)), m_metaData(std::move(meta)), m_internals(new detail::Internals{Comm}), m_comm(Comm)
: m_callbacks(std::move(cbs)), m_metaData(std::move(meta)), m_internals(new detail::Internals{comm}), m_comm(comm)
{
MPI_Comm_rank(Comm, &m_rank);
MPI_Comm_size(Comm, &m_mpiSize);
MPI_Comm_rank(comm, &m_rank);
MPI_Comm_size(comm, &m_mpiSize);
m_commands["run_simulation"] = !paused; // if true run else wait
// exit by returning false from execute
dumpConnectionFile(comm);
Expand Down Expand Up @@ -136,7 +133,7 @@ bool Adapter::stillConnected()
while (recvAndHandeMessage()) {
} // catch newest state
if (wasConnected && !m_connected) {
CERR << "sensei controller disconnected" << endl;
CERR << "in situ module disconnected" << endl;
return false;
}
return true;
Expand All @@ -159,7 +156,7 @@ bool Adapter::waitedForModuleCommands()
{
recvAndHandeMessage(true);
if (!m_connected) {
CERR << "sensei controller disconnected" << endl;
CERR << "in situ module disconnected" << endl;
return false;
}
}
Expand All @@ -174,7 +171,7 @@ bool Adapter::haveToProcessTimestep(size_t timestep)
void Adapter::processData()
{
if (!m_internals->sendMessageQueue) {
CERR << "VistleSenseiAdapter can not add vistle object: sendMessageQueue = "
CERR << "in situ adapter can not add vistle object: sendMessageQueue = "
"null"
<< endl;
return;
Expand All @@ -201,10 +198,10 @@ bool Adapter::finalize()
{
CERR << "Finalizing" << endl;
double averageTimeSpendInExecute = 0;
MPI_Reduce(&m_timeSpendInExecute, &averageTimeSpendInExecute, 1, MPI_DOUBLE, MPI_SUM, 0, comm);
MPI_Reduce(&m_timeSpendInExecute, &averageTimeSpendInExecute, 1, MPI_DOUBLE, MPI_SUM, 0, m_comm);
auto simulationTime = Clock::time() - m_startTime;
double averageSimTime = 0;
MPI_Reduce(&simulationTime, &averageSimTime, 1, MPI_DOUBLE, MPI_SUM, 0, comm);
MPI_Reduce(&simulationTime, &averageSimTime, 1, MPI_DOUBLE, MPI_SUM, 0, m_comm);
if (m_rank == 0) {
std::cerr << "simulation took " << averageSimTime / m_mpiSize << "s" << std::endl;
std::cerr << "avarage time spend in execute: " << averageTimeSpendInExecute / m_mpiSize << "s" << std::endl;
Expand Down Expand Up @@ -247,7 +244,7 @@ bool Adapter::objectRequested(const std::string &name, const std::string &meshNa
m_internals->moduleInfo.isPortConnected(portName(meshName, name));
}

void Adapter::dumpConnectionFile(MPI_Comm Comm)
void Adapter::dumpConnectionFile(MPI_Comm comm)
{
std::vector<std::string> names;
boost::mpi::gather(boost::mpi::communicator(comm, boost::mpi::comm_attach), m_internals->messageHandler->name(),
Expand All @@ -256,7 +253,7 @@ void Adapter::dumpConnectionFile(MPI_Comm Comm)
if (!vistle::filesystem::exists(vistle::directory::configHome())) {
vistle::filesystem::create_directory(vistle::directory::configHome());
}
std::ofstream outfile(directory::configHome() + "/sensei.vistle");
std::ofstream outfile(directory::configHome() + "/insitu.vistle");
for (int i = 0; i < m_mpiSize; i++) {
outfile << std::to_string(i) << " " << names[i] << endl;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef VISTLE_SENSEI_H
#define VISTLE_SENSEI_H
#ifndef VISTLE_INSITU_ADAPTER_H
#define VISTLE_INSITU_ADAPTER_H

#include "export.h"
#include "metaData.h"
Expand All @@ -15,12 +15,10 @@ namespace insitu {
namespace message {
class Message;
} // namespace message
namespace sensei {
namespace detail {
struct Internals;
}
class V_SENSEIEXPORT Adapter //: public SenseiInterface
{
class V_INSITUADAPTEREXPORT Adapter {
public:
Adapter(bool paused, MPI_Comm Comm, MetaData &&meta, ObjectRetriever cbs, const std::string &vistleRoot,
const std::string &vistleBuildType, const std::string &options);
Expand Down Expand Up @@ -53,7 +51,6 @@ class V_SENSEIEXPORT Adapter //: public SenseiInterface
int m_generation = 0;
// mpi info
int m_rank = -1, m_mpiSize = 0;
MPI_Comm comm = MPI_COMM_WORLD;
double m_timeSpendInExecute = 0;
double m_startTime = 0;
std::map<std::string, bool> m_commands; // commands and their current state
Expand All @@ -71,7 +68,7 @@ class V_SENSEIEXPORT Adapter //: public SenseiInterface
void calculateUsedData();
bool objectRequested(const std::string &name, const std::string &meshName = "");

void dumpConnectionFile(MPI_Comm Comm); // create a file in which the sensei
void dumpConnectionFile(MPI_Comm Comm); // create a file in which the in situ
// module can find the connection info
bool recvAndHandeMessage(bool blocking = false);
bool initModule(const vistle::insitu::message::Message &msg);
Expand All @@ -85,9 +82,8 @@ class V_SENSEIEXPORT Adapter //: public SenseiInterface
void addCommands();
void addPorts();
};
} // namespace sensei

} // namespace insitu
} // namespace vistle

#endif // !VISTLE_SENSEI_H
#endif // !VISTLE_INSITU_ADAPTER_H
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
#ifndef VISTLE_SENSEI_EXCEPTION_H
#define VISTLE_SENSEI_EXCEPTION_H
#ifndef VISTLE_ADAPTER_EXCEPTION_H
#define VISTLE_ADAPTER_EXCEPTION_H
#include <vistle/insitu/core/exception.h>
namespace vistle {
namespace insitu {
namespace sensei {
struct Exception: public InsituException {
Exception() { *this << "VistleSensei: "; };
Exception() { *this << "VistleInSitu: "; };
};
} // namespace sensei
} // namespace insitu
} // namespace vistle
#endif
18 changes: 18 additions & 0 deletions lib/vistle/insitu/adapter/export.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#ifndef VISTLE_ADAPTER_EXPORT_H
#define VISTLE_ADAPTER_EXPORT_H

#include <vistle/util/export.h>

#if defined(vistle_insitu_adapter_EXPORTS)
#define V_INSITUADAPTEREXPORT V_EXPORT
#else
#define V_INSITUADAPTEREXPORT V_IMPORT
#endif

#if defined(vistle_insitu_adapter_EXPORTS)
#define V_INSITUADAPTER_TEMPLATE_EXPORT V_TEMPLATE_EXPORT
#else
#define V_INSITUADAPTER_TEMPLATE_EXPORT V_TEMPLATE_IMPORT
#endif

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <cassert>
#include <iostream>

using namespace vistle::insitu::sensei;
using namespace vistle::insitu;

MetaMesh::MetaMesh(const std::string &name): m_name(name)
{}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef VISTLE_INSITU_SENSEI_METADATA_H
#define VISTLE_INSITU_SENSEI_METADATA_H
#ifndef VISTLE_INSITU_ADAPTER_METADATA_H
#define VISTLE_INSITU_ADAPTER_METADATA_H

#include "export.h"

Expand All @@ -9,9 +9,8 @@

namespace vistle {
namespace insitu {
namespace sensei {

class V_SENSEIEXPORT MetaMesh {
class V_INSITUADAPTEREXPORT MetaMesh {
public:
typedef std::set<std::string>::const_iterator Iter;
MetaMesh(const std::string &name);
Expand All @@ -28,7 +27,7 @@ class V_SENSEIEXPORT MetaMesh {
std::set<std::string> m_variables;
};

class V_SENSEIEXPORT
class V_INSITUADAPTEREXPORT
MetaData { // This contains the names of all meshes and their linked data fields and must be provided before the connection to
// Vistle
public:
Expand All @@ -44,7 +43,6 @@ class V_SENSEIEXPORT
std::set<MetaMesh> m_meshes;
};

} // namespace sensei
} // namespace insitu
} // namespace vistle
#endif
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#include "objectRetriever.h"

using namespace vistle::insitu;
using namespace vistle::insitu::sensei;

ObjectRetriever::ObjectRetriever(std::function<PortAssignedObjectList(const MetaData &usedData)> getData)
: m_getData(getData)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef VISTLE_SENSEI_OBJECT_RETREIVER_H
#define VISTLE_SENSEI_OBJECT_RETREIVER_H
#ifndef VISTLE_INSITU_OBJECT_RETREIVER_H
#define VISTLE_INSITU_OBJECT_RETREIVER_H

#include "export.h"
#include "metaData.h"
Expand All @@ -9,12 +9,11 @@

namespace vistle {
namespace insitu {
namespace sensei {

class V_SENSEIEXPORT ObjectRetriever { // callbacks to retrieve Grids
// and Arrays from sensei
class V_INSITUADAPTEREXPORT ObjectRetriever { // callbacks to retrieve Grids
// and Arrays from simulation
public:
struct V_SENSEIEXPORT PortAssignedObject {
struct V_INSITUADAPTEREXPORT PortAssignedObject {
PortAssignedObject() = default;
PortAssignedObject(const std::string &gridName, vistle::Object::const_ptr obj);
PortAssignedObject(const std::string &gridName, const std::string &varName, vistle::Object::const_ptr obj);
Expand All @@ -34,7 +33,6 @@ class V_SENSEIEXPORT ObjectRetriever { // callbacks to retrieve Grids
std::function<PortAssignedObjectList(const MetaData &usedData)> m_getData;
};

} // namespace sensei
} // namespace insitu
} // namespace vistle

Expand Down
22 changes: 22 additions & 0 deletions lib/vistle/insitu/catalyst2/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# When implementing the Catalyst API, as against using
# it to invoke Catalyst, one must use the component
# ``SDK`` in ``find_package`` call. This ensures that all necessary
# libraries etc. are available.
find_package(catalyst COMPONENTS SDK)
if(NOT catalyst_FOUND)
return()
endif()

# use this function call to create a Catalyst API implementation.
catalyst_implementation(
TARGET
catalyst-vistle
NAME
vistle
SOURCES
vistleCatalystImpl.cpp
conduitToVistle.cpp
conduitToVistle.h)

target_link_libraries(catalyst-vistle PRIVATE vistle_insitu_adapter)
target_compile_definitions(catalyst-vistle PRIVATE VISTLE_ROOT="${CMAKE_BINARY_DIR}" VISTLE_BUILD_TYPE="")
12 changes: 12 additions & 0 deletions lib/vistle/insitu/catalyst2/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Catalyst II implementation for Vistle
-------------------------------------

usage:

send conduit node with vistle conection details in catalyst_initialize
an example node can be found in vistleCatalystConfig.yaml
under "catalyst/mpi_comm" the mpi communicator can be passed to Vistle.

For a multi process Vistle:
export MPISIZE and MPIHOSTS/MPIHOSTFILE according to the simulation
start Vistle and the InSituReader module
Loading