Logo ROOT  
Reference Guide
Job.h
Go to the documentation of this file.
1/*
2 * Project: RooFit
3 * Authors:
4 * PB, Patrick Bos, Netherlands eScience Center, p.bos@esciencecenter.nl
5 * IP, Inti Pelupessy, Netherlands eScience Center, i.pelupessy@esciencecenter.nl
6 *
7 * Copyright (c) 2021, CERN
8 *
9 * Redistribution and use in source and binary forms,
10 * with or without modification, are permitted according to the terms
11 * listed in LICENSE (http://roofit.sourceforge.net/license.txt)
12 */
13#ifndef ROOT_ROOFIT_MultiProcess_Job_decl
14#define ROOT_ROOFIT_MultiProcess_Job_decl
15
16#include <string>
17#include <zmq.hpp>
18
19namespace RooFit {
20namespace MultiProcess {
21
22// forward declaration
23class JobManager;
24
25class Job {
26public:
27 explicit Job();
28 Job(const Job &other);
29
30 ~Job();
31
32 virtual void evaluate_task(std::size_t task) = 0;
33 virtual void update_state();
34
35 virtual void send_back_task_result_from_worker(std::size_t task) = 0;
36 virtual bool receive_task_result_on_master(const zmq::message_t &message) = 0;
37
39
40 std::size_t get_state_id();
41
42protected:
44
45 std::size_t id_;
46 std::size_t state_id_ = 0;
47
48private:
49 // do not use _manager directly, it must first be initialized! use get_manager()
50 JobManager *_manager = nullptr;
51};
52
53} // namespace MultiProcess
54} // namespace RooFit
55
56#endif // ROOT_ROOFIT_MultiProcess_Job_decl
Main point of access for all MultiProcess infrastructure.
Definition: JobManager.h:30
interface class for defining the actual work that must be done
Definition: Job.h:25
std::size_t get_state_id()
Get the current state identifier.
Definition: Job.cxx:145
std::size_t id_
Definition: Job.h:45
virtual bool receive_task_result_on_master(const zmq::message_t &message)=0
virtual void send_back_task_result_from_worker(std::size_t task)=0
std::size_t state_id_
Definition: Job.h:46
virtual void update_state()
Virtual function to update any necessary state on workers.
Definition: Job.cxx:142
JobManager * _manager
Definition: Job.h:50
JobManager * get_manager()
Get JobManager instance; create and activate if necessary.
Definition: Job.cxx:116
virtual void evaluate_task(std::size_t task)=0
void gather_worker_results()
Wait for all tasks to be retrieved for the current Job.
Definition: Job.cxx:130
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
Definition: Common.h:18