VTK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
vtkComputingResources.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkComputingResources.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14  =========================================================================*/
15 /*-------------------------------------------------------------------------
16  Copyright (c) 2008, 2009 by SCI Institute, University of Utah.
17 
18  This is part of the Parallel Dataflow System originally developed by
19  Huy T. Vo and Claudio T. Silva. For more information, see:
20 
21  "Parallel Dataflow Scheme for Streaming (Un)Structured Data" by Huy
22  T. Vo, Daniel K. Osmari, Brian Summa, Joao L.D. Comba, Valerio
23  Pascucci and Claudio T. Silva, SCI Institute, University of Utah,
24  Technical Report #UUSCI-2009-004, 2009.
25 
26  "Multi-Threaded Streaming Pipeline For VTK" by Huy T. Vo and Claudio
27  T. Silva, SCI Institute, University of Utah, Technical Report
28  #UUSCI-2009-005, 2009.
29  -------------------------------------------------------------------------*/
40 #ifndef __vtkComputingResources_h
41 #define __vtkComputingResources_h
42 
43 #include "vtkCommonExecutionModelModule.h" // For export macro
44 #include "vtkObject.h"
45 
46 class vtkInformation;
49 
50 class VTKCOMMONEXECUTIONMODEL_EXPORT vtkComputingResources : public vtkObject
51 {
52 public:
53  static vtkComputingResources* New();
54  vtkTypeMacro(vtkComputingResources,vtkObject);
55  void PrintSelf(ostream &os, vtkIndent indent);
56 
58  void Clear();
59 
62  void ObtainMinimumResources();
63 
65  void ObtainMaximumResources();
66 
67  //BTX
69 
71  vtkProcessingUnitResource *GetResourceFor(int processingUnit);
72  //ETX
74 
78  void Deploy(vtkThreadedStreamingPipeline *exec, vtkInformation *info);
79 
82  bool Reserve(vtkComputingResources *res);
83 
85  void Collect(vtkComputingResources *res);
86 
87 protected:
90 
91 //BTX
92  class implementation;
93  implementation* const Implementation;
94 //ETX
95 private:
96  vtkComputingResources(const vtkComputingResources&); // Not implemented.
97  void operator=(const vtkComputingResources&); // Not implemented.
98 };
99 
100 //BTX
101 //----------------------------------------------------------------------------
102 // A basic resource class. It is put here for later inheritance for
103 // any type of computing, e.g. CPU/GPU.
104 //----------------------------------------------------------------------------
106 public:
108 
110  virtual int ProcessingUnit() = 0;
111 
113  virtual bool HasResource() = 0;
114 
116  virtual void Clear() = 0;
117 
119  virtual void ObtainMinimum() = 0;
120 
122  virtual void ObtainMaximum() = 0;
123 
127  virtual void IncreaseByRatio(float ratio, vtkProcessingUnitResource *refResource) = 0;
128 
131  virtual void AllocateFor(vtkThreadedStreamingPipeline *exec) = 0;
132 
134  virtual bool CanAccommodate(vtkProcessingUnitResource *refResource) = 0;
135 
137  virtual void Reserve(vtkProcessingUnitResource *refResource) = 0;
138 
140 
141  virtual void Collect(vtkProcessingUnitResource *refResource) = 0;
142 };
143 //ETX
145 
146 #endif
Executive supporting multi-threads.
virtual void ObtainMaximum()=0
virtual bool HasResource()=0
virtual int ProcessingUnit()=0
virtual void Clear()=0
Definition of computing resource (threads/kernels)
virtual bool CanAccommodate(vtkProcessingUnitResource *refResource)=0
virtual void AllocateFor(vtkThreadedStreamingPipeline *exec)=0
virtual void ObtainMinimum()=0
virtual void Collect(vtkProcessingUnitResource *refResource)=0
virtual void Reserve(vtkProcessingUnitResource *refResource)=0
implementation *const Implementation
virtual void IncreaseByRatio(float ratio, vtkProcessingUnitResource *refResource)=0