Skip to content

Commit dbc1293

Browse files
committed
Fix build issue with mpi4py >= 4
1 parent fad3385 commit dbc1293

17 files changed

+115
-1
lines changed

base/PyNucleus_base/SchurComplement.pxd

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
# If you want to use this code, please refer to the README.rst and LICENSE files. #
66
###################################################################################
77

8+
include "mpi-compat.pxd"
89
from . myTypes cimport INDEX_t, REAL_t, COMPLEX_t, BOOL_t
910

1011
include "SchurComplement_decl_REAL.pxi"

base/PyNucleus_base/convergence.pxd

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
# If you want to use this code, please refer to the README.rst and LICENSE files. #
66
###################################################################################
77

8+
include "mpi-compat.pxd"
89
import mpi4py.rc
910
mpi4py.rc.initialize = False
1011
from mpi4py cimport MPI

base/PyNucleus_base/ip_norm.pxd

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
# If you want to use this code, please refer to the README.rst and LICENSE files. #
66
###################################################################################
77

8+
include "mpi-compat.pxd"
89
from . myTypes cimport INDEX_t, REAL_t, COMPLEX_t, BOOL_t
910
from libc.math cimport sqrt
1011
from . blas cimport mydot, norm

base/PyNucleus_base/linalg.pxd

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
# If you want to use this code, please refer to the README.rst and LICENSE files. #
66
###################################################################################
77

8+
include "mpi-compat.pxd"
89
from . myTypes cimport INDEX_t, REAL_t, COMPLEX_t, BOOL_t
910

1011
ctypedef fused SCALAR_t:

base/PyNucleus_base/mpi-compat.h

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/////////////////////////////////////////////////////////////////////////////////////
2+
// Copyright 2021 National Technology & Engineering Solutions of Sandia, //
3+
// LLC (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the //
4+
// U.S. Government retains certain rights in this software. //
5+
// If you want to use this code, please refer to the README.rst and LICENSE files. //
6+
/////////////////////////////////////////////////////////////////////////////////////
7+
8+
// Matches demo/wrap-cython/mpi-compat.h from mpi4py
9+
10+
#ifndef MPI_COMPAT_H
11+
#define MPI_COMPAT_H
12+
13+
#include <mpi.h>
14+
15+
#if (MPI_VERSION < 3) && !defined(PyMPI_HAVE_MPI_Message)
16+
typedef void *PyMPI_MPI_Message;
17+
#define MPI_Message PyMPI_MPI_Message
18+
#endif
19+
20+
#if (MPI_VERSION < 4) && !defined(PyMPI_HAVE_MPI_Session)
21+
typedef void *PyMPI_MPI_Session;
22+
#define MPI_Session PyMPI_MPI_Session
23+
#endif
24+
25+
#endif

base/PyNucleus_base/mpi-compat.pxd

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
###################################################################################
2+
# Copyright 2021 National Technology & Engineering Solutions of Sandia, #
3+
# LLC (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the #
4+
# U.S. Government retains certain rights in this software. #
5+
# If you want to use this code, please refer to the README.rst and LICENSE files. #
6+
###################################################################################
7+
8+
cdef extern from "mpi-compat.h":
9+
pass

base/PyNucleus_base/performanceLogger.pxd

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
# If you want to use this code, please refer to the README.rst and LICENSE files. #
66
###################################################################################
77

8+
include "mpi-compat.pxd"
89
from . myTypes cimport BOOL_t, REAL_t
910
ctypedef object OrderedDict_t
1011
import mpi4py.rc

base/PyNucleus_base/solvers.pxd

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
# If you want to use this code, please refer to the README.rst and LICENSE files. #
66
###################################################################################
77

