File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change 33#include " ggml.h"
44#include " ggml-alloc.h"
55#include " ggml-backend.h"
6- #include " ggml-cpu.h"
76#include " ggml-opt.h"
87
98#include < cmath>
@@ -899,6 +898,7 @@ static std::pair<int, int> test_backend(
899898
900899int main (void ) {
901900 ggml_log_set (nullptr , nullptr );
901+ ggml_backend_load_all ();
902902 const size_t dev_count = ggml_backend_dev_count ();
903903 printf (" Testing %zu devices\n\n " , dev_count);
904904 size_t n_ok = 0 ;
@@ -911,11 +911,12 @@ int main(void) {
911911
912912 ggml_backend_t backend = ggml_backend_dev_init (devs[i], NULL );
913913 GGML_ASSERT (backend != NULL );
914- #ifndef _MSC_VER
915- if (ggml_backend_is_cpu (backend)) {
916- ggml_backend_cpu_set_n_threads (backend, std::thread::hardware_concurrency () / 2 );
914+
915+ auto * reg = ggml_backend_dev_backend_reg (devs[i]);
916+ auto ggml_backend_set_n_threads_fn = (ggml_backend_set_n_threads_t ) ggml_backend_reg_get_proc_address (reg, " ggml_backend_set_n_threads" );
917+ if (ggml_backend_set_n_threads_fn) {
918+ ggml_backend_set_n_threads_fn (backend, std::thread::hardware_concurrency () / 2 );
917919 }
918- #endif
919920 backends.push_back (backend);
920921 }
921922
You can’t perform that action at this time.
0 commit comments