Print out memory sizes
This commit is contained in:
parent
7ba0b8fc18
commit
ad93754c3b
@ -185,6 +185,21 @@ int main(int argc, char *argv[])
|
|||||||
<< " to " << ARRAY_SIZE << std::endl;
|
<< " to " << ARRAY_SIZE << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get precision (used to reset later)
|
||||||
|
std::streamsize ss = std::cout.precision();
|
||||||
|
|
||||||
|
// Display number of bytes in array
|
||||||
|
std::cout << std::setprecision(1) << std::fixed
|
||||||
|
<< "Array size: " << ARRAY_SIZE*DATATYPE_SIZE/1024.0/1024.0 << " MB"
|
||||||
|
<< " (=" << ARRAY_SIZE*DATATYPE_SIZE/1024.0/1024.0/1024.0 << " GB)"
|
||||||
|
<< std::endl;
|
||||||
|
std::cout << "Total size: " << 3*ARRAY_SIZE*DATATYPE_SIZE/1024.0/1024.0 << " MB"
|
||||||
|
<< " (=" << 3*ARRAY_SIZE*DATATYPE_SIZE/1024.0/1024.0/1024.0 << " GB)"
|
||||||
|
<< std::endl;
|
||||||
|
|
||||||
|
// Reset precision
|
||||||
|
std::cout.precision(ss);
|
||||||
|
|
||||||
// Check device index is in range
|
// Check device index is in range
|
||||||
int count;
|
int count;
|
||||||
cudaGetDeviceCount(&count);
|
cudaGetDeviceCount(&count);
|
||||||
@ -346,10 +361,10 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
std::cout
|
std::cout
|
||||||
<< std::left << std::setw(12) << labels[j]
|
<< std::left << std::setw(12) << labels[j]
|
||||||
<< std::left << std::setw(12) << 1.0E-06 * sizes[j]/min[j]
|
<< std::left << std::setw(12) << std::setprecision(3) << 1.0E-06 * sizes[j]/min[j]
|
||||||
<< std::left << std::setw(12) << min[j]
|
<< std::left << std::setw(12) << std::setprecision(5) << min[j]
|
||||||
<< std::left << std::setw(12) << max[j]
|
<< std::left << std::setw(12) << std::setprecision(5) << max[j]
|
||||||
<< std::left << std::setw(12) << avg[j]
|
<< std::left << std::setw(12) << std::setprecision(5) << avg[j]
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -140,7 +140,20 @@ int main(int argc, char *argv[])
|
|||||||
else std::cout << "double";
|
else std::cout << "double";
|
||||||
std::cout << std::endl << std::endl;
|
std::cout << std::endl << std::endl;
|
||||||
|
|
||||||
|
// Get precision (used to reset later)
|
||||||
|
std::streamsize ss = std::cout.precision();
|
||||||
|
|
||||||
|
// Display number of bytes in array
|
||||||
|
std::cout << std::setprecision(1) << std::fixed
|
||||||
|
<< "Array size: " << ARRAY_SIZE*DATATYPE_SIZE/1024.0/1024.0 << " MB"
|
||||||
|
<< " (=" << ARRAY_SIZE*DATATYPE_SIZE/1024.0/1024.0/1024.0 << " GB)"
|
||||||
|
<< std::endl;
|
||||||
|
std::cout << "Total size: " << 3*ARRAY_SIZE*DATATYPE_SIZE/1024.0/1024.0 << " MB"
|
||||||
|
<< " (=" << 3*ARRAY_SIZE*DATATYPE_SIZE/1024.0/1024.0/1024.0 << " GB)"
|
||||||
|
<< std::endl;
|
||||||
|
|
||||||
|
// Reset precision
|
||||||
|
std::cout.precision(ss);
|
||||||
|
|
||||||
// Open the Kernel source
|
// Open the Kernel source
|
||||||
std::ifstream in("ocl-stream-kernels.cl");
|
std::ifstream in("ocl-stream-kernels.cl");
|
||||||
@ -324,10 +337,10 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
std::cout
|
std::cout
|
||||||
<< std::left << std::setw(12) << labels[j]
|
<< std::left << std::setw(12) << labels[j]
|
||||||
<< std::left << std::setw(12) << 1.0E-06 * sizes[j]/min[j]
|
<< std::left << std::setw(12) << std::setprecision(3) << 1.0E-06 * sizes[j]/min[j]
|
||||||
<< std::left << std::setw(12) << min[j]
|
<< std::left << std::setw(12) << std::setprecision(5) << min[j]
|
||||||
<< std::left << std::setw(12) << max[j]
|
<< std::left << std::setw(12) << std::setprecision(5) << max[j]
|
||||||
<< std::left << std::setw(12) << avg[j]
|
<< std::left << std::setw(12) << std::setprecision(5) << avg[j]
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user