Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PyMFEM4.5.2 #174

Merged
merged 5 commits into from
Mar 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/test_with_MFEM_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion mfem/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ def debug_print(message):

print(message)

__version__ = '4.5.0.2rc2'
__version__ = '4.5.2.0rc0'

1 change: 1 addition & 0 deletions mfem/_par/globals.i
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
3 changes: 3 additions & 0 deletions mfem/_par/tmop_tools.i
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions mfem/_ser/globals.i
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
5 changes: 5 additions & 0 deletions mfem/_ser/tmop_tools.i
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions mfem/common/mfem_config.i
Original file line number Diff line number Diff line change
Expand Up @@ -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
30 changes: 20 additions & 10 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"}

Expand All @@ -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", }

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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 = ""

Expand Down
11 changes: 6 additions & 5 deletions test/test_numba.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@
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

else:
import mfem.ser as mfem
use_parallel = False
myid = 0
nicePrint = print


class s_coeff(mfem.PyCoefficient):
Expand Down Expand Up @@ -321,23 +322,23 @@ 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)
a4.Assemble()
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)
a5.Assemble()
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)
Expand All @@ -360,7 +361,7 @@ def compare_mat(M1o, M2o):
compare_mat(M1, M5)

# print(m_func3.SpaceDimension())
print("PASSED")
nicePrint("PASSED")


if __name__ == '__main__':
Expand Down