MCPcopy Create free account
hub / github.com/Tiiny-AI/PowerInfer / main

Function main

smallthinker/tests/test-gguf.cpp:1300–1344  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1298}
1299
1300int main(int argc, char ** argv) {
1301 if (argc > 2) {
1302 print_usage();
1303 return 1;
1304 }
1305
1306 std::random_device rd;
1307 const unsigned int seed = argc < 2 ? rd() : std::stoi(argv[1]);
1308
1309 // Initialize ggml backends early so the prints aren't interleaved with the test results:
1310 ggml_backend_dev_count();
1311 fprintf(stderr, "\n");
1312
1313 int npass = 0;
1314 int ntest = 0;
1315 {
1316 std::pair<int, int> result = test_handcrafted_file(seed);
1317 npass += result.first;
1318 ntest += result.second;
1319 }
1320
1321 for (size_t i = 0; i < ggml_backend_dev_count(); ++i) {
1322 ggml_backend_dev_t dev = ggml_backend_dev_get(i);
1323
1324 for (bool only_meta : {true, false}) {
1325 std::pair<int, int> result = test_roundtrip(dev, seed, only_meta);
1326 npass += result.first;
1327 ntest += result.second;
1328 }
1329
1330 {
1331 std::pair<int, int> result = test_gguf_set_kv(dev, seed);
1332 npass += result.first;
1333 ntest += result.second;
1334 }
1335 }
1336
1337 printf("%d/%d tests passed\n", npass, ntest);
1338 if (npass != ntest) {
1339 printf("\033[1;31mFAIL\033[0m\n");
1340 return 1;
1341 }
1342 printf("\033[1;32mOK\033[0m\n");
1343 return 0;
1344}

Callers

nothing calls this directly

Calls 8

ggml_backend_dev_countFunction · 0.85
fprintfFunction · 0.85
test_handcrafted_fileFunction · 0.85
ggml_backend_dev_getFunction · 0.85
test_roundtripFunction · 0.85
test_gguf_set_kvFunction · 0.85
printfFunction · 0.85
print_usageFunction · 0.70

Tested by

no test coverage detected