MCPcopy Create free account
hub / github.com/appdevforall/CodeOnTheGo / main

Function main

subprojects/llama.cpp/tests/test-gguf.cpp:1311–1355  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected