Skip to content
Snippets Groups Projects
Commit 1c242789 authored by Hashim Sharif's avatar Hashim Sharif
Browse files

Moving many INFO() calls to DEBUG() - disabled by default

parent d164459d
No related branches found
No related tags found
No related merge requests found
......@@ -3,7 +3,7 @@
#ifndef RUNTIME_DEBUG
#define RUNTIME_DEBUG
#define LOG_DEBUG 1 // Sets the debug logging to true
#define LOG_DEBUG 0 // Sets the debug logging to true
#define LOG_INFO 1 // Sets the info logging to true
#define ASSERT_FLAG // Sets assertions to true (opposite of NDEBUG macro)
......
......@@ -49,8 +49,8 @@ void* tensorHalfGemm(void* lhs_ptr, void* rhs_ptr){
Tensor* lhs = (Tensor*) lhs_ptr;
Tensor* rhs = (Tensor*) rhs_ptr;
INFO("rhs->dims.num_dims = %d \n", rhs->dims.num_dims);
INFO("lhs->dims.num_dims = %d \n", lhs->dims.num_dims);
DEBUG("rhs->dims.num_dims = %d \n", rhs->dims.num_dims);
DEBUG("lhs->dims.num_dims = %d \n", lhs->dims.num_dims);
hostToDeviceCopy(lhs);
hostToDeviceCopy(rhs);
......@@ -76,7 +76,7 @@ void* tensorHalfGemm(void* lhs_ptr, void* rhs_ptr){
int rhs_k = rhs->dims.dim_sizes[rhs->dims.num_dims-2];
// Dimension-note: Check if k is same across the two tensors
INFO("m = %d, n = %d, k = %d \n", m, n, k);
DEBUG("m = %d, n = %d, k = %d \n", m, n, k);
if(rhs_k != k){
ERROR("rhs=%d and lhs=%d columns/rows don't match", rhs_k, k);
}
......@@ -115,14 +115,10 @@ void* tensorHalfGemm(void* lhs_ptr, void* rhs_ptr){
//h2f((half*) output_half->gpu_data, output->num_elems, (float*) output->gpu_data);
profileEvent("H2F_end");
profileEvent("#tensorHalfGemm_end");
return output;
}
......@@ -263,18 +259,14 @@ void* tensorHalfConvolution(void* input_ptr, void* filter_ptr,
output->tensor_half_desc,
output->gpu_half_data));
profileEvent("H2F_start");
convertToFP32_offline(output);
profileEvent("H2F_end");
profileEvent("#tensorHalfConv_end");
return output;
}
......
......@@ -64,7 +64,7 @@ void profileEvent(const char *event_name, bool compare_previous = false) {
std::chrono::duration<double, std::ratio<1>> current_time =
time_reading - zero_time;
INFO("AbsoluteTime, Event = %s, Time = %f \n", event_name,
DEBUG("AbsoluteTime, Event = %s, Time = %f \n", event_name,
current_time.count());
profile_data.append(event_name);
profile_data.append(event_count);
......@@ -77,7 +77,7 @@ void profileEvent(const char *event_name, bool compare_previous = false) {
profile_data.append("\t");
profile_data.append(std::to_string(duration_time.count()));
INFO("TimeDuration, Event = %s, Time = %f \n", event_name,
DEBUG("TimeDuration, Event = %s, Time = %f \n", event_name,
duration_time.count());
}
......
......@@ -68,8 +68,8 @@ void* tensorAdd(void* x_ptr, void* bias_ptr){
convertToFP32(bias);
INFO("x->num_elems = %d \n", x->num_elems);
INFO("bias->num_elems = %d \n", bias->num_elems);
DEBUG("x->num_elems = %d \n", x->num_elems);
DEBUG("bias->num_elems = %d \n", bias->num_elems);
if(cudnnHandle == NULL){
ERROR("cudnnHandle NOT initialized!! \n");
......@@ -132,7 +132,7 @@ void* tensorConvolution(void* input_ptr, void* filter_ptr,
convertToFP32(filter);
INFO("vertical_stride = %lu, horizontal_stride = %lu \n", vertical_stride, horizontal_stride);
DEBUG("vertical_stride = %lu, horizontal_stride = %lu \n", vertical_stride, horizontal_stride);
checkCUDNN(cudnnCreateConvolutionDescriptor(&convDesc));
......@@ -363,8 +363,8 @@ void* tensorGemmGPU(void* lhs_ptr, void* rhs_ptr ){
Tensor* rhs = (Tensor*) rhs_ptr;
INFO("rhs->dims.num_dims = %d \n", rhs->dims.num_dims);
INFO("lhs->dims.num_dims = %d \n", lhs->dims.num_dims);
DEBUG("rhs->dims.num_dims = %d \n", rhs->dims.num_dims);
DEBUG("lhs->dims.num_dims = %d \n", lhs->dims.num_dims);
// FIXIT: Need to be more aware of the implications of alpha and beta
float alpha = 1.0f, beta = 0.0f;
......@@ -382,7 +382,7 @@ void* tensorGemmGPU(void* lhs_ptr, void* rhs_ptr ){
int rhs_k = rhs->dims.dim_sizes[rhs->dims.num_dims-2];
// Dimension-note: Check if k is same across the two tensors
INFO("m = %d, n = %d, k = %d \n", m, n, k);
DEBUG("m = %d, n = %d, k = %d \n", m, n, k);
if(rhs_k != k){
ERROR("rhs=%d and lhs=%d columns/rows don't match", rhs_k, k);
}
......@@ -450,7 +450,7 @@ void* tensorGemmGPU(void* lhs_ptr, void* rhs_ptr ){
void* tensorRelu(void* input_ptr){
INFO("*** TensorRelu \n");
DEBUG("*** TensorRelu \n");
profileEvent("Relu");
Tensor* input = (Tensor*) input_ptr;
......@@ -700,7 +700,7 @@ void** tensorSplit(void* tensor_ptr, int num_splits, int split_dim){
for(unsigned int i = 0; i < num_splits; i++){
INFO("dim_sizes[0] = %d, dim_sizes[1] = %d, dim_sizes[2] = %d, dim_sizes[3] = %d \n",
DEBUG("dim_sizes[0] = %d, dim_sizes[1] = %d, dim_sizes[2] = %d, dim_sizes[3] = %d \n",
dim_sizes[0], dim_sizes[1], dim_sizes[2], dim_sizes[3]);
Tensor* split = (Tensor*) create4DTensor(tensor->data_type, tensor->data_format,
......@@ -708,7 +708,7 @@ void** tensorSplit(void* tensor_ptr, int num_splits, int split_dim){
size_t copy_start = i * copy_size;
size_t copy_stride = num_splits * copy_size;
INFO("copy_size = %d, copy_start = %d, copy_stride = %d, tensor->size_in_bytes = %d \n",
DEBUG("copy_size = %d, copy_start = %d, copy_stride = %d, tensor->size_in_bytes = %d \n",
copy_size, copy_start, copy_stride, tensor->size_in_bytes);
int index = 0;
......@@ -758,7 +758,7 @@ void* tensorConcat(void** tensors_ptr, int num_splits, int split_dim){
Tensor* output = (Tensor*) create4DTensor(tensors[0]->data_type, tensors[0]->data_format,
dim_sizes[0], dim_sizes[1], dim_sizes[2], dim_sizes[3]);
INFO("dim_sizes[0] = %d, dim_sizes[1] = %d, dim_sizes[2] = %d, dim_sizes[3] = %d \n",
DEBUG("dim_sizes[0] = %d, dim_sizes[1] = %d, dim_sizes[2] = %d, dim_sizes[3] = %d \n",
dim_sizes[0], dim_sizes[1], dim_sizes[2], dim_sizes[3]);
......@@ -768,7 +768,7 @@ void* tensorConcat(void** tensors_ptr, int num_splits, int split_dim){
}
size_t copy_stride = num_splits * copy_size;
INFO("copy_size = %d, num_copies = %d, copy_stride = %d, output->size_in_bytes = %d \n",
DEBUG("copy_size = %d, num_copies = %d, copy_stride = %d, output->size_in_bytes = %d \n",
copy_size, num_copies, copy_stride, output->size_in_bytes);
for(unsigned int i = 0; i < num_copies; i++){
......@@ -804,7 +804,7 @@ void* tensorLRN(void* input_ptr, unsigned int LRN_window,
cudnnLRNDescriptor_t LRNDesc;
checkCUDNN(cudnnCreateLRNDescriptor(&LRNDesc));
INFO("window = %d, LRN_alpha = %f, LRN_beta = %f, LRN_k = %f \n",
DEBUG("window = %d, LRN_alpha = %f, LRN_beta = %f, LRN_k = %f \n",
LRN_window, LRN_alpha, LRN_beta, LRN_k);
......
......@@ -220,7 +220,7 @@ void set4DTensorDescriptor(struct Tensor* tensor, int data_format, size_t dim1_s
&size1, &size2, &size3, &size4,
&nStride, &cStride, &hStride, &wStride);
INFO("nStride = %d, cStride = %d, hStride = %d, wStride = %d \n",
DEBUG("nStride = %d, cStride = %d, hStride = %d, wStride = %d \n",
nStride, cStride, hStride, wStride);
}
......@@ -238,16 +238,16 @@ void setTensorDescriptor(struct Tensor* tensor, int num_dims,
}
for(int i = 0; i < num_dims; i++){
INFO("strides[%d] = %d \n", i, strides[i]);
DEBUG("strides[%d] = %d \n", i, strides[i]);
}
int* const_dims = (int*) malloc(sizeof(int) * num_dims);
for(int j = 0 ; j < num_dims; j++){
const_dims[j] = (int) dim_sizes[j];
INFO("const_dim = %d \n", const_dims[j]);
DEBUG("const_dim = %d \n", const_dims[j]);
}
INFO("data_type = %d, cuDNN_value = %d \n", tensor->data_type, CUDNN_DATA_FLOAT);
DEBUG("data_type = %d, cuDNN_value = %d \n", tensor->data_type, CUDNN_DATA_FLOAT);
// For certain operations, the strides may need to change - in which case the descriptor
// needs to be reinitialized
checkCUDNN(cudnnSetTensorNdDescriptor(tensor->tensor_desc,
......@@ -340,7 +340,7 @@ void setTensorDescriptor(struct Tensor* tensor, int num_dims,
if(tensor->data_placement != DEVICE){
cudaMemcpy(tensor->gpu_data, tensor->host_data, tensor->size_in_bytes,
cudaMemcpyHostToDevice);
INFO("Moving %d bytes from host to GPU \n", tensor->size_in_bytes);
DEBUG("Moving %d bytes from host to GPU \n", tensor->size_in_bytes);
tensor->data_placement = DEVICE;
}
else{
......@@ -355,7 +355,7 @@ void setTensorDescriptor(struct Tensor* tensor, int num_dims,
if(tensor->data_placement != HOST){
cudaMemcpy(tensor->host_data, tensor->gpu_data, tensor->size_in_bytes,
cudaMemcpyDeviceToHost);
INFO("Moving %d bytes from GPU to host \n", tensor->size_in_bytes);
DEBUG("Moving %d bytes from GPU to host \n", tensor->size_in_bytes);
tensor->data_placement = HOST;
}
else{
......@@ -375,13 +375,13 @@ void setTensorDescriptor(struct Tensor* tensor, int num_dims,
if(srcTensor->data_placement == HOST){
memcpy(dstTensor->host_data, srcTensor->host_data, srcTensor->size_in_bytes);
INFO("Moving %d bytes from host to host \n", srcTensor->size_in_bytes);
DEBUG("Moving %d bytes from host to host \n", srcTensor->size_in_bytes);
dstTensor->data_placement = HOST;
}
else if (srcTensor->data_placement == DEVICE){
cudaMemcpy(dstTensor->gpu_data, srcTensor->gpu_data, srcTensor->size_in_bytes,
cudaMemcpyDeviceToDevice);
INFO("Moving %d bytes from GPU to GPU \n", srcTensor->size_in_bytes);
DEBUG("Moving %d bytes from GPU to GPU \n", srcTensor->size_in_bytes);
dstTensor->data_placement = DEVICE;
}
......@@ -409,7 +409,7 @@ void setTensorDescriptor(struct Tensor* tensor, int num_dims,
if(tensor->data_placement != DEVICE){
cudaMemcpy(tensor->gpu_data, tensor->host_data, tensor->size_in_bytes,
cudaMemcpyHostToDevice);
INFO("Moving %d bytes from host to GPU \n", tensor->size_in_bytes);
DEBUG("Moving %d bytes from host to GPU \n", tensor->size_in_bytes);
tensor->data_placement = DEVICE;
}
else{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment