This repository was archived by the owner on May 25, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +19
-4
lines changed Expand file tree Collapse file tree 2 files changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -22,12 +22,12 @@ jobs:
22
22
steps :
23
23
- uses : actions/checkout@v2
24
24
25
- - name : Set GGML_NTHREADS for Ubuntu
26
- run : echo "GGML_NTHREADS =2" >> $GITHUB_ENV
25
+ - name : Set GGML_N_THREADS for Ubuntu
26
+ run : echo "GGML_N_THREADS =2" >> $GITHUB_ENV
27
27
if : matrix.os == 'ubuntu-latest'
28
28
29
- - name : Set GGML_NTHREADS for MacOS
30
- run : echo "GGML_NTHREADS=3 " >> $GITHUB_ENV
29
+ - name : Set GGML_N_THREADS for MacOS
30
+ run : echo "GGML_N_THREADS=2 " >> $GITHUB_ENV
31
31
if : matrix.os == 'macos-latest'
32
32
33
33
- name : Create Build Environment
Original file line number Diff line number Diff line change @@ -202,8 +202,23 @@ bool check_gradient(
202
202
float max_error_abs ,
203
203
float max_error_rel ) {
204
204
205
+ static int n_threads = -1 ;
206
+ if (n_threads < 0 ) {
207
+ n_threads = GGML_DEFAULT_N_THREADS ;
208
+
209
+ const char * env = getenv ("GGML_N_THREADS" );
210
+ if (env ) {
211
+ n_threads = atoi (env );
212
+ }
213
+
214
+ printf ("GGML_N_THREADS = %d\n" , n_threads );
215
+ }
216
+
205
217
struct ggml_cgraph gf = ggml_build_forward (f );
218
+ gf .n_threads = n_threads ;
219
+
206
220
struct ggml_cgraph gb = ggml_build_backward (ctx0 , & gf , false);
221
+ gb .n_threads = n_threads ;
207
222
208
223
ggml_graph_compute (ctx0 , & gf );
209
224
ggml_graph_reset (& gf );
You can’t perform that action at this time.
0 commit comments