Skip to content

Commit d64c810

Browse files
CISCjeffbolznv
andauthored
test-barrier : do not use more threads than physically available (#16389)
* do not use more threads than physically available * ensure n_threads > 0 Co-authored-by: Jeff Bolz <jbolz@nvidia.com> --------- Co-authored-by: Jeff Bolz <jbolz@nvidia.com>
1 parent ef07a40 commit d64c810

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tests/test-barrier.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
#include "ggml.h"
22
#include "ggml-cpu.h"
3-
#include "ggml-backend.h"
43

54
#include <chrono>
65
#include <iostream>
76
#include <cstdio>
87
#include <cstdlib>
98
#include <cassert>
109
#include <vector>
10+
#include <thread>
1111

1212
#define MAX_NARGS 2
1313

1414
int main(int argc, char *argv[]) {
1515

16-
int n_threads = 4;
16+
int n_threads = std::max(1, std::min(4, (int) std::thread::hardware_concurrency()));
1717
int n_rounds = 100;
1818

1919
if (argc > 1) {

0 commit comments

Comments
 (0)