From dc09743082649e721db5f4b1beee8827d36fec8f Mon Sep 17 00:00:00 2001 From: Syun'ichi Shiraiwa Date: Sat, 25 Mar 2023 09:53:05 -0400 Subject: [PATCH 1/5] fixed global.i --- mfem/__init__.py | 2 +- mfem/_par/globals.i | 1 + mfem/_ser/globals.i | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/mfem/__init__.py b/mfem/__init__.py index 45aff3ec..fac7e4e9 100644 --- a/mfem/__init__.py +++ b/mfem/__init__.py @@ -20,5 +20,5 @@ def debug_print(message): print(message) -__version__ = '4.5.0.2rc2' +__version__ = '4.5.2.0rc0' diff --git a/mfem/_par/globals.i b/mfem/_par/globals.i index 45a17af8..bf70593c 100644 --- a/mfem/_par/globals.i +++ b/mfem/_par/globals.i @@ -11,6 +11,7 @@ import_array(); %include "exception.i" %include "../common/typemap_macros.i" %include "../common/exception.i" +%include "../common/mfem_config.i" %include "std_string.i" diff --git a/mfem/_ser/globals.i b/mfem/_ser/globals.i index 8be72106..e217f00b 100644 --- a/mfem/_ser/globals.i +++ b/mfem/_ser/globals.i @@ -11,6 +11,7 @@ import_array(); %include "exception.i" %include "../common/typemap_macros.i" %include "../common/exception.i" +%include "../common/mfem_config.i" %include "std_string.i" From cee0f0795f322cdc394653cba76e1231100e1d26 Mon Sep 17 00:00:00 2001 From: Syun'ichi Shiraiwa Date: Sun, 26 Mar 2023 14:32:56 -0400 Subject: [PATCH 2/5] adressed a new _config.hpp file which hide variables such as MFEM_USE_MPI from swig --- mfem/common/mfem_config.i | 1 + setup.py | 30 ++++++++++++++++++++---------- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/mfem/common/mfem_config.i b/mfem/common/mfem_config.i index 8951c79b..21dd988c 100644 --- a/mfem/common/mfem_config.i +++ b/mfem/common/mfem_config.i @@ -3,4 +3,5 @@ %ignore MFEM_SOURCE_DIR; %ignore MFEM_INSTALL_DIR; %ignore MFEM_TIMER_TYPE; +%include "config/_config.hpp" // include mfem MACRO %include "config/config.hpp" // include mfem MACRO diff --git a/setup.py b/setup.py index c1945648..93fed20e 100644 --- a/setup.py +++ b/setup.py @@ -49,7 +49,7 @@ # "metis": "https://github.com/KarypisLab/METIS/archive/refs/tags/v5.1.1-DistDGL-v0.5.tar.gz", # "metis": "http://glaros.dtc.umn.edu/gkhome/fetch/sw/metis/metis-5.1.0.tar.gz", "metis": "https://github.com/mfem/tpls/raw/gh-pages/metis-5.1.0.tar.gz", - "hypre": "https://github.com/hypre-space/hypre/archive/v2.27.0.tar.gz", + "hypre": "https://github.com/hypre-space/hypre/archive/v2.28.0.tar.gz", "libceed": "https://github.com/CEED/libCEED/archive/refs/tags/v0.11.0.tar.gz", "gslib": "https://github.com/Nek5000/gslib/archive/refs/tags/v1.0.8.tar.gz"} @@ -58,8 +58,8 @@ "gklib": "https://github.com/KarypisLab/GKlib", "metis": "https://github.com/KarypisLab/METIS", } repos_sha = { - "mfem": "2f6eb8838f8f5e8359abba0dd3434c8cc7147012", # version 4.5 with a few fix - #"mfem": "b7a4b61b5ce80b326a002aebccf7da7ad2432556", # version 4.5 + # "mfem": "2f6eb8838f8f5e8359abba0dd3434c8cc7147012", + "mfem": "00b2a0705f647e17a1d4ffcb289adca503f28d42", # version 4.5.2 "gklib": "a7f8172703cf6e999dd0710eb279bba513da4fec", "metis": "94c03a6e2d1860128c2d0675cbbb86ad4f261256", } @@ -244,7 +244,7 @@ def external_install_prefix(verbose=True): os.makedirs(path) path = os.path.join(path, 'mfem', 'external') return path - + else: # when prefix is given...let's borrow pip._internal to find the location ;D import pip._internal.locations @@ -295,20 +295,28 @@ def make_call(command, target='', force_verbose=False): if dry_run: return - kwargs = {} + kwargs = {'universal_newlines': True} myverbose = verbose or force_verbose if not myverbose: kwargs['stdout'] = DEVNULL kwargs['stderr'] = DEVNULL + # else: + # kwargs['stdout'] = subprocess.PIPE + # kwargs['stderr'] = subprocess.STDOUT - try: - subprocess.check_call(command, **kwargs) - except subprocess.CalledProcessError: + p = subprocess.Popen(command, **kwargs) + p.communicate() + if p.returncode != 0: if target == '': target = " ".join(command) print("Failed when calling command: " + target) - raise + raise subprocess.CalledProcessError(p.returncode, + " ".join(command)) + + #subprocess.check_call(command, **kwargs) + # except subprocess.CalledProcessError: + # print(stdout) def chdir(path): @@ -1089,6 +1097,8 @@ def update_header_exists(mfem_source): mp_pool = Pool(max((multiprocessing.cpu_count() - 1, 1))) with mp_pool: mp_pool.map(make_call, commands) + # for c in commands: + # make_call(c) os.chdir(pwd) @@ -1574,7 +1584,7 @@ def initialize_options(self): self.with_suitesparse = False self.suitesparse_prefix = '' - self.with_lapack = False + self.with_lapack = False self.blas_libraries = "" self.lapack_libraries = "" From 8687af6acb14f4d192473421d02e0c8c467e10c5 Mon Sep 17 00:00:00 2001 From: Syun'ichi Shiraiwa Date: Sun, 26 Mar 2023 19:30:10 -0400 Subject: [PATCH 3/5] fixed test_with_MFEM_release.yml --- .github/workflows/test_with_MFEM_release.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test_with_MFEM_release.yml b/.github/workflows/test_with_MFEM_release.yml index e98a6c15..9d5e6db1 100644 --- a/.github/workflows/test_with_MFEM_release.yml +++ b/.github/workflows/test_with_MFEM_release.yml @@ -106,9 +106,9 @@ jobs: if [ "${USE_FLAGS}" = "000" ]; then # test workflow to manually run swig python setup.py clean --swig - python setup.py install --ext-only --with-gslib --mfem-branch=coefficient-unneeded-using --verbose - python setup.py install --swig --with-gslib --mfem-branch=coefficient-unneeded-using --verbose - python setup.py install --skip-ext --skip-swig --with-gslib --mfem-branch=coefficient-unneeded-using --verbose + python setup.py install --ext-only --with-gslib --verbose + python setup.py install --swig --with-gslib --verbose + python setup.py install --skip-ext --skip-swig --with-gslib --verbose fi if [ "${USE_FLAGS}" = "010" ]; then python setup.py install --with-gslib --with-parallel --prefix=$SANDBOX From 0901e5e66ed981223644e14bf4c05d73c47a7c97 Mon Sep 17 00:00:00 2001 From: Syun'ichi Shiraiwa Date: Sun, 26 Mar 2023 21:19:00 -0400 Subject: [PATCH 4/5] addressed gslib in tmop_tools.hpp --- mfem/_par/tmop_tools.i | 3 +++ mfem/_ser/tmop_tools.i | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/mfem/_par/tmop_tools.i b/mfem/_par/tmop_tools.i index 6a981c4a..b34de54a 100644 --- a/mfem/_par/tmop_tools.i +++ b/mfem/_par/tmop_tools.i @@ -23,6 +23,9 @@ import_array(); %include "../common/typemap_macros.i" +#ifdef MFEM_USE_GSLIB +%import gslib.i +#endif %import tmop.i %import bilinearform.i %import pbilinearform.i diff --git a/mfem/_ser/tmop_tools.i b/mfem/_ser/tmop_tools.i index c4ebf416..5cce019c 100644 --- a/mfem/_ser/tmop_tools.i +++ b/mfem/_ser/tmop_tools.i @@ -11,11 +11,16 @@ import_array(); %} +%include "../common/mfem_config.i" + %include "exception.i" %import "../common/exception_director.i" %include "../common/typemap_macros.i" +#ifdef MFEM_USE_GSLIB +%import gslib.i +#endif %import tmop.i %import bilinearform.i %import solvers.i From 4767c62d90d894aa70386d7b3a1dc9d4525eef13 Mon Sep 17 00:00:00 2001 From: Syun'ichi Shiraiwa Date: Sun, 26 Mar 2023 21:32:57 -0400 Subject: [PATCH 5/5] fixed test_numba.py in parallel --- test/test_numba.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/test/test_numba.py b/test/test_numba.py index a3024036..1cd12b4e 100644 --- a/test/test_numba.py +++ b/test/test_numba.py @@ -13,7 +13,7 @@ if len(sys.argv) > 1 and sys.argv[1] == '-p': import mfem.par as mfem use_parallel = True - from mfem.common.mpi_debug import nicePrint as print + from mfem.common.mpi_debug import nicePrint from mpi4py import MPI myid = MPI.COMM_WORLD.rank @@ -21,6 +21,7 @@ import mfem.ser as mfem use_parallel = False myid = 0 + nicePrint = print class s_coeff(mfem.PyCoefficient): @@ -321,7 +322,7 @@ def m_func5(p): end = time.time() a3.Finalize() M3 = a3.SpMat() - print("Numba (simpler interface) (matrix)", end - start) + nicePrint("Numba (simpler interface) (matrix)", end - start) start = time.time() m_func4_complex.SetTime(3.0) @@ -329,7 +330,7 @@ def m_func5(p): end = time.time() a4.Finalize() M4 = a4.SpMat() - print("Numba (complex dependency as complex) (matrix)", end - start) + nicePrint("Numba (complex dependency as complex) (matrix)", end - start) start = time.time() m_func4_split.SetTime(3.0) @@ -337,7 +338,7 @@ def m_func5(p): end = time.time() a5.Finalize() M5 = a5.SpMat() - print("Numba (complex dependency as decomposed) (matrix)", end - start) + nicePrint("Numba (complex dependency as decomposed) (matrix)", end - start) #from mfem.commmon.sparse_utils import sparsemat_to_scipycsr #csr1 = sparsemat_to_scipycsr(M1, float) @@ -360,7 +361,7 @@ def compare_mat(M1o, M2o): compare_mat(M1, M5) # print(m_func3.SpaceDimension()) - print("PASSED") + nicePrint("PASSED") if __name__ == '__main__':