Unverified Commit 3ba14932 authored by rocking5566's avatar rocking5566 Committed by GitHub
Browse files

Gemm test return value (#148)

* Add return value

* Replace _Float16 to ck::half_t

* A test should return 0 if success and return non-zero if fail
parent 12f4cfce
...@@ -113,4 +113,5 @@ int main() ...@@ -113,4 +113,5 @@ int main()
} }
std::cout << "TestGemm ..... " << (res ? "SUCCESS" : "FAILURE") << std::endl; std::cout << "TestGemm ..... " << (res ? "SUCCESS" : "FAILURE") << std::endl;
return res ? 0 : 1;
} }
...@@ -151,4 +151,5 @@ int main() ...@@ -151,4 +151,5 @@ int main()
} }
std::cout << "TestGemm ..... " << (res ? "SUCCESS" : "FAILURE") << std::endl; std::cout << "TestGemm ..... " << (res ? "SUCCESS" : "FAILURE") << std::endl;
return res ? 0 : 1;
} }
...@@ -151,4 +151,5 @@ int main() ...@@ -151,4 +151,5 @@ int main()
} }
std::cout << "TestGemm ..... " << (res ? "SUCCESS" : "FAILURE") << std::endl; std::cout << "TestGemm ..... " << (res ? "SUCCESS" : "FAILURE") << std::endl;
return res ? 0 : 1;
} }
...@@ -129,4 +129,5 @@ int main() ...@@ -129,4 +129,5 @@ int main()
} }
std::cout << "TestGemm ..... " << (res ? "SUCCESS" : "FAILURE") << std::endl; std::cout << "TestGemm ..... " << (res ? "SUCCESS" : "FAILURE") << std::endl;
return res ? 0 : 1;
} }
...@@ -105,11 +105,11 @@ check_err(const std::vector<T>& out, ...@@ -105,11 +105,11 @@ check_err(const std::vector<T>& out,
return res; return res;
} }
bool check_err(const std::vector<_Float16>& out, bool check_err(const std::vector<ck::half_t>& out,
const std::vector<_Float16>& ref, const std::vector<ck::half_t>& ref,
const std::string& msg, const std::string& msg,
_Float16 rtol = static_cast<_Float16>(1e-3f), ck::half_t rtol = static_cast<ck::half_t>(1e-3f),
_Float16 atol = static_cast<_Float16>(1e-3f)) ck::half_t atol = static_cast<ck::half_t>(1e-3f))
{ {
if(out.size() != ref.size()) if(out.size() != ref.size())
{ {
...@@ -122,7 +122,7 @@ bool check_err(const std::vector<_Float16>& out, ...@@ -122,7 +122,7 @@ bool check_err(const std::vector<_Float16>& out,
bool res{true}; bool res{true};
int err_count = 0; int err_count = 0;
double err = 0; double err = 0;
double max_err = std::numeric_limits<_Float16>::min(); double max_err = std::numeric_limits<ck::half_t>::min();
for(std::size_t i = 0; i < ref.size(); ++i) for(std::size_t i = 0; i < ref.size(); ++i)
{ {
double out_ = double(out[i]); double out_ = double(out[i]);
......
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