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

Adding dummpy tensor_node_id interface in hpvm-tensor-rt

parent 9a30780c
No related branches found
No related tags found
No related merge requests found
......@@ -197,6 +197,11 @@ void *wrapper_tensorPooling(const char *hpvm_node_id, void *input_ptr,
void *wrapper_tensorSoftmax(const char *hpvm_node_id, void *input_ptr);
void *tensor_set_node_id(unsigned int node_id);
// Utilities
// TODO: separate utils in separate header
void dumpAccuracyNorms();
......
......@@ -62,4 +62,6 @@ void dummyFunction() {
void *tensorMap3 = (void *)&wrapper_tensorMap3;
void *tensorStencil = (void *)&wrapper_tensorStencil;
void *tensorCosineT = (void *)&wrapper_tensorCosineT;
void *tensorNodeID = (void*) &tensor_set_node_id;
}
......@@ -330,13 +330,20 @@ extern "C"{
std::vector< std::pair< GPUNodeConfiguration::TENSOR_OP,
std::vector< std::pair<GPUNodeConfiguration::APPROX,
int> > > > &ApproxChoices =
GPUConf->getApproxChoices();
GPUConf->getApproxChoices();
printf("*** Convolution \n ApproxChoice = %d \n BatchNorm = %d \n CONV = %d \n", ApproxChoices[0].first,
GPUNodeConfiguration::TENSOR_OP::BATCHNORM,
GPUNodeConfiguration::TENSOR_OP::CONV);
// Check for convolution as first operation
CUSTOM_ASSERT((ApproxChoices.size() >= 1) &&
(ApproxChoices[0].first == GPUNodeConfiguration::TENSOR_OP::CONV) &&
"Incorrect number/type of operations in provided Conv layer configuration");
void* conv_out = handleTensorConvApproximationTuples(ApproxChoices[0].second,
input, filter, conv_pad_h, conv_pad_w,
conv_stride_h, conv_stride_w);
......@@ -547,7 +554,7 @@ extern "C"{
std::vector< std::pair< GPUNodeConfiguration::TENSOR_OP,
std::vector< std::pair<GPUNodeConfiguration::APPROX,
int> > > > &ApproxChoices =
GPUConf->getApproxChoices();
GPUConf->getApproxChoices();
// Approximation choices must be for a FC wrapper operation
CUSTOM_ASSERT((ApproxChoices.size() == 2 || ApproxChoices.size() == 3) &&
......@@ -627,7 +634,7 @@ extern "C"{
std::vector< std::pair< GPUNodeConfiguration::TENSOR_OP,
std::vector< std::pair<GPUNodeConfiguration::APPROX,
int> > > > &ApproxChoices =
GPUConf->getApproxChoices();
GPUConf->getApproxChoices();
// Approximation choices must be for a relu operation
CUSTOM_ASSERT(ApproxChoices.size() == 1 &&
......@@ -649,7 +656,7 @@ extern "C"{
std::vector< std::pair< GPUNodeConfiguration::TENSOR_OP,
std::vector< std::pair<GPUNodeConfiguration::APPROX,
int> > > > &ApproxChoices =
GPUConf->getApproxChoices();
GPUConf->getApproxChoices();
// Approximation choices must be for a relu operation
CUSTOM_ASSERT(ApproxChoices.size() == 1 &&
......@@ -670,7 +677,7 @@ extern "C"{
std::vector< std::pair< GPUNodeConfiguration::TENSOR_OP,
std::vector< std::pair<GPUNodeConfiguration::APPROX,
int> > > > &ApproxChoices =
GPUConf->getApproxChoices();
GPUConf->getApproxChoices();
// Approximation choices must be for a tanh operation
CUSTOM_ASSERT(ApproxChoices.size() == 1 &&
......@@ -686,7 +693,7 @@ extern "C"{
void* wrapper_tensorBatchNorm(const char* hpvm_node_id,
void* input_ptr, void* gamma_ptr, void* beta_ptr,
void* mean_ptr, void* variance_ptr, double epsilon){
// return tensorBatchNorm(input_ptr, gamma_ptr, beta_ptr, mean_ptr, variance_ptr, epsilon);
// Only mapped to GPU - get a GPU configuration
GPUNodeConfiguration *GPUConf =
......@@ -695,7 +702,13 @@ extern "C"{
std::vector< std::pair< GPUNodeConfiguration::TENSOR_OP,
std::vector< std::pair<GPUNodeConfiguration::APPROX,
int> > > > &ApproxChoices =
GPUConf->getApproxChoices();
GPUConf->getApproxChoices();
printf("*** BatchNorm \n ApproxChoice = %d \n BatchNorm = %d \n CONV = %d \n", ApproxChoices[0].first,
GPUNodeConfiguration::TENSOR_OP::BATCHNORM,
GPUNodeConfiguration::TENSOR_OP::CONV);
// Approximation choices must be for a batchnorm operation
CUSTOM_ASSERT(ApproxChoices.size() == 1 &&
......@@ -719,7 +732,8 @@ extern "C"{
std::vector< std::pair< GPUNodeConfiguration::TENSOR_OP,
std::vector< std::pair<GPUNodeConfiguration::APPROX,
int> > > > &ApproxChoices =
GPUConf->getApproxChoices();
GPUConf->getApproxChoices();
// Approximation choices must be for an add operation
CUSTOM_ASSERT(ApproxChoices.size() == 1 &&
......@@ -749,7 +763,8 @@ extern "C"{
std::vector< std::pair< GPUNodeConfiguration::TENSOR_OP,
std::vector< std::pair<GPUNodeConfiguration::APPROX,
int> > > > &ApproxChoices =
GPUConf->getApproxChoices();
GPUConf->getApproxChoices();
// Approximation choices must be for a single operation
CUSTOM_ASSERT(ApproxChoices.size() == 1 &&
......@@ -782,7 +797,7 @@ extern "C"{
std::vector< std::pair< GPUNodeConfiguration::TENSOR_OP,
std::vector< std::pair<GPUNodeConfiguration::APPROX,
int> > > > &ApproxChoices =
GPUConf->getApproxChoices();
GPUConf->getApproxChoices();
// Approximation choices must be for a group_conv operation
CUSTOM_ASSERT(ApproxChoices.size() == 1 &&
......@@ -809,7 +824,7 @@ extern "C"{
std::vector< std::pair< GPUNodeConfiguration::TENSOR_OP,
std::vector< std::pair<GPUNodeConfiguration::APPROX,
int> > > > &ApproxChoices =
GPUConf->getApproxChoices();
GPUConf->getApproxChoices();
// Approximation choices must be for a softmax operation
CUSTOM_ASSERT(ApproxChoices.size() == 1 &&
......@@ -822,4 +837,10 @@ extern "C"{
}
void* tensor_set_node_id(unsigned int node_id){
return NULL;
}
}
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