38 #ifndef ECUDA_DEVICE_HPP
39 #define ECUDA_DEVICE_HPP
55 cudaDeviceProp deviceProperties;
56 int driverVersion, runtimeVersion;
63 CUDA_CALL( cudaGetDeviceCount(&deviceCount) );
73 device(
const int deviceNumber ) : deviceNumber(deviceNumber)
75 CUDA_CALL( cudaGetDeviceProperties(&deviceProperties,deviceNumber) );
76 CUDA_CALL( cudaDriverGetVersion(&driverVersion) );
77 CUDA_CALL( cudaRuntimeGetVersion(&runtimeVersion) );
84 inline const cudaDeviceProp&
get_properties()
const {
return deviceProperties; }
88 std::ostringstream oss;
89 oss << (driverVersion/1000);
91 oss << ((driverVersion%100)/10);
97 std::ostringstream oss;
98 oss << (runtimeVersion/1000);
100 oss << ((runtimeVersion%100)/10);
114 output <<
"name=" << deviceProperties.name << std::endl;
115 output <<
"totalGlobalMem=" << deviceProperties.totalGlobalMem << std::endl;
116 output <<
"sharedMemPerBlock=" << deviceProperties.sharedMemPerBlock << std::endl;
117 output <<
"regsPerBlock=" << deviceProperties.regsPerBlock << std::endl;
118 output <<
"warpSize=" << deviceProperties.warpSize << std::endl;
119 output <<
"memPitch=" << deviceProperties.memPitch << std::endl;
120 output <<
"maxThreadsPerBlock=" << deviceProperties.maxThreadsPerBlock << std::endl;
121 output <<
"maxThreadsDim=" << deviceProperties.maxThreadsDim[0] <<
"," << deviceProperties.maxThreadsDim[1] <<
"," << deviceProperties.maxThreadsDim[2] << std::endl;
122 output <<
"maxGridSize=" << deviceProperties.maxGridSize[0] <<
"," << deviceProperties.maxGridSize[1] <<
"," << deviceProperties.maxGridSize[2] << std::endl;
123 output <<
"clockRate=" << deviceProperties.clockRate << std::endl;
124 output <<
"totalConstMem=" << deviceProperties.totalConstMem << std::endl;
125 output <<
"major=" << deviceProperties.major << std::endl;
126 output <<
"minor=" << deviceProperties.minor << std::endl;
127 output <<
"textureAlignment=" << deviceProperties.textureAlignment << std::endl;
128 output <<
"texturePitchAlignment=" << deviceProperties.texturePitchAlignment << std::endl;
129 output <<
"deviceOverlap=" << deviceProperties.deviceOverlap << std::endl;
130 output <<
"multiProcessorCount=" << deviceProperties.multiProcessorCount << std::endl;
131 output <<
"kernelExecTimeoutEnabled=" << deviceProperties.kernelExecTimeoutEnabled << std::endl;
132 output <<
"integrated=" << deviceProperties.integrated << std::endl;
133 output <<
"canMapHostMemory=" << deviceProperties.canMapHostMemory << std::endl;
134 output <<
"computeMode=" << deviceProperties.computeMode << std::endl;
135 output <<
"maxTexture1D=" << deviceProperties.maxTexture1D << std::endl;
136 output <<
"maxTexture1DLinear=" << deviceProperties.maxTexture1DLinear << std::endl;
137 output <<
"maxTexture2D=" << deviceProperties.maxTexture2D[0] <<
"," << deviceProperties.maxTexture2D[1] << std::endl;
138 output <<
"maxTexture2DLinear=" << deviceProperties.maxTexture2DLinear[0] <<
"," << deviceProperties.maxTexture2DLinear[1] <<
"," << deviceProperties.maxTexture2DLinear[2] << std::endl;
139 output <<
"maxTexture2DGather=" << deviceProperties.maxTexture2DGather[0] <<
"," << deviceProperties.maxTexture2DGather[1] << std::endl;
140 output <<
"maxTexture3D=" << deviceProperties.maxTexture3D[0] <<
"," << deviceProperties.maxTexture3D[1] <<
"," << deviceProperties.maxTexture3D[2] << std::endl;
141 output <<
"maxTextureCubemap=" << deviceProperties.maxTextureCubemap << std::endl;
142 output <<
"maxTexture1DLayered=" << deviceProperties.maxTexture1DLayered[0] <<
"," << deviceProperties.maxTexture1DLayered[1] << std::endl;
143 output <<
"maxTexture2DLayered=" << deviceProperties.maxTexture2DLayered[0] <<
"," << deviceProperties.maxTexture2DLayered[1] <<
"," << deviceProperties.maxTexture2DLayered[2] << std::endl;
144 output <<
"maxTextureCubemapLayered=" << deviceProperties.maxTextureCubemapLayered[0] <<
"," << deviceProperties.maxTextureCubemapLayered[1] << std::endl;
145 output <<
"maxSurface1D=" << deviceProperties.maxSurface1D << std::endl;
146 output <<
"maxSurface2D=" << deviceProperties.maxSurface2D[0] <<
"," << deviceProperties.maxSurface2D[1] << std::endl;
147 output <<
"maxSurface3D=" << deviceProperties.maxSurface3D[0] <<
"," << deviceProperties.maxSurface3D[1] <<
"," << deviceProperties.maxSurface3D[2] << std::endl;
148 output <<
"maxSurface1DLayered=" << deviceProperties.maxSurface1DLayered[0] <<
"," << deviceProperties.maxSurface1DLayered[1] << std::endl;
149 output <<
"maxSurface2DLayered=" << deviceProperties.maxSurface2DLayered[0] <<
"," << deviceProperties.maxSurface2DLayered[1] <<
"," << deviceProperties.maxSurface2DLayered[2] << std::endl;
150 output <<
"maxSurfaceCubemap=" << deviceProperties.maxSurfaceCubemap << std::endl;
151 output <<
"maxSurfaceCubemapLayered=" << deviceProperties.maxSurfaceCubemapLayered[0] <<
"," << deviceProperties.maxSurfaceCubemapLayered[1] << std::endl;
152 output <<
"surfaceAlignment=" << deviceProperties.surfaceAlignment << std::endl;
153 output <<
"concurrentKernels=" << deviceProperties.concurrentKernels << std::endl;
154 output <<
"ECCEnabled=" << deviceProperties.ECCEnabled << std::endl;
155 output <<
"pciBusID=" << deviceProperties.pciBusID << std::endl;
156 output <<
"pciDeviceID=" << deviceProperties.pciDeviceID << std::endl;
157 output <<
"pciDomainID=" << deviceProperties.pciDomainID << std::endl;
158 output <<
"tccDriver=" << deviceProperties.tccDriver << std::endl;
159 output <<
"asyncEngineCount=" << deviceProperties.asyncEngineCount << std::endl;
160 output <<
"unifiedAddressing=" << deviceProperties.unifiedAddressing << std::endl;
161 output <<
"memoryClockRate=" << deviceProperties.memoryClockRate << std::endl;
162 output <<
"memoryBusWidth=" << deviceProperties.memoryBusWidth << std::endl;
163 output <<
"l2CacheSize=" << deviceProperties.l2CacheSize << std::endl;
164 output <<
"maxThreadsPerMultiProcessor=" << deviceProperties.maxThreadsPerMultiProcessor << std::endl;
166 output <<
"Not using device, in ecuda host emulation mode." << std::endl;
static int get_device_count()
Encapsulates CUDA API device information functions.
int get_driver_version() const
int get_device_number() const
void print_summary(std::ostream &output=std::cout)
std::string get_driver_version_string() const
int get_runtime_version() const
const cudaDeviceProp & get_properties() const
std::string get_runtime_version_string() const
device(const int deviceNumber)