VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkComputingResources.h 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00015 /*------------------------------------------------------------------------- 00016 Copyright (c) 2008, 2009 by SCI Institute, University of Utah. 00017 00018 This is part of the Parallel Dataflow System originally developed by 00019 Huy T. Vo and Claudio T. Silva. For more information, see: 00020 00021 "Parallel Dataflow Scheme for Streaming (Un)Structured Data" by Huy 00022 T. Vo, Daniel K. Osmari, Brian Summa, Joao L.D. Comba, Valerio 00023 Pascucci and Claudio T. Silva, SCI Institute, University of Utah, 00024 Technical Report #UUSCI-2009-004, 2009. 00025 00026 "Multi-Threaded Streaming Pipeline For VTK" by Huy T. Vo and Claudio 00027 T. Silva, SCI Institute, University of Utah, Technical Report 00028 #UUSCI-2009-005, 2009. 00029 -------------------------------------------------------------------------*/ 00040 #ifndef __vtkComputingResources_h 00041 #define __vtkComputingResources_h 00042 00043 #include "vtkCommonExecutionModelModule.h" // For export macro 00044 #include "vtkObject.h" 00045 00046 class vtkInformation; 00047 class vtkProcessingUnitResource; 00048 class vtkThreadedStreamingPipeline; 00049 00050 class VTKCOMMONEXECUTIONMODEL_EXPORT vtkComputingResources : public vtkObject 00051 { 00052 public: 00053 static vtkComputingResources* New(); 00054 vtkTypeMacro(vtkComputingResources,vtkObject); 00055 void PrintSelf(ostream &os, vtkIndent indent); 00056 00058 void Clear(); 00059 00062 void ObtainMinimumResources(); 00063 00065 void ObtainMaximumResources(); 00066 00067 //BTX 00069 00071 vtkProcessingUnitResource *GetResourceFor(int processingUnit); 00072 //ETX 00074 00078 void Deploy(vtkThreadedStreamingPipeline *exec, vtkInformation *info); 00079 00082 bool Reserve(vtkComputingResources *res); 00083 00085 void Collect(vtkComputingResources *res); 00086 00087 protected: 00088 vtkComputingResources(); 00089 ~vtkComputingResources(); 00090 00091 //BTX 00092 class implementation; 00093 implementation* const Implementation; 00094 //ETX 00095 private: 00096 vtkComputingResources(const vtkComputingResources&); // Not implemented. 00097 void operator=(const vtkComputingResources&); // Not implemented. 00098 }; 00099 00100 //BTX 00101 //---------------------------------------------------------------------------- 00102 // A basic resource class. It is put here for later inheritance for 00103 // any type of computing, e.g. CPU/GPU. 00104 //---------------------------------------------------------------------------- 00105 class vtkProcessingUnitResource { 00106 public: 00107 virtual ~vtkProcessingUnitResource() {} 00108 00110 virtual int ProcessingUnit() = 0; 00111 00113 virtual bool HasResource() = 0; 00114 00116 virtual void Clear() = 0; 00117 00119 virtual void ObtainMinimum() = 0; 00120 00122 virtual void ObtainMaximum() = 0; 00123 00127 virtual void IncreaseByRatio(float ratio, vtkProcessingUnitResource *refResource) = 0; 00128 00131 virtual void AllocateFor(vtkThreadedStreamingPipeline *exec) = 0; 00132 00134 virtual bool CanAccommodate(vtkProcessingUnitResource *refResource) = 0; 00135 00137 virtual void Reserve(vtkProcessingUnitResource *refResource) = 0; 00138 00140 00141 virtual void Collect(vtkProcessingUnitResource *refResource) = 0; 00142 }; 00143 //ETX 00145 00146 #endif