@@ -31,7 +31,8 @@
|
||||
/* \file
|
||||
\brief Command line options for performance test program
|
||||
*/
|
||||
|
||||
#include <cuda.h>
|
||||
#include <cuda_runtime_api.h>
|
||||
#include <algorithm>
|
||||
#include <fstream>
|
||||
#include <set>
|
||||
@@ -165,9 +166,11 @@ void Options::Device::print_usage(std::ostream &out) const {
|
||||
break;
|
||||
}
|
||||
else {
|
||||
int32_t clock_KHz;
|
||||
cudaDeviceGetAttribute(&clock_KHz, cudaDevAttrClockRate, 0);
|
||||
out << " [" << idx << "] - "
|
||||
<< prop.name << " - SM " << prop.major << "." << prop.minor << ", "
|
||||
<< prop.multiProcessorCount << " SMs @ " << (prop.clockRate / 1000.0) << " MHz, "
|
||||
<< prop.multiProcessorCount << " SMs @ " << (clock_KHz / 1000.0) << " MHz, "
|
||||
<< "L2 cache: " << (prop.l2CacheSize >> 20) << " MB, Global Memory: " << (prop.totalGlobalMem >> 30) << " GB"
|
||||
<< std::endl;
|
||||
}
|
||||
@@ -216,9 +219,11 @@ void Options::Device::print_options(std::ostream &out, int indent) const {
|
||||
for (int device : devices) {
|
||||
out << device << ',';
|
||||
}
|
||||
int32_t clock_KHz;
|
||||
cudaDeviceGetAttribute(&clock_KHz, cudaDevAttrClockRate, 0);
|
||||
out
|
||||
<< "\n"
|
||||
<< indent_str(indent) << "clock: " << int(double(properties[0].clockRate) / 1000.0) << "\n"
|
||||
<< indent_str(indent) << "clock: " << int(double(clock_KHz) / 1000.0) << "\n"
|
||||
<< indent_str(indent) << "compute-capability: " << compute_capability(0) << "\n";
|
||||
}
|
||||
|
||||
|
||||
@@ -109,7 +109,8 @@ bool BlockCompareEqual(
|
||||
Element const *ptr_B,
|
||||
size_t capacity,
|
||||
int grid_size = 0,
|
||||
int block_size = 0) {
|
||||
int block_size = 0,
|
||||
cudaStream_t stream = nullptr) {
|
||||
|
||||
int equal_flag = 1;
|
||||
int *device_equal_flag = nullptr;
|
||||
@@ -146,7 +147,9 @@ bool BlockCompareEqual(
|
||||
dim3 grid(grid_size, 1, 1);
|
||||
dim3 block(block_size, 1, 1);
|
||||
|
||||
kernel::BlockCompareEqual<Element><<< grid, block >>>(device_equal_flag, ptr_A, ptr_B, capacity);
|
||||
kernel::BlockCompareEqual<Element><<< grid, block, 0, stream >>>(device_equal_flag, ptr_A, ptr_B, capacity);
|
||||
|
||||
cudaStreamSynchronize(stream);
|
||||
|
||||
if (cudaMemcpy(
|
||||
&equal_flag,
|
||||
@@ -175,7 +178,8 @@ bool BlockCompareRelativelyEqual(
|
||||
Element epsilon,
|
||||
Element nonzero_floor,
|
||||
int grid_size = 0,
|
||||
int block_size = 0) {
|
||||
int block_size = 0,
|
||||
cudaStream_t stream = nullptr) {
|
||||
|
||||
int equal_flag = 1;
|
||||
int *device_equal_flag = nullptr;
|
||||
@@ -212,7 +216,7 @@ bool BlockCompareRelativelyEqual(
|
||||
dim3 grid(grid_size, 1, 1);
|
||||
dim3 block(block_size, 1, 1);
|
||||
|
||||
kernel::BlockCompareRelativelyEqual<Element><<< grid, block >>>(
|
||||
kernel::BlockCompareRelativelyEqual<Element><<< grid, block, 0, stream >>>(
|
||||
device_equal_flag,
|
||||
ptr_A,
|
||||
ptr_B,
|
||||
@@ -221,6 +225,8 @@ bool BlockCompareRelativelyEqual(
|
||||
nonzero_floor
|
||||
);
|
||||
|
||||
cudaStreamSynchronize(stream);
|
||||
|
||||
if (cudaMemcpy(
|
||||
&equal_flag,
|
||||
device_equal_flag,
|
||||
|
||||
@@ -232,6 +232,8 @@ ComputeType TensorTransformReduce(
|
||||
workspace, identity, workspace_size, reduce
|
||||
);
|
||||
|
||||
cudaStreamSynchronize(stream);
|
||||
|
||||
if (copy_out) {
|
||||
cudaError_t result = cudaMemcpy(&identity, workspace, sizeof(identity), cudaMemcpyDeviceToHost);
|
||||
if (result != cudaSuccess) {
|
||||
@@ -285,6 +287,8 @@ ComputeType TensorTransformReduce(
|
||||
workspace, identity, workspace_size, reduce
|
||||
);
|
||||
|
||||
cudaStreamSynchronize(stream);
|
||||
|
||||
if (copy_out) {
|
||||
cudaError_t result = cudaMemcpy(&identity, workspace, sizeof(identity), cudaMemcpyDeviceToHost);
|
||||
if (result != cudaSuccess) {
|
||||
|
||||
Reference in New Issue
Block a user