CudappDevice.h

Go to the documentation of this file.
00001 #ifndef CUDAPPDEVICE_H_
00002 #define CUDAPPDEVICE_H_
00003 
00004 #include "CudappSupportModule.h"
00005 #include "driver_types.h"
00006 #include <ostream>
00007 namespace Cudapp
00008 {
00009     class CUDA_SUPPORT_EXPORT Device
00010     {
00011     public:
00012         Device(unsigned int deviceNumber);
00013         virtual ~Device();
00014 
00016         bool IsInitialized() const { return this->Initialized; }
00017 
00018         void SetDeviceNumber(unsigned int deviceNumber);
00019         int GetDeviceNumber() const { return this->DeviceNumber; }
00020 
00024 
00025         const char* GetName() const { return DeviceProp.name; }
00027         size_t GetTotalGlobalMem() const { return DeviceProp.totalGlobalMem; }
00029         size_t GetSharedMemPerBlock() const { return DeviceProp. sharedMemPerBlock; }
00031         int GetRegsPerBlock() const { return DeviceProp.regsPerBlock; }
00033         int GetWrapSize() const { return DeviceProp.warpSize; }
00035         size_t GetMemPitch() const { return DeviceProp.memPitch; }
00037         int GetMaxThreadsPerBlock() const { return DeviceProp.maxThreadsPerBlock; }
00039         const int* GetMaxThreadsDim() const { return DeviceProp.maxThreadsDim; } 
00040 
00041         const int* GetMaxGridSize() const { return DeviceProp.maxGridSize; }  
00042 
00043         size_t GetTotalConstMem() const { return DeviceProp.totalConstMem; }
00045         int GetMajor() const { return DeviceProp.major; }
00047         int GetMinor() const { return DeviceProp.minor; }
00049         int GetClockRate() const { return DeviceProp.clockRate; }
00051         size_t GetTextureAlignment() const { return DeviceProp.textureAlignment; }
00053         const cudaDeviceProp& GetCudaDeviceProperty() const { return this->DeviceProp; }
00054 
00055         void MakeActive();
00056         void SynchronizeThread();
00057         void ExitThread();
00058 
00060         bool AllocateMemory();
00061 
00062         virtual void PrintSelf(std::ostream&  os) const;
00063 
00064     protected:
00065         void LoadDeviceProperties();
00066 
00067         bool Initialized;
00068         int DeviceNumber;
00069         cudaDeviceProp DeviceProp;    
00070     };
00071     inline std::ostream& operator<<(std::ostream& os, const Device& in){
00072         in.PrintSelf(os);
00073         return os; 
00074     }
00075 
00076 }
00077 #endif /*CUDAPPDEVICE_H_*/

Generated on 6 Apr 2011 for Slicer3 by  doxygen 1.6.1