CUDA.Context.hpp 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. // CodeGear C++Builder
  2. // Copyright (c) 1995, 2022 by Embarcadero Technologies, Inc.
  3. // All rights reserved
  4. // (DO NOT EDIT: machine generated header) 'CUDA.Context.pas' rev: 35.00 (Windows)
  5. #ifndef Cuda_ContextHPP
  6. #define Cuda_ContextHPP
  7. #pragma delphiheader begin
  8. #pragma option push
  9. #pragma option -w- // All warnings off
  10. #pragma option -Vx // Zero-length empty class member
  11. #pragma pack(push,8)
  12. #include <System.hpp>
  13. #include <SysInit.hpp>
  14. #include <System.Classes.hpp>
  15. #include <System.SysUtils.hpp>
  16. #include <GLS.Strings.hpp>
  17. #include <GLS.BaseClasses.hpp>
  18. #include <GLS.Context.hpp>
  19. #include <GLS.Generics.hpp>
  20. #include <CUDA.Import.hpp>
  21. #include <CUDA.Runtime.hpp>
  22. #include <System.SyncObjs.hpp>
  23. //-- user supplied -----------------------------------------------------------
  24. namespace Cuda
  25. {
  26. namespace Context
  27. {
  28. //-- forward type declarations -----------------------------------------------
  29. class DELPHICLASS TCUDADimensions;
  30. class DELPHICLASS TCUDADevice;
  31. class DELPHICLASS TGLCUDADevice;
  32. class DELPHICLASS TCUDAHandlesMaster;
  33. class DELPHICLASS TCUDAContext;
  34. class DELPHICLASS CUDAContextManager;
  35. //-- type declarations -------------------------------------------------------
  36. class PASCALIMPLEMENTATION TCUDADimensions : public Gls::Baseclasses::TGLUpdateAbleObject
  37. {
  38. typedef Gls::Baseclasses::TGLUpdateAbleObject inherited;
  39. private:
  40. Cuda::Import::TDim3 FXYZ;
  41. Cuda::Import::TDim3 FMaxXYZ;
  42. bool FReadOnly;
  43. int __fastcall GetDimComponent(int index);
  44. void __fastcall SetDimComponent(int index, int Value);
  45. int __fastcall GetMaxDimComponent(int index);
  46. void __fastcall SetMaxDimComponent(int index, int Value);
  47. public:
  48. __fastcall virtual TCUDADimensions(System::Classes::TPersistent* AOwner);
  49. virtual void __fastcall Assign(System::Classes::TPersistent* Source);
  50. __property int MaxSizeX = {read=GetMaxDimComponent, write=SetMaxDimComponent, index=0, nodefault};
  51. __property int MaxSizeY = {read=GetMaxDimComponent, write=SetMaxDimComponent, index=1, nodefault};
  52. __property int MaxSizeZ = {read=GetMaxDimComponent, write=SetMaxDimComponent, index=2, nodefault};
  53. __property bool ReadOnlyValue = {read=FReadOnly, write=FReadOnly, nodefault};
  54. __published:
  55. __property int SizeX = {read=GetDimComponent, write=SetDimComponent, index=0, default=1};
  56. __property int SizeY = {read=GetDimComponent, write=SetDimComponent, index=1, default=1};
  57. __property int SizeZ = {read=GetDimComponent, write=SetDimComponent, index=2, default=1};
  58. public:
  59. /* TPersistent.Destroy */ inline __fastcall virtual ~TCUDADimensions() { }
  60. };
  61. typedef void __fastcall (__closure *TOnOpenGLInteropInit)(/* out */ Gls::Context::TGLContext* &Context);
  62. #pragma pack(push,4)
  63. class PASCALIMPLEMENTATION TCUDADevice : public System::Classes::TPersistent
  64. {
  65. typedef System::Classes::TPersistent inherited;
  66. private:
  67. int fID;
  68. int fHandle;
  69. int fGFlops;
  70. Cuda::Runtime::TCudaDeviceProp fDeviceProperties;
  71. bool FSuitable;
  72. bool FUsed;
  73. TCUDADimensions* fMaxThreadsDim;
  74. TCUDADimensions* fMaxGridSize;
  75. protected:
  76. System::UnicodeString __fastcall GetName();
  77. public:
  78. __fastcall TCUDADevice();
  79. __fastcall virtual ~TCUDADevice();
  80. virtual void __fastcall Assign(System::Classes::TPersistent* Source);
  81. unsigned __fastcall TotalMemory();
  82. __published:
  83. __property System::UnicodeString Name = {read=GetName};
  84. __property NativeUInt TotalGlobalMem = {read=fDeviceProperties.totalGlobalMem, nodefault};
  85. __property NativeUInt SharedMemPerBlock = {read=fDeviceProperties.sharedMemPerBlock, nodefault};
  86. __property int RegsPerBlock = {read=fDeviceProperties.regsPerBlock, nodefault};
  87. __property int WarpSize = {read=fDeviceProperties.warpSize, nodefault};
  88. __property NativeUInt MemPitch = {read=fDeviceProperties.memPitch, nodefault};
  89. __property int MaxThreadsPerBlock = {read=fDeviceProperties.maxThreadsPerBlock, nodefault};
  90. __property TCUDADimensions* MaxThreadsDim = {read=fMaxThreadsDim};
  91. __property TCUDADimensions* MaxGridSize = {read=fMaxGridSize};
  92. __property int ClockRate = {read=fDeviceProperties.clockRate, nodefault};
  93. __property NativeUInt TotalConstMem = {read=fDeviceProperties.totalConstMem, nodefault};
  94. __property int Major = {read=fDeviceProperties.major, nodefault};
  95. __property int Minor = {read=fDeviceProperties.minor, nodefault};
  96. __property NativeUInt TextureAlignment = {read=fDeviceProperties.textureAlignment, nodefault};
  97. __property int DeviceOverlap = {read=fDeviceProperties.deviceOverlap, nodefault};
  98. __property int MultiProcessorCount = {read=fDeviceProperties.multiProcessorCount, nodefault};
  99. };
  100. #pragma pack(pop)
  101. class PASCALIMPLEMENTATION TGLCUDADevice : public System::Classes::TComponent
  102. {
  103. typedef System::Classes::TComponent inherited;
  104. private:
  105. System::UnicodeString FSelectDeviceName;
  106. TCUDADevice* __fastcall GetDevice();
  107. void __fastcall SetDevice(TCUDADevice* AValue);
  108. void __fastcall SetDeviceName(const System::UnicodeString AName);
  109. public:
  110. __fastcall virtual TGLCUDADevice(System::Classes::TComponent* AOwner);
  111. __fastcall virtual ~TGLCUDADevice();
  112. bool __fastcall Suitable();
  113. __published:
  114. __property System::UnicodeString SelectDevice = {read=FSelectDeviceName, write=SetDeviceName};
  115. __property TCUDADevice* Device = {read=GetDevice, write=SetDevice};
  116. };
  117. class PASCALIMPLEMENTATION TCUDAHandlesMaster : public System::Classes::TComponent
  118. {
  119. typedef System::Classes::TComponent inherited;
  120. protected:
  121. virtual TCUDAContext* __fastcall GetContext() = 0 ;
  122. virtual void __fastcall AllocateHandles();
  123. virtual void __fastcall DestroyHandles();
  124. public:
  125. /* TComponent.Create */ inline __fastcall virtual TCUDAHandlesMaster(System::Classes::TComponent* AOwner) : System::Classes::TComponent(AOwner) { }
  126. /* TComponent.Destroy */ inline __fastcall virtual ~TCUDAHandlesMaster() { }
  127. };
  128. typedef Gls::Generics::GThreadList__1<TCUDAHandlesMaster*>* TCUDAHandleList;
  129. class PASCALIMPLEMENTATION TCUDAContext : public System::TObject
  130. {
  131. typedef System::TObject inherited;
  132. private:
  133. Cuda::Import::TCUcontext *fHandle;
  134. TCUDADevice* FDevice;
  135. TOnOpenGLInteropInit FOnOpenGLInteropInit;
  136. Gls::Generics::GThreadList__1<TCUDAHandlesMaster*>* FHandleList;
  137. void __fastcall SetDevice(TCUDADevice* ADevice);
  138. public:
  139. __fastcall TCUDAContext();
  140. __fastcall virtual ~TCUDAContext();
  141. void __fastcall DestroyAllHandles();
  142. void __fastcall Requires();
  143. void __fastcall Release();
  144. bool __fastcall IsValid();
  145. __property TCUDADevice* Device = {read=FDevice, write=SetDevice};
  146. __property TOnOpenGLInteropInit OnOpenGLInteropInit = {read=FOnOpenGLInteropInit, write=FOnOpenGLInteropInit};
  147. };
  148. typedef Gls::Generics::GList__1<TCUDADevice*>* TCUDADeviceList;
  149. typedef Gls::Generics::GList__1<TCUDAContext*>* TCUDAContextList;
  150. #pragma pack(push,4)
  151. class PASCALIMPLEMENTATION CUDAContextManager : public System::TObject
  152. {
  153. typedef System::TObject inherited;
  154. private:
  155. typedef System::DynamicArray<Gls::Generics::GList__1<TCUDAContext*>*> _CUDAContextManager__1;
  156. private:
  157. static Gls::Generics::GList__1<TCUDADevice*>* fDeviceList;
  158. static Gls::Generics::GList__1<TCUDAContext*>* fContextList;
  159. static _CUDAContextManager__1 FContextStacks;
  160. protected:
  161. __classmethod TCUDADevice* __fastcall GetDevice(int i);
  162. __classmethod TCUDADevice* __fastcall GetNextUnusedDevice();
  163. __classmethod void __fastcall RegisterContext(TCUDAContext* aContext);
  164. __classmethod void __fastcall UnRegisterContext(TCUDAContext* aContext);
  165. __classmethod Gls::Generics::GList__1<TCUDAContext*>* __fastcall GetThreadStack();
  166. __classmethod TCUDAContext* __fastcall GetContext(int i);
  167. public:
  168. __classmethod void __fastcall Init();
  169. __classmethod void __fastcall Done();
  170. __classmethod void __fastcall CreateContext(TCUDAContext* aContext);
  171. __classmethod void __fastcall DestroyContext(TCUDAContext* aContext);
  172. __classmethod void __fastcall CreateContextOf(TCUDADevice* ADevice);
  173. __classmethod void __fastcall DestroyContextOf(TCUDADevice* ADevice);
  174. __classmethod void __fastcall PushContext(TCUDAContext* aContext);
  175. __classmethod TCUDAContext* __fastcall PopContext();
  176. __classmethod void __fastcall FillUnusedDeviceList(System::Classes::TStringList* &AList);
  177. __classmethod TCUDADevice* __fastcall GetDeviceByName(const System::UnicodeString AName);
  178. __classmethod int __fastcall DeviceCount();
  179. __property TCUDADevice* Devices[int i] = {read=GetDevice};
  180. __classmethod TCUDADevice* __fastcall GetMaxGflopsDevice();
  181. __classmethod int __fastcall ContextCount();
  182. __classmethod TCUDAContext* __fastcall GetCurrentThreadContext();
  183. __property TCUDAContext* Contexts[int i] = {read=GetContext};
  184. private:
  185. // __classmethod void __fastcall Create@();
  186. // __classmethod void __fastcall Destroy@();
  187. public:
  188. /* TObject.Create */ inline __fastcall CUDAContextManager() : System::TObject() { }
  189. /* TObject.Destroy */ inline __fastcall virtual ~CUDAContextManager() { }
  190. };
  191. #pragma pack(pop)
  192. //-- var, const, procedure ---------------------------------------------------
  193. } /* namespace Context */
  194. } /* namespace Cuda */
  195. #if !defined(DELPHIHEADER_NO_IMPLICIT_NAMESPACE_USE) && !defined(NO_USING_NAMESPACE_CUDA_CONTEXT)
  196. using namespace Cuda::Context;
  197. #endif
  198. #if !defined(DELPHIHEADER_NO_IMPLICIT_NAMESPACE_USE) && !defined(NO_USING_NAMESPACE_CUDA)
  199. using namespace Cuda;
  200. #endif
  201. #pragma pack(pop)
  202. #pragma option pop
  203. #pragma delphiheader end.
  204. //-- end unit ----------------------------------------------------------------
  205. #endif // Cuda_ContextHPP