20 #if !defined(__MITSUBA_CORE_SCHED_REMOTE_H_)
21 #define __MITSUBA_CORE_SCHED_REMOTE_H_
27 #define MTS_DEFAULT_PORT 7554
31 #define MTS_BACKLOG_FACTOR 3
36 #define MTS_CONTINUE_FACTOR 2
40 class RemoteWorkerReader;
60 inline const std::string &
getNodeName()
const {
return m_nodeName; }
69 virtual
void signalResourceExpiration(
int id);
70 virtual
void signalProcessCancellation(
int id);
71 virtual
void signalProcessTermination(
int id);
72 virtual
void start(
Scheduler *scheduler,
int workerIndex,
int coreOffset);
75 inline
void signalCompletion() {
78 m_finishCond->signal();
115 std::vector<Thread *> m_joinThreads;
120 Scheduler::Item m_schedItem;
153 if (m_empty.empty()) {
154 wu = m_wp->createWorkUnit();
166 m_full.push_back(wu);
198 friend class RemoteProcess;
217 const std::string &nodeName,
Stream *stream,
bool detach);
242 void sendWorkResult(
int id,
const WorkResult *result,
bool cancelled);
243 void sendCancellation(
int id,
int numLost);
246 std::string m_nodeName;
249 std::map<int, RemoteProcess *> m_processes;
250 std::map<int, int> m_resources;
WorkUnit * getEmptyWorkUnit()
Get an empty work unit from the process (or create one)
Definition: sched_remote.h:150
Definition: sched_remote.h:226
void setDone()
Mark the process as finished.
Definition: sched_remote.h:170
virtual EStatus generateWork(WorkUnit *unit, int worker)=0
Generate a piece of work.
virtual void handleCancellation()
Called when the parallel process is canceled by Scheduler::cancel().
std::set< std::string > m_plugins
Definition: sched_remote.h:91
Network processing communication backend.
Definition: sched_remote.h:197
Definition: sched_remote.h:231
ref< MemoryStream > m_memStream
Definition: sched_remote.h:83
virtual void run()=0
The thread's run method.
virtual void processResult(const WorkResult *result, bool cancelled)=0
Called whenever a work unit has been completed.
Definition: sched_remote.h:235
EStatus
Return codes used by generateWork() and getReturnStatus()
Definition: sched.h:204
Parallel process facade used to insert work units from a remote scheduler into the local one...
Definition: sched_remote.h:129
#define MTS_EXPORT_CORE
Definition: getopt.h:29
Abstract parallelizable task.
Definition: sched.h:197
Definition: sched_remote.h:227
std::set< int > m_processes
Definition: sched_remote.h:90
Simple RAII-style locking of a Mutex. On construction it locks the mutex and unlocks it on destructio...
Definition: lock.h:170
Abstract work result – represents the result of a processed WorkUnit instance.
Definition: sched.h:80
Definition: sched_remote.h:234
std::string m_nodeName
Definition: sched_remote.h:92
Definition: sched_remote.h:224
Abstract work unit – represents a small amount of information that encodes part of a larger processin...
Definition: sched.h:47
EMessage
Definition: sched_remote.h:221
Definition: sched_remote.h:232
ref< Mutex > m_mutex
Definition: sched_remote.h:81
Abstract seekable stream class.
Definition: stream.h:58
#define MTS_DECLARE_CLASS()
This macro must be used in the initial definition in classes that derive from Object.
Definition: class.h:158
Reference counting helper.
Definition: ref.h:40
std::set< int > m_resources
Definition: sched_remote.h:89
Communication helper thread required by RemoteWorker.
Definition: sched_remote.h:101
Cross-platform thread implementation.
Definition: thread.h:34
Acquires work from the scheduler and forwards it to a processing node reachable through a Stream...
Definition: sched_remote.h:50
ELogLevel
Available Log message types.
Definition: formatter.h:28
ref< Stream > m_stream
Definition: sched_remote.h:84
virtual ref< WorkProcessor > createWorkProcessor() const =0
Create an instance of the algorithm responsible for executing the work units of this parallel process...
void shutdown()
Definition: sched_remote.h:106
Definition: sched_remote.h:233
void putFullWorkUnit(WorkUnit *wu)
Make a full work unit available to the process.
Definition: sched_remote.h:164
const std::string & getNodeName() const
Return the name of the node on the other side.
Definition: sched_remote.h:60
Definition: sched_remote.h:230
size_t m_inFlight
Definition: sched_remote.h:93
Base class of all worker implementations.
Definition: sched.h:673
ref< ConditionVariable > m_finishCond
Definition: sched_remote.h:82
Definition: sched_remote.h:225
Centralized task scheduler implementation.
Definition: sched.h:351
Definition: sched_remote.h:229
Definition: sched_remote.h:228
Thin wrapper around the recursive boost thread lock.
Definition: lock.h:34
Abstract work processor – takes work units and turns them into WorkResult instances.
Definition: sched.h:118
ref< RemoteWorkerReader > m_reader
Definition: sched_remote.h:85
Definition: sched_remote.h:223