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

Adding exit(1) for failed tests

parent faf9ac0a
No related branches found
No related tags found
No related merge requests found
...@@ -70,6 +70,13 @@ public: ...@@ -70,6 +70,13 @@ public:
for (int i = 0; i < failed_test_ids.size(); i++) { for (int i = 0; i < failed_test_ids.size(); i++) {
printf("*** Test = %s \n", failed_test_ids[i].c_str()); printf("*** Test = %s \n", failed_test_ids[i].c_str());
} }
if (failed_test_ids.size() > 0){
printf("Some Tests Failed. Aborting");
exit(1);
}
} }
}; };
...@@ -82,44 +89,19 @@ void testSampleFilter() { ...@@ -82,44 +89,19 @@ void testSampleFilter() {
printf("***** Tensor Sample Filter ***** \n\n"); printf("***** Tensor Sample Filter ***** \n\n");
Tensor *input = Tensor *input =
(Tensor *)create4DTensor(CUDNN_DATA_FLOAT, CUDNN_TENSOR_NCHW, 2, 2, 3, 3); (Tensor *)create4DTensor(CUDNN_DATA_FLOAT, CUDNN_TENSOR_NCHW, 2, 2, 3, 3);
// fillTensorWithVal(input, 3);
fillWithOnesAndTwos(input); fillWithOnesAndTwos(input);
Tensor *input2 = (Tensor *)create4DTensor(CUDNN_DATA_FLOAT, CUDNN_TENSOR_NCHW, Tensor *input2 = (Tensor *)create4DTensor(CUDNN_DATA_FLOAT, CUDNN_TENSOR_NCHW,
3, 2, 32, 32); 3, 2, 32, 32);
fillTensorWithVal(input2, 1); fillTensorWithVal(input2, 1);
/* float* host_ptr = (float*) ((struct Tensor*) input)->host_data;
host_ptr[0] = -0.1;
host_ptr[1] = -25;
host_ptr[2] = 0.2;
host_ptr[3] = -0.4;
host_ptr[4] = 1.7;
host_ptr[5] = -2.9;
host_ptr[6] = 0.7;
host_ptr[7] = 0.99;
*/
printTensorValues(input); printTensorValues(input);
/* printf("\n\n");
hpvm_request_tensor(input, DEVICE);
sampleFilter(input, 2, 1);
hpvm_request_tensor(input, HOST);
printTensorValues(input);
*/
void *exact_res = tensorConvolution(input2, input, 0, 0, 1, 1, 1, 1); void *exact_res = tensorConvolution(input2, input, 0, 0, 1, 1, 1, 1);
printTensorValues(exact_res); printTensorValues(exact_res);
void *res = tensorConvSampSim(input2, input, 0, 0, 1, 1, 1, 1, 4, 0); void *res = tensorConvSampSim(input2, input, 0, 0, 1, 1, 1, 1, 4, 0);
// void* res = tensorConvApprox(input2, input, 0, 0, 1, 1, 1, 1, 1, 1, 4, 3);
printTensorValues(res); printTensorValues(res);
} }
...@@ -160,7 +142,7 @@ void testPerforationCalls(void *input, void *filter, int pad_h, int pad_w, ...@@ -160,7 +142,7 @@ void testPerforationCalls(void *input, void *filter, int pad_h, int pad_w,
printTensorValues(res_sim); printTensorValues(res_sim);
void *res = tensorConvApprox(input, filter, pad_h, pad_w, stride_h, void *res = tensorConvApprox(input, filter, pad_h, pad_w, stride_h,
stride_w, 1, 1, row, col, 1, offset); stride_w, 1, 1, row, col, 1, offset);
printf("\nConvApprox Result :"); printf("\nConvApprox Result :");
printTensorValues(res); printTensorValues(res);
...@@ -199,7 +181,7 @@ void testPerforationCalls(void *input, void *filter, int pad_h, int pad_w, ...@@ -199,7 +181,7 @@ void testPerforationCalls(void *input, void *filter, int pad_h, int pad_w,
std::string fp16_test_name = std::string("PERF_FP16 ") + suffix; std::string fp16_test_name = std::string("PERF_FP16 ") + suffix;
unitTestResults.compareTensors((Tensor *)res_half, (Tensor *)res_sim, 0.1, unitTestResults.compareTensors((Tensor *)res_half, (Tensor *)res_sim, 0.1,
fp16_test_name); fp16_test_name);
std::string cpu_test_name = std::string("PERF_CPU ") + suffix; std::string cpu_test_name = std::string("PERF_CPU ") + suffix;
unitTestResults.compareTensors((Tensor *)res_cpu, (Tensor *)res_sim, 0.05, unitTestResults.compareTensors((Tensor *)res_cpu, (Tensor *)res_sim, 0.05,
......
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