static void oil_print_impl (OilFunctionImpl *impl, OilTest *test, char* prefix) { char *c; unsigned int cpu_flags = oil_cpu_get_flags(); if (oil_impl_is_runnable (impl)) { oil_test_check_impl (test, impl); } printf ("%s%s\n", prefix, impl->name); c = oil_flags_to_string (impl->flags); if (c) { printf ("%s flags: %s\n", prefix, c); free (c); } if (impl->profile_ave) { printf ("%s profile: %g ticks (std.dev. %g)\n", prefix, impl->profile_ave, impl->profile_std); } if (test && !(impl->flags & OIL_IMPL_FLAG_REF)) { printf ("%s sum abs difference: %g (n=%d)\n", prefix, test->sum_abs_diff, test->n_points); } if ((impl->flags & OIL_CPU_FLAG_MASK) & (~cpu_flags)) { printf ("%s disabled\n", prefix); } }
int main (int argc, char *argv[]) { OilFunctionClass *klass; OilFunctionImpl *impl; OilTest *test; double ave, std; int n; oil_init (); if (argc < 2) { printf("oil-test <class_name>\n"); exit(0); } klass = oil_class_get (argv[1]); if (klass == NULL) { printf("class not found: %s\n", argv[1]); exit(0); } oil_class_optimize (klass); for (n = 0; n < 200; n+=1) { printf("%d", n); test = oil_test_new(klass); oil_test_set_iterations(test, 10); test->n = n; test->m = 10; impl = klass->reference_impl; ave = impl->profile_ave; std = impl->profile_std; oil_test_check_impl (test, impl); for (impl = klass->first_impl; impl; impl = impl->next) { if (oil_impl_is_usable (impl)) { oil_test_check_impl (test, impl); //printf(" %g %g", test->profile_ave, test->profile_std); printf(" %g", test->profile_ave); } } printf("\n"); } return 0; }
int main (int argc, char *argv[]) { OilFunctionClass *klass; OilFunctionImpl *impl; OilTest *test; int i; int n; //int j; int ret; unsigned int cpu_flags; //xmlfile = "test1"; std_log(LOG_FILENAME_LINE, "Test Started testsuite_test1"); oil_init (); cpu_flags = oil_cpu_get_flags (); //Returns a bitmask containing the available CPU features n = oil_class_get_n_classes (); for (i=0;i<n; i++ ){ klass = oil_class_get_by_index(i); printf("%s\n", klass->name); std_log(LOG_FILENAME_LINE, "class name = %s\n",klass->name); test = oil_test_new (klass); //Creates a new OilTest(structure describing how to test an OilFunctionImpl for an OilFunctionClass) for the OilFunctionClass represented by klass if (test == NULL) { std_log(LOG_FILENAME_LINE, "bad prototype"); printf(" bad prototype\n"); continue; } for (impl = klass->first_impl; impl; impl = impl->next) { printf(" %s\n", impl->name); if ((impl->flags & OIL_CPU_FLAG_MASK) & ~cpu_flags) { std_log(LOG_FILENAME_LINE, "not supported"); printf("not supported\n"); } else { test->n = 1600; ret = oil_test_check_impl (test, impl); //Runs the testing procedure described by test on the implementation impl if (ret) { #if 0 printf(" %lu %g\n",test->prof.min, (double)test->prof.total/test->prof.n); for(j=0;j<test->prof.hist_n;j++){ printf(" %lu %d\n",test->prof.hist_time[j],test->prof.hist_count[j]); } #endif printf(" ave=%g std=%g\n", impl->profile_ave, impl->profile_std); //hist(test); } else { printf(" not tested\n"); oil_test_free (test); std_log(LOG_FILENAME_LINE, "Test Failed"); create_xml(1); return 1; } } }//for loop oil_test_free (test); //Frees memory associated with test(OilTest) } std_log(LOG_FILENAME_LINE, "Test Successful"); create_xml(0); return 0; }
int main (int argc, char *argv[]) { OilFunctionClass *klass; OilFunctionImpl *impl; OilTest *test; int i; int n; int j; int ret; unsigned int cpu_flags; //xmlfile = "stride"; std_log(LOG_FILENAME_LINE, "Test Started testsuite_stride"); if (argc > 1 && strcmp(argv[1],"-v") == 0) { verbose = 1; } oil_init (); cpu_flags = oil_cpu_get_flags (); n = oil_class_get_n_classes (); for (i=0;i<n; i++ ) { klass = oil_class_get_by_index(i); std_log(LOG_FILENAME_LINE,"Class Name %s %d\n",klass->name, i); test = oil_test_new (klass); if (test == NULL) { std_log(LOG_FILENAME_LINE,"class \"%s\" has bad prototype\n", klass->name); assert_failed = fail = 1; continue; } oil_test_set_iterations (test, 1); test->n = 1 + oil_rand_u8(); test->m = 1 + oil_rand_u8(); std_log(LOG_FILENAME_LINE, "ref impl %s",klass->reference_impl->name); oil_test_check_impl (test, klass->reference_impl); //Testing whether an appropriate implementation is suitable or not //Runs the testing procedure described by test on the implementation impl for(j=0;j<OIL_ARG_LAST;j++) { if (test->params[j].is_stride) { test->params[j].value += oil_type_sizeof(test->params[j].type) * (oil_rand_u8()&0xf); } } test->inited = 0; for (impl = klass->first_impl; impl; impl = impl->next) { std_log(LOG_FILENAME_LINE," %s\n", impl->name); if ((impl->flags & OIL_CPU_FLAG_MASK) & ~cpu_flags){ std_log(LOG_FILENAME_LINE, "Not supported"); } else { ret = oil_test_check_impl (test, impl); if (!ret) { assert_failed = fail = 1; oil_test_free (test); std_log(LOG_FILENAME_LINE, "Test Failed"); create_xml(1); return fail; } } } oil_test_free (test); } if(assert_failed) std_log(LOG_FILENAME_LINE,"Test Fail"); else std_log(LOG_FILENAME_LINE,"Test Successful"); create_xml(0); return fail; }