mirror of
https://github.com/ggerganov/llama.cpp.git
synced 2024-12-25 19:04:35 +00:00
test-backend-ops : skip CPU backend by default (#6028)
This commit is contained in:
parent
b3d978600f
commit
d8fd0ccf6a
@ -2222,8 +2222,8 @@ static void usage(char ** argv) {
|
|||||||
|
|
||||||
int main(int argc, char ** argv) {
|
int main(int argc, char ** argv) {
|
||||||
test_mode mode = MODE_TEST;
|
test_mode mode = MODE_TEST;
|
||||||
const char * op_name = NULL;
|
const char * op_name_filter = NULL;
|
||||||
const char * backend = NULL;
|
const char * backend_filter = NULL;
|
||||||
|
|
||||||
for (int i = 1; i < argc; i++) {
|
for (int i = 1; i < argc; i++) {
|
||||||
if (strcmp(argv[i], "test") == 0) {
|
if (strcmp(argv[i], "test") == 0) {
|
||||||
@ -2232,14 +2232,14 @@ int main(int argc, char ** argv) {
|
|||||||
mode = MODE_PERF;
|
mode = MODE_PERF;
|
||||||
} else if (strcmp(argv[i], "-o") == 0) {
|
} else if (strcmp(argv[i], "-o") == 0) {
|
||||||
if (i + 1 < argc) {
|
if (i + 1 < argc) {
|
||||||
op_name = argv[++i];
|
op_name_filter = argv[++i];
|
||||||
} else {
|
} else {
|
||||||
usage(argv);
|
usage(argv);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
} else if (strcmp(argv[i], "-b") == 0) {
|
} else if (strcmp(argv[i], "-b") == 0) {
|
||||||
if (i + 1 < argc) {
|
if (i + 1 < argc) {
|
||||||
backend = argv[++i];
|
backend_filter = argv[++i];
|
||||||
} else {
|
} else {
|
||||||
usage(argv);
|
usage(argv);
|
||||||
return 1;
|
return 1;
|
||||||
@ -2258,7 +2258,7 @@ int main(int argc, char ** argv) {
|
|||||||
for (size_t i = 0; i < ggml_backend_reg_get_count(); i++) {
|
for (size_t i = 0; i < ggml_backend_reg_get_count(); i++) {
|
||||||
printf("Backend %zu/%zu (%s)\n", i + 1, ggml_backend_reg_get_count(), ggml_backend_reg_get_name(i));
|
printf("Backend %zu/%zu (%s)\n", i + 1, ggml_backend_reg_get_count(), ggml_backend_reg_get_name(i));
|
||||||
|
|
||||||
if (backend != NULL && strcmp(backend, ggml_backend_reg_get_name(i)) != 0) {
|
if (backend_filter != NULL && strcmp(backend_filter, ggml_backend_reg_get_name(i)) != 0) {
|
||||||
printf(" Skipping\n");
|
printf(" Skipping\n");
|
||||||
n_ok++;
|
n_ok++;
|
||||||
continue;
|
continue;
|
||||||
@ -2266,9 +2266,17 @@ int main(int argc, char ** argv) {
|
|||||||
|
|
||||||
ggml_backend_t backend = ggml_backend_reg_init_backend(i, NULL);
|
ggml_backend_t backend = ggml_backend_reg_init_backend(i, NULL);
|
||||||
GGML_ASSERT(backend != NULL);
|
GGML_ASSERT(backend != NULL);
|
||||||
|
|
||||||
|
if (backend_filter == NULL && ggml_backend_is_cpu(backend)) {
|
||||||
|
printf(" Skipping CPU backend\n");
|
||||||
|
ggml_backend_free(backend);
|
||||||
|
n_ok++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
printf(" Backend name: %s\n", ggml_backend_name(backend));
|
printf(" Backend name: %s\n", ggml_backend_name(backend));
|
||||||
|
|
||||||
bool ok = test_backend(backend, mode, op_name);
|
bool ok = test_backend(backend, mode, op_name_filter);
|
||||||
|
|
||||||
printf(" Backend %s: ", ggml_backend_name(backend));
|
printf(" Backend %s: ", ggml_backend_name(backend));
|
||||||
if (ok) {
|
if (ok) {
|
||||||
|
Loading…
Reference in New Issue
Block a user