steps:
- uses: actions/checkout@v2
- - name: Set GGML_NTHREADS for Ubuntu
- run: echo "GGML_NTHREADS=2" >> $GITHUB_ENV
+ - name: Set GGML_N_THREADS for Ubuntu
+ run: echo "GGML_N_THREADS=2" >> $GITHUB_ENV
if: matrix.os == 'ubuntu-latest'
- - name: Set GGML_NTHREADS for MacOS
- run: echo "GGML_NTHREADS=3" >> $GITHUB_ENV
+ - name: Set GGML_N_THREADS for MacOS
+ run: echo "GGML_N_THREADS=2" >> $GITHUB_ENV
if: matrix.os == 'macos-latest'
- name: Create Build Environment
float max_error_abs,
float max_error_rel) {
+ static int n_threads = -1;
+ if (n_threads < 0) {
+ n_threads = GGML_DEFAULT_N_THREADS;
+
+ const char *env = getenv("GGML_N_THREADS");
+ if (env) {
+ n_threads = atoi(env);
+ }
+
+ printf("GGML_N_THREADS = %d\n", n_threads);
+ }
+
struct ggml_cgraph gf = ggml_build_forward (f);
+ gf.n_threads = n_threads;
+
struct ggml_cgraph gb = ggml_build_backward(ctx0, &gf, false);
+ gb.n_threads = n_threads;
ggml_graph_compute(ctx0, &gf);
ggml_graph_reset (&gf);