8+
include "mpi-compat.pxd"
89
from . myTypes cimport INDEX_t, REAL_t, COMPLEX_t, BOOL_t
910
from . linear_operators cimport (LinearOperator,
1011
ComplexLinearOperator,

base/PyNucleus_base/utilsCy.pyx

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
# If you want to use this code, please refer to the README.rst and LICENSE files. #
66
###################################################################################
77

8+
include "mpi-compat.pxd"
89
import mpi4py
910
mpi4py.rc.initialize = False
1011
from mpi4py import MPI

fem/PyNucleus_fem/mpi-compat.h

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/////////////////////////////////////////////////////////////////////////////////////
2+
// Copyright 2021 National Technology & Engineering Solutions of Sandia, //
3+
// LLC (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the //
4+
// U.S. Government retains certain rights in this software. //
5+
// If you want to use this code, please refer to the README.rst and LICENSE files. //
6+
/////////////////////////////////////////////////////////////////////////////////////
7+
8+
// Matches demo/wrap-cython/mpi-compat.h from mpi4py
9+
10+
#ifndef MPI_COMPAT_H
11+
#define MPI_COMPAT_H
12+
13+
#include <mpi.h>
14+
15+
#if (MPI_VERSION < 3) && !defined(PyMPI_HAVE_MPI_Message)
16+
typedef void *PyMPI_MPI_Message;
17+
#define MPI_Message PyMPI_MPI_Message
18+
#endif
19+
20+
#if (MPI_VERSION < 4) && !defined(PyMPI_HAVE_MPI_Session)
21+
typedef void *PyMPI_MPI_Session;
22+
#define MPI_Session PyMPI_MPI_Session
23+
#endif
24+
25+
#endif

fem/PyNucleus_fem/mpi-compat.pxd

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
###################################################################################
2+
# Copyright 2021 National Technology & Engineering Solutions of Sandia, #
3+
# LLC (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the #
4+
# U.S. Government retains certain rights in this software. #
5+
# If you want to use this code, please refer to the README.rst and LICENSE files. #
6+
###################################################################################
7+
8+
cdef extern from "mpi-compat.h":
9+
pass

fem/PyNucleus_fem/repartitioner.pyx

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
import numpy as np
99
cimport numpy as np
10+
include "mpi-compat.pxd"
1011
import mpi4py.rc
1112
mpi4py.rc.initialize = False
1213
from mpi4py import MPI
+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/////////////////////////////////////////////////////////////////////////////////////
2+
// Copyright 2021 National Technology & Engineering Solutions of Sandia, //
3+
// LLC (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the //
4+
// U.S. Government retains certain rights in this software. //
5+
// If you want to use this code, please refer to the README.rst and LICENSE files. //
6+
/////////////////////////////////////////////////////////////////////////////////////
7+
8+
// Matches demo/wrap-cython/mpi-compat.h from mpi4py
9+
10+
#ifndef MPI_COMPAT_H
11+
#define MPI_COMPAT_H
12+
13+
#include <mpi.h>
14+
15+
#if (MPI_VERSION < 3) && !defined(PyMPI_HAVE_MPI_Message)
16+
typedef void *PyMPI_MPI_Message;
17+
#define MPI_Message PyMPI_MPI_Message
18+
#endif
19+
20+
#if (MPI_VERSION < 4) && !defined(PyMPI_HAVE_MPI_Session)
21+
typedef void *PyMPI_MPI_Session;
22+
#define MPI_Session PyMPI_MPI_Session
23+
#endif
24+
25+
#endif
+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
###################################################################################
2+
# Copyright 2021 National Technology & Engineering Solutions of Sandia, #
3+
# LLC (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the #
4+
# U.S. Government retains certain rights in this software. #
5+
# If you want to use this code, please refer to the README.rst and LICENSE files. #
6+
###################################################################################
7+
8+
cdef extern from "mpi-compat.h":
9+
pass

metisCy/PyNucleus_metisCy/parmetisCy.pyx

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
import numpy as np
99
cimport numpy as np
10+
include "mpi-compat.pxd"
1011
import mpi4py.rc
1112
mpi4py.rc.initialize = False
1213
from mpi4py import MPI

nl/PyNucleus_nl/interactionDomains.pyx

+3
Original file line numberDiff line numberDiff line change
@@ -820,6 +820,9 @@ cdef class fullSpace(interactionDomain):
820820
def __reduce__(self):
821821
return fullSpace, ()
822822

823+
def getLongDescription(self):
824+
return ''
825+
823826

824827
cdef class ball2_retriangulation(retriangulationDomain):
825828
"""l2 ball interaction domain"""

packageTools/PyNucleus_packageTools/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ def setCompiler(self):
204204

205205
out, err = Popen([self.config['compiler_c++'], '--version'], stdout=PIPE, stderr=PIPE).communicate()
206206
assert len(err) == 0, err
207-
print('C++ compiler \'{}\' description:\n{}\n'.format(self.config['compiler_c'], out.decode()[:-1]))
207+
print('C++ compiler \'{}\' description:\n{}\n'.format(self.config['compiler_c++'], out.decode()[:-1]))
208208

209209
def setInclude(self):
210210
assert self.configLoaded

0 commit comments

Comments
 (0)