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 3
3
#include " ggml.h"
4
4
#include " ggml-alloc.h"
5
5
#include " ggml-backend.h"
6
- #include " ggml-cpu.h"
7
6
#include " ggml-opt.h"
8
7
9
8
#include < cmath>
@@ -899,6 +898,7 @@ static std::pair<int, int> test_backend(
899
898
900
899
int main (void ) {
901
900
ggml_log_set (nullptr , nullptr );
901
+ ggml_backend_load_all ();
902
902
const size_t dev_count = ggml_backend_dev_count ();
903
903
printf (" Testing %zu devices\n\n " , dev_count);
904
904
size_t n_ok = 0 ;
@@ -911,11 +911,12 @@ int main(void) {
911
911
912
912
ggml_backend_t backend = ggml_backend_dev_init (devs[i], NULL );
913
913
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 );
917
919
}
918
- #endif
919
920
backends.push_back (backend);
920
921
}
921
922
You can’t perform that action at this time.
0 commit comments