diff --git a/samples/1_Utils/hipInfo/hipInfo.cpp b/samples/1_Utils/hipInfo/hipInfo.cpp index bff2114f96..de73aababd 100644 --- a/samples/1_Utils/hipInfo/hipInfo.cpp +++ b/samples/1_Utils/hipInfo/hipInfo.cpp @@ -41,9 +41,9 @@ THE SOFTWARE. #define HIPCHECK(error) \ if (error != hipSuccess) { \ - printf("%serror: '%s'(%d) at %s:%d%s\n", \ - KRED,hipGetErrorString(error), error,\ - __FILE__, __LINE__,KNRM); \ + printf("%serror: '%s'(%d) at %s:%d%s\n", \ + KRED, hipGetErrorString(error), error,\ + __FILE__, __LINE__,KNRM);\ failed("API returned error code.");\ } @@ -53,12 +53,11 @@ void printCompilerInfo () printf ("compiler: hcc version=%s, workweek (YYWWD) = %u\n", __hcc_version__, __hcc_workweek__); #endif #ifdef __NVCC__ - printf ("compiler: nvcc\n"); + printf ("compiler: nvcc\n"); #endif } - -double bytesToGB(size_t s) +double bytesToGB(size_t s) { return (double)s / (1024.0*1024.0*1024.0); } @@ -66,7 +65,6 @@ double bytesToGB(size_t s) void printDeviceProp (int deviceId) { using namespace std; - const int w1 = 30; cout << left; @@ -77,33 +75,27 @@ void printDeviceProp (int deviceId) hipDeviceProp_t props; HIPCHECK(hipDeviceGetProperties(&props, deviceId)); - cout << setw(w1) << "Name: " << props.name << endl; cout << setw(w1) << "multiProcessorCount: " << props.multiProcessorCount << endl; cout << setw(w1) << "clockRate: " << (float)props.clockRate / 1000.0 << " Mhz" << endl; cout << setw(w1) << "clockInstructionRate: " << (float)props.clockInstructionRate / 1000.0<< " Mhz" << endl; - cout << setw(w1) << "totalGlobalMem" << fixed << setprecision(2) << bytesToGB(props.totalGlobalMem) << " GB" << endl; - - cout << setw(w1) << "sharedMemPerBlock" << (float)props.sharedMemPerBlock / 1024.0 << " KB" << endl; - cout << setw(w1) << "regsPerBlock" << props.regsPerBlock << endl; - cout << setw(w1) << "warpSize" << props.warpSize << endl; - cout << setw(w1) << "maxThreadsPerBlock" << props.maxThreadsPerBlock << endl; - cout << setw(w1) << "maxThreadsDim.x" << props.maxThreadsDim[0] << endl; - cout << setw(w1) << "maxThreadsDim.y" << props.maxThreadsDim[1] << endl; - cout << setw(w1) << "maxThreadsDim.z" << props.maxThreadsDim[2] << endl; - - cout << setw(w1) << "maxGridSize.x" << props.maxGridSize[0] << endl; - cout << setw(w1) << "maxGridSize.y" << props.maxGridSize[1] << endl; - cout << setw(w1) << "maxGridSize.z" << props.maxGridSize[2] << endl; - - - cout << setw(w1) << "totalConstMem" << props.totalConstMem << endl; - cout << setw(w1) << "major" << props.major << endl; - cout << setw(w1) << "minor" << props.minor << endl; - cout << setw(w1) << "l2CacheSize" << props.l2CacheSize << endl; - cout << setw(w1) << "maxThreadsPerMultiProcessor" << props.maxThreadsPerMultiProcessor << endl; - cout << setw(w1) << "computeMode" << props.computeMode << endl; - + cout << setw(w1) << "totalGlobalMem" << fixed << setprecision(2) << bytesToGB(props.totalGlobalMem) << " GB" << endl; + cout << setw(w1) << "sharedMemPerBlock" << (float)props.sharedMemPerBlock / 1024.0 << " KB" << endl; + cout << setw(w1) << "regsPerBlock" << props.regsPerBlock << endl; + cout << setw(w1) << "warpSize" << props.warpSize << endl; + cout << setw(w1) << "maxThreadsPerBlock" << props.maxThreadsPerBlock << endl; + cout << setw(w1) << "maxThreadsDim.x" << props.maxThreadsDim[0] << endl; + cout << setw(w1) << "maxThreadsDim.y" << props.maxThreadsDim[1] << endl; + cout << setw(w1) << "maxThreadsDim.z" << props.maxThreadsDim[2] << endl; + cout << setw(w1) << "maxGridSize.x" << props.maxGridSize[0] << endl; + cout << setw(w1) << "maxGridSize.y" << props.maxGridSize[1] << endl; + cout << setw(w1) << "maxGridSize.z" << props.maxGridSize[2] << endl; + cout << setw(w1) << "totalConstMem" << props.totalConstMem << endl; + cout << setw(w1) << "major" << props.major << endl; + cout << setw(w1) << "minor" << props.minor << endl; + cout << setw(w1) << "l2CacheSize" << props.l2CacheSize << endl; + cout << setw(w1) << "maxThreadsPerMultiProcessor" << props.maxThreadsPerMultiProcessor << endl; + cout << setw(w1) << "computeMode" << props.computeMode << endl; cout << setw(w1) << "arch.hasGlobalInt32Atomics" << props.arch.hasGlobalInt32Atomics << endl; cout << setw(w1) << "arch.hasGlobalFloatAtomicExch" << props.arch.hasGlobalFloatAtomicExch << endl; cout << setw(w1) << "arch.hasSharedInt32Atomics" << props.arch.hasSharedInt32Atomics << endl; @@ -121,17 +113,14 @@ void printDeviceProp (int deviceId) cout << setw(w1) << "arch.hasSurfaceFuncs" << props.arch.hasSurfaceFuncs << endl; cout << setw(w1) << "arch.has3dGrid" << props.arch.has3dGrid << endl; cout << setw(w1) << "arch.hasDynamicParallelism" << props.arch.hasDynamicParallelism << endl; - cout << endl; size_t free, total; - hipMemGetInfo(&free, &total); cout << fixed << setprecision(2); cout << setw(w1) << "memInfo.total " << bytesToGB(total) << " GB" << endl; cout << setw(w1) << "memInfo.free " << bytesToGB(free) << " GB (" << setprecision(0) << (float)free/total * 100.0 << "%)" << endl; - } int main(int argc, char *argv[])