Commit 833a6e42 authored by Bram Veenboer's avatar Bram Veenboer

Add cu::Marker to copy_htod and copy_dtoh

Make these markers (including the preexisting marker vor copy_htoh) less
verbose: include only the number of bytes copied.
parent 201df342
...@@ -928,7 +928,7 @@ namespace idg { ...@@ -928,7 +928,7 @@ namespace idg {
size_t bytes) size_t bytes)
{ {
char message[80]; char message[80];
snprintf(message, 80, "copy_htoh(%p, %p, %lu)", dst, src, bytes); snprintf(message, 80, "copy_htoh(%lu)", bytes);
cu::Marker marker(message, 0xffff0000); cu::Marker marker(message, 0xffff0000);
marker.start(); marker.start();
size_t batch = 1024 * 1024 * 1024; // 1024 Mb size_t batch = 1024 * 1024 * 1024; // 1024 Mb
...@@ -948,6 +948,10 @@ namespace idg { ...@@ -948,6 +948,10 @@ namespace idg {
cu::DeviceMemory &src, cu::DeviceMemory &src,
size_t bytes) size_t bytes)
{ {
char message[80];
snprintf(message, 80, "copy_dtoh(%lu)", bytes);
cu::Marker marker(message, 0xffff0000);
marker.start();
size_t batch = 1024 * 1024 * 1024; // 1024 Mb size_t batch = 1024 * 1024 * 1024; // 1024 Mb
cu::HostMemory tmp(batch); cu::HostMemory tmp(batch);
for (size_t i = 0; i < bytes; i += batch) { for (size_t i = 0; i < bytes; i += batch) {
...@@ -958,6 +962,7 @@ namespace idg { ...@@ -958,6 +962,7 @@ namespace idg {
stream.synchronize(); stream.synchronize();
memcpy((void *) dst_ptr, tmp, n); memcpy((void *) dst_ptr, tmp, n);
} }
marker.end();
} }
void InstanceCUDA::copy_htod( void InstanceCUDA::copy_htod(
...@@ -966,6 +971,10 @@ namespace idg { ...@@ -966,6 +971,10 @@ namespace idg {
void *src, void *src,
size_t bytes) size_t bytes)
{ {
char message[80];
snprintf(message, 80, "copy_htod(%lu)", bytes);
cu::Marker marker(message, 0xffff0000);
marker.start();
size_t batch = 1024 * 1024 * 1024; // 1024 Mb size_t batch = 1024 * 1024 * 1024; // 1024 Mb
cu::HostMemory tmp(batch); cu::HostMemory tmp(batch);
for (size_t i = 0; i < bytes; i += batch) { for (size_t i = 0; i < bytes; i += batch) {
...@@ -976,6 +985,7 @@ namespace idg { ...@@ -976,6 +985,7 @@ namespace idg {
stream.memcpyHtoDAsync((CUdeviceptr) dst_ptr, tmp, n); stream.memcpyHtoDAsync((CUdeviceptr) dst_ptr, tmp, n);
stream.synchronize(); stream.synchronize();
} }
marker.end();
} }
/* /*
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment