VTK
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 "vtkObject.h"
44 
45 class vtkInformation;
48 
50 {
51 public:
52  static vtkComputingResources* New();
54  void PrintSelf(ostream &os, vtkIndent indent);
55 
57  void Clear();
58 
61  void ObtainMinimumResources();
62 
64  void ObtainMaximumResources();
65 
66  //BTX
68 
70  vtkProcessingUnitResource *GetResourceFor(int processingUnit);
71  //ETX
73 
77  void Deploy(vtkThreadedStreamingPipeline *exec, vtkInformation *info);
78 
81  bool Reserve(vtkComputingResources *res);
82 
84  void Collect(vtkComputingResources *res);
85 
86 protected:
89 
90 //BTX
91  class implementation;
92  implementation* const Implementation;
93 //ETX
94 private:
95  vtkComputingResources(const vtkComputingResources&); // Not implemented.
96  void operator=(const vtkComputingResources&); // Not implemented.
97 };
98 
99 //BTX
100 //----------------------------------------------------------------------------
101 // A basic resource class. It is put here for later inheritance for
102 // any type of computing, e.g. CPU/GPU.
103 //----------------------------------------------------------------------------
105 public:
107 
109  virtual int ProcessingUnit() = 0;
110 
112  virtual bool HasResource() = 0;
113 
115  virtual void Clear() = 0;
116 
118  virtual void ObtainMinimum() = 0;
119 
121  virtual void ObtainMaximum() = 0;
122 
126  virtual void IncreaseByRatio(float ratio, vtkProcessingUnitResource *refResource) = 0;
127 
130  virtual void AllocateFor(vtkThreadedStreamingPipeline *exec) = 0;
131 
133  virtual bool CanAccommodate(vtkProcessingUnitResource *refResource) = 0;
134 
136  virtual void Reserve(vtkProcessingUnitResource *refResource) = 0;
137 
139 
140  virtual void Collect(vtkProcessingUnitResource *refResource) = 0;
141 };
142 //ETX
144 
145 #endif