Unverified Commit 4e05b47e by Tianqi Chen Committed by GitHub

[BUGFIX] Fix CRT static test bug (#5293)

* [CI][DOCS] Make sure to refresh the cython part

* [BUGFIX] Fix CRT static test bug

* Fix demo_static

* resolve review comment
parent ea063888
......@@ -22,6 +22,7 @@
#include <assert.h>
#include <stdio.h>
#include <sys/time.h>
#include <stdlib.h>
#include <float.h>
#include "bundle.h"
......@@ -56,7 +57,7 @@ int main(int argc, char **argv) {
DLDataType dtype = {kDLFloat, 32, 1};
input.dtype = dtype;
int64_t shape [4] = {1, 3, 224, 224};
input.shape = &shape;
input.shape = shape;
input.strides = NULL;
input.byte_offset = 0;
......@@ -74,8 +75,8 @@ int main(int argc, char **argv) {
output.ndim = 2;
DLDataType out_dtype = {kDLFloat, 32, 1};
output.dtype = out_dtype;
int64_t out_shape [2] = {1, OUTPUT_LEN};
output.shape = &out_shape;
int64_t out_shape[2] = {1, OUTPUT_LEN};
output.shape = out_shape;
output.strides = NULL;
output.byte_offset = 0;
......@@ -98,11 +99,11 @@ int main(int argc, char **argv) {
max_index, max_iter);
printf("timing: %.2f ms (create), %.2f ms (set_input), %.2f ms (run), "
"%.2f ms (get_output), %.2f ms (destroy)\n",
(t1.tv_sec-t0.tv_sec)*1000000 + (t1.tv_usec-t0.tv_usec)/1000.f,
(t2.tv_sec-t1.tv_sec)*1000000 + (t2.tv_usec-t1.tv_usec)/1000.f,
(t3.tv_sec-t2.tv_sec)*1000000 + (t3.tv_usec-t2.tv_usec)/1000.f,
(t4.tv_sec-t3.tv_sec)*1000000 + (t4.tv_usec-t3.tv_usec)/1000.f,
(t5.tv_sec-t4.tv_sec)*1000000 + (t5.tv_usec-t4.tv_usec)/1000.f);
(t1.tv_sec-t0.tv_sec)*1000 + (t1.tv_usec-t0.tv_usec)/1000.f,
(t2.tv_sec-t1.tv_sec)*1000 + (t2.tv_usec-t1.tv_usec)/1000.f,
(t3.tv_sec-t2.tv_sec)*1000 + (t3.tv_usec-t2.tv_usec)/1000.f,
(t4.tv_sec-t3.tv_sec)*1000 + (t4.tv_usec-t3.tv_usec)/1000.f,
(t5.tv_sec-t4.tv_sec)*1000 + (t5.tv_usec-t4.tv_usec)/1000.f);
return 0;
}
......@@ -21,6 +21,8 @@
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <sys/time.h>
#include <sys/stat.h>
......@@ -71,8 +73,8 @@ int main(int argc, char **argv) {
input.ndim = 2;
DLDataType dtype = {kDLFloat, 32, 1};
input.dtype = dtype;
int64_t shape [2] = {10, 5};
input.shape = &shape;
int64_t shape[2] = {10, 5};
input.shape = shape;
input.strides = NULL;
input.byte_offset = 0;
......@@ -90,15 +92,15 @@ int main(int argc, char **argv) {
output.ndim = 2;
DLDataType out_dtype = {kDLFloat, 32, 1};
output.dtype = out_dtype;
int64_t out_shape [2] = {10, 5};
output.shape = &out_shape;
int64_t out_shape[2] = {10, 5};
output.shape = out_shape;
output.strides = NULL;
output.byte_offset = 0;
tvm_runtime_get_output(handle, 0, &output);
gettimeofday(&t4, 0);
for (auto i = 0; i < 10 * 5; ++i) {
for (int i = 0; i < 10 * 5; ++i) {
assert(fabs(output_storage[i] - result_storage[i]) < 1e-5f);
if (fabs(output_storage[i] - result_storage[i]) >= 1e-5f) {
printf("got %f, expected %f\n", output_storage[i], result_storage[i]);
......@@ -110,14 +112,14 @@ int main(int argc, char **argv) {
printf("timing: %.2f ms (create), %.2f ms (set_input), %.2f ms (run), "
"%.2f ms (get_output), %.2f ms (destroy)\n",
(t1.tv_sec-t0.tv_sec)*1000000 + (t1.tv_usec-t0.tv_usec)/1000.f,
(t2.tv_sec-t1.tv_sec)*1000000 + (t2.tv_usec-t1.tv_usec)/1000.f,
(t3.tv_sec-t2.tv_sec)*1000000 + (t3.tv_usec-t2.tv_usec)/1000.f,
(t4.tv_sec-t3.tv_sec)*1000000 + (t4.tv_usec-t3.tv_usec)/1000.f,
(t5.tv_sec-t4.tv_sec)*1000000 + (t5.tv_usec-t4.tv_usec)/1000.f);
(t1.tv_sec-t0.tv_sec)*1000 + (t1.tv_usec-t0.tv_usec)/1000.f,
(t2.tv_sec-t1.tv_sec)*1000 + (t2.tv_usec-t1.tv_usec)/1000.f,
(t3.tv_sec-t2.tv_sec)*1000 + (t3.tv_usec-t2.tv_usec)/1000.f,
(t4.tv_sec-t3.tv_sec)*1000 + (t4.tv_usec-t3.tv_usec)/1000.f,
(t5.tv_sec-t4.tv_sec)*1000 + (t5.tv_usec-t4.tv_usec)/1000.f);
free(json_data);
free(params_data);
return 0;
}
......@@ -32,6 +32,7 @@ rm -rf docs/vta/tutorials
# cleanup stale log files
find . -type f -path "*.log" | xargs rm -f
find . -type f -path "*.pyc" | xargs rm -f
make cython3
cd docs
PYTHONPATH=`pwd`/../python make html
......
......@@ -23,7 +23,11 @@ set -o pipefail
cleanup()
{
rm -rf /tmp/$$.*
# cat error log if non zero exit
if [ $? ]; then
cat /tmp/$$.log.txt
fi
rm -rf /tmp/$$.*
}
trap cleanup 0
......@@ -31,6 +35,7 @@ trap cleanup 0
rm -rf docs/tutorials
rm -rf docs/vta/tutorials
find . -type f -path "*.pyc" | xargs rm -f
make cython3
echo "PreCheck sphinx doc generation WARNINGS.."
cd docs
......
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