Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
JobManager.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_JobManager
14#define ROOT_ROOFIT_MultiProcess_JobManager
15
17
18#include <memory> // unique_ptr
19#include <map>
20
21namespace RooFit {
22namespace MultiProcess {
23
24// forward definitions
25class ProcessManager;
26class Messenger;
27class Queue;
28class Job;
29
31public:
32 static JobManager *instance();
33 static bool is_instantiated();
34
36
37 static std::size_t add_job_object(Job *job_object);
38 static Job *get_job_object(std::size_t job_object_id);
39 static bool remove_job_object(std::size_t job_object_id);
40
42 Messenger &messenger() const;
43 Queue &queue() const;
44
45 void retrieve(std::size_t requesting_job_id);
46
47 void activate();
48 bool is_activated() const;
49
50private:
51 explicit JobManager(std::size_t N_workers);
52
53 std::unique_ptr<ProcessManager> process_manager_ptr_;
54 std::unique_ptr<Messenger> messenger_ptr_;
55 std::unique_ptr<Queue> queue_ptr_;
56 bool activated_ = false;
57
58 static std::map<std::size_t, Job *> job_objects_;
59 static std::size_t job_counter_;
60 static std::unique_ptr<JobManager> instance_;
61};
62
63} // namespace MultiProcess
64} // namespace RooFit
65
66#endif // ROOT_ROOFIT_MultiProcess_JobManager
Main point of access for all MultiProcess infrastructure.
Definition JobManager.h:30
std::unique_ptr< Messenger > messenger_ptr_
Definition JobManager.h:54
std::unique_ptr< Queue > queue_ptr_
Definition JobManager.h:55
static std::size_t add_job_object(Job *job_object)
static JobManager * instance()
static std::size_t job_counter_
Definition JobManager.h:59
static Job * get_job_object(std::size_t job_object_id)
ProcessManager & process_manager() const
std::unique_ptr< ProcessManager > process_manager_ptr_
Definition JobManager.h:53
static std::map< std::size_t, Job * > job_objects_
Definition JobManager.h:58
static bool remove_job_object(std::size_t job_object_id)
static std::unique_ptr< JobManager > instance_
Definition JobManager.h:60
void retrieve(std::size_t requesting_job_id)
Retrieve results for a Job.
void activate()
Start queue and worker loops on child processes.
interface class for defining the actual work that must be done
Definition Job.h:25
Manages ZeroMQ sockets and wraps send and receive calls.
Fork processes for queue and workers.
Keeps a queue of tasks for workers and manages the queue process through its event loop.
Definition Queue.h:24
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
Definition Common.h:18