| 1 |
Description: Ignore floating-point exceptions while calling MPI_Init |
| 2 |
Author: Thibaut Paumard <[email protected]> |
| 3 |
Origin: upstream |
| 4 |
Applied-Upstream: fd670b1646860e9ecf144ee1c90ec1ac66ffd0f8 |
| 5 |
Last-Update: 2025-10-21 |
| 6 |
--- |
| 7 |
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ |
| 8 |
diff --git a/yorick/check-mpi.i b/yorick/check-mpi.i |
| 9 |
index 77c27cc..b5fb11a 100644 |
| 10 |
--- a/yorick/check-mpi.i |
| 11 |
+++ b/yorick/check-mpi.i |
| 12 |
@@ -39,7 +39,7 @@ if (MPI_Initialized()) error, "MPI should not be initialized yet"; |
| 13 |
done; |
| 14 |
|
| 15 |
doing, "Calling MPI_Init"; |
| 16 |
|
| 17 |
+if (MPI_Init("yorick") && have_mpi) error, "MPI INIT FAILED"; |
| 18 |
done; |
| 19 |
|
| 20 |
doing, "Calling MPI_Initiliazed again"; |
| 21 |
diff --git a/yorick/gyoto_utils.C b/yorick/gyoto_utils.C |
| 22 |
index 6ffcf76..0ec8242 100644 |
| 23 |
--- a/yorick/gyoto_utils.C |
| 24 |
+++ b/yorick/gyoto_utils.C |
| 25 |
@@ -334,6 +334,7 @@ extern "C" { |
| 26 |
Y_gyoto_MPI_Init(int argc) |
| 27 |
{ |
| 28 |
#if defined HAVE_MPI |
| 29 |
+ // Prepare argument for MPI_Init |
| 30 |
long int mpiargcl=0; |
| 31 |
char **mpiargv=NULL; |
| 32 |
long index=-1; |
| 33 |
@@ -343,7 +344,23 @@ extern "C" { |
| 34 |
if (!yarg_nil(0)) mpiargv=ygeta_q(0, &mpiargcl, NULL); |
| 35 |
} |
| 36 |
int mpiargc=mpiargcl; |
| 37 |
|
| 38 |
+ GYOTO_DEBUG_EXPR(mpiargc); |
| 39 |
+ GYOTO_DEBUG_EXPR(mpiargv); |
| 40 |
+ for (long int k=0; k<mpiargc; ++k) |
| 41 |
+ GYOTO_DEBUG_EXPR(mpiargv[k]); |
| 42 |
+ |
| 43 |
+ // In OpenMPI 5, MPI_Init triggers FPE exceptions. |
| 44 |
+ // Ignore FPE exceptions for this call.. |
| 45 |
+# if defined HAVE_FENV_H |
| 46 |
+ fenv_t envp; |
| 47 |
+ feholdexcept(&envp); |
| 48 |
+# endif |
| 49 |
+ long int status = MPI_Init(&mpiargc, &mpiargv); |
| 50 |
+# if defined HAVE_FENV_H |
| 51 |
+ fesetenv(&envp); |
| 52 |
+# endif |
| 53 |
+ ypush_long(status); |
| 54 |
+ |
| 55 |
if (index>=0) { |
| 56 |
long dims[]={1, mpiargc}; |
| 57 |
ystring_t * out=ypush_q(dims); |