From 3cb7db1152fdd76d5caed98e31e020d0ca66180a Mon Sep 17 00:00:00 2001
From: Andreas Enge <andreas.enge@inria.fr>
Date: Wed, 10 Jan 2024 17:39:56 +0100
Subject: [PATCH] Make ECPP verification compatible with the PARI MPI engine.

* lib/pari.c (cm_pari_init): Initialise the PARI multithreading engine
  explicitly after all other PARI preparations. Set threadsizemax.
  (cm_pari_print_library): Print the threading engine and the number
  of threads.
---
 lib/pari.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/lib/pari.c b/lib/pari.c
index 24db90a..f3abf2c 100644
--- a/lib/pari.c
+++ b/lib/pari.c
@@ -191,13 +191,15 @@ void cm_pari_init ()
        NULL, 0, 0, NULL},
       {NULL, 0, NULL, 0, NULL, NULL, NULL, 0, 0, NULL}};
 
-   pari_init_opts (1ul<<23, 0, INIT_JMPm | INIT_DFTm);
-      /* Do not capture SIGSEGV. */
-   paristack_setsize (1ul<<23, 1ul<<31);
-   pari_add_module (functions_gp);
 #ifdef HAVE_FLINT
    cm_flint_init ();
 #endif
+   pari_init_opts (1ul<<23, 0, INIT_JMPm | INIT_DFTm | INIT_noIMTm);
+      /* Do not capture SIGSEGV. */
+   paristack_setsize (1ul<<23, 1ul<<31);
+   sd_threadsizemax ("1G", d_SILENT);
+   pari_add_module (functions_gp);
+   pari_mt_init ();
 }
 
 /*****************************************************************************/
@@ -221,10 +223,12 @@ void cm_pari_print_library ()
    av = avma;
 
    v = pari_version ();
-   printf ("PARI: include %i.%li.%li, lib %li.%li.%li\n",
+   printf ("PARI: include %i.%li.%li, lib %li.%li.%li %s, %lu threads\n",
          PARI_VERSION_CODE >> 16, (PARI_VERSION_CODE >> 8) & 255ul,
          PARI_VERSION_CODE & 255ul,
-         itos (gel (v, 1)), itos (gel (v, 2)), itos (gel (v, 3)));
+         itos (gel (v, 1)), itos (gel (v, 2)), itos (gel (v, 3)),
+         paricfg_mt_engine,
+         pari_mt_nbthreads);
 
    avma = av;
 }
-- 
GitLab