diff options
Diffstat (limited to 'r840.patch')
-rw-r--r-- | r840.patch | 206 |
1 files changed, 0 insertions, 206 deletions
diff --git a/r840.patch b/r840.patch deleted file mode 100644 index eede3cd2b80e..000000000000 --- a/r840.patch +++ /dev/null @@ -1,206 +0,0 @@ -Index: setup.py -=================================================================== ---- setup.py (revision 839) -+++ setup.py (revision 840) -@@ -24,10 +24,17 @@ - import argparse - import numpy.distutils as nd - from distutils.version import StrictVersion -+from os import listdir -+from os.path import isfile, join - - def str2bool(v): -- return v.lower() in ("yes", "true", "t", "1") -+ return v.lower() in ("yes", "true", "t", "1") - -+def remove_prefix(name, prefix): -+ if name.startswith(prefix): -+ return name[len(prefix):] -+ return name -+ - parser = argparse.ArgumentParser(description='Assimulo setup script.') - parser.register('type','bool',str2bool) - package_arguments=['plugins','sundials','blas','superlu','lapack'] -@@ -36,7 +43,8 @@ - parser.add_argument("--{}-home".format(pg), - help="Location of the {} directory".format(pg.upper()),type=str,default='') - parser.add_argument("--blas-name", help="name of the blas package",default='blas') --parser.add_argument("--extra-c-flags", help='Extra C-flags (a list enclosed in " ")',default='') -+parser.add_argument("--extra-c-flags", help='Extra C-flags (a list enclosed in " ")',default='') -+parser.add_argument("--with_openmp", type='bool', help="set to true if present",default=False) - parser.add_argument("--is_static", type='bool', help="set to true if present",default=False) - parser.add_argument("--sundials-with-superlu", type='bool', help="set to true if Sundials has been compiled with SuperLU",default=False) - parser.add_argument("--debug", type='bool', help="set to true if present",default=False) -@@ -120,7 +128,6 @@ - self.static = args[0].is_static - self.static_link_gcc = ["-static-libgcc"] if self.static else [] - self.static_link_gfortran = ["-static-libgfortran"] if self.static else [] -- self.debug_flag = args[0].debug - self.force_32bit = args[0].force_32bit - self.flag_32bit = ["-m32"] if self.force_32bit else [] - self.no_mvscr = args[0].no_msvcr -@@ -128,7 +135,7 @@ - self.extra_fortran_link_flags = args[0].extra_fortran_link_flags.split() - self.extra_fortran_link_files = args[0].extra_fortran_link_files.split() - self.thirdparty_methods = thirdparty_methods -- -+ self.with_openmp = args[0].with_openmp - - - if self.no_mvscr: -@@ -270,12 +277,10 @@ - """ - Check if SuperLU package installed - """ -- self.with_SLU = self.with_BLAS -- kinsol_msg='KINSOL will not be compiled with support for SuperLU' -+ self.with_SLU = True -+ sundials_msg='SUNDIALS will not be compiled with support for SuperLU' - -- if not self.with_BLAS: -- L.warning(kinsol_msg+' as BLAS is missing.') -- elif self.SLUdir != "": -+ if self.SLUdir != "": - self.SLUincdir = os.path.join(self.SLUdir,'SRC') - self.SLUlibdir = os.path.join(self.SLUdir,'lib') - if not os.path.exists(os.path.join(self.SLUincdir,'supermatrix.h')): -@@ -283,16 +288,18 @@ - L.warning("Could not find SuperLU, disabling support. View more information using --log=DEBUG") - L.debug("Could not find SuperLU at the given path {}.".format(self.SLUdir)) - L.debug("usage: --superlu-home path") -- L.debug(kinsol_msg+'.') -+ L.debug(sundials_msg+'.') - else: - L.debug("SuperLU found in {} and {}: ".format(self.SLUincdir, self.SLUlibdir)) -+ -+ self.superLUFiles = [remove_prefix(f.split(".")[0],"lib") for f in listdir(self.SLUlibdir) if isfile(join(self.SLUlibdir, f)) and f.endswith(".a")] -+ self.superLUFiles.sort(reverse=True) - else: - L.warning("No path to SuperLU supplied, disabling support. View more information using --log=DEBUG") -- L.debug("No path to SuperLU supplied, KINSOL will not be compiled with support for SUperLU.") -+ L.debug("No path to SuperLU supplied, SUNDIALS will not be compiled with support for SuperLU.") - L.debug("usage: --superlu-home=path") - L.debug("Note: the path required is to the folder where the folders 'SRC' and 'lib' are found.") - self.with_SLU = False -- L.debug(kinsol_msg+'.') - - def check_SUNDIALS(self): - """ -@@ -301,13 +308,22 @@ - if os.path.exists(os.path.join(os.path.join(self.incdirs,'cvodes'), 'cvodes.h')): - self.with_SUNDIALS=True - L.debug('SUNDIALS found.') -+ sundials_version = None - -- if os.path.exists(os.path.join(os.path.join(self.incdirs,'arkode'), 'arkode.h')): #This was added in 2.6 -- sundials_version = (2,6,0) -- L.debug('SUNDIALS 2.6 found.') -- else: -- sundials_version = (2,5,0) -- L.debug('SUNDIALS 2.5 found.') -+ try: -+ if os.path.exists(os.path.join(os.path.join(self.incdirs,'sundials'), 'sundials_config.h')): -+ with open(os.path.join(os.path.join(self.incdirs,'sundials'), 'sundials_config.h')) as f: -+ for line in f: -+ if "SUNDIALS_PACKAGE_VERSION" in line: -+ sundials_version = tuple([int(f) for f in line.split()[-1][1:-1].split(".")]) -+ L.debug('SUNDIALS %d.%d found.'%(sundials_version[0], sundials_version[1])) -+ except Exception: -+ if os.path.exists(os.path.join(os.path.join(self.incdirs,'arkode'), 'arkode.h')): #This was added in 2.6 -+ sundials_version = (2,6,0) -+ L.debug('SUNDIALS 2.6 found.') -+ else: -+ sundials_version = (2,5,0) -+ L.debug('SUNDIALS 2.5 found.') - - self.SUNDIALS_version = sundials_version - -@@ -367,6 +383,10 @@ - ext_list[-1].include_dirs = [np.get_include(), "assimulo","assimulo"+os.sep+"lib", self.incdirs] - ext_list[-1].library_dirs = [self.libdirs] - ext_list[-1].libraries = ["sundials_cvodes", "sundials_nvecserial", "sundials_idas"] -+ if self.with_SLU: #If SUNDIALS is compiled with support for SuperLU -+ ext_list[-1].include_dirs.append(self.SLUincdir) -+ ext_list[-1].library_dirs.append(self.SLUlibdir) -+ ext_list[-1].libraries.extend(self.superLUFiles) - - #Kinsol - ext_list += cythonize(["assimulo"+os.path.sep+"solvers"+os.path.sep+"kinsol.pyx"], -@@ -386,6 +406,9 @@ - el.extra_compile_args = ["-O2", "-fno-strict-aliasing"] - if self.platform == "mac": - el.extra_compile_args += ["-Wno-error=return-type"] -+ if self.with_openmp: -+ el.extra_link_args.append("-fopenmp") -+ el.extra_compile_args.append("-fopenmp") - el.extra_compile_args += self.flag_32bit + self.extra_c_flags - - for el in ext_list: -Index: src/lib/sundials_callbacks.pxi -=================================================================== ---- assimulo/lib/sundials_callbacks.pxi (revision 839) -+++ assimulo/lib/sundials_callbacks.pxi (revision 840) -@@ -110,9 +110,14 @@ - cdef int ret_nnz
- cdef int dim = Jacobian.N
- cdef realtype* data = Jacobian.data
-- cdef int* rowvals = Jacobian.rowvals
-- cdef int* colptrs = Jacobian.colptrs
-
-+ IF SUNDIALS_VERSION >= (2,6,3):
-+ cdef int* rowvals = Jacobian.rowvals[0]
-+ cdef int* colptrs = Jacobian.colptrs[0]
-+ ELSE:
-+ cdef int* rowvals = Jacobian.rowvals
-+ cdef int* colptrs = Jacobian.colptrs
-+
- nv2arr_inplace(yv, y)
- """
- realtype *data;
-@@ -136,9 +141,9 @@ - jac = sparse.csc.csc_matrix(jac)
- raise AssimuloException("The Jacobian must be stored on Scipy's CSC format.")
- ret_nnz = jac.nnz
-- if ret_nnz> nnz:
-+ if ret_nnz > nnz:
- raise AssimuloException("The Jacobian has more entries than supplied to the problem class via 'jac_nnz'")
--
-+
- for i in range(min(ret_nnz,nnz)):
- data[i] = jac.data[i]
- rowvals[i] = jac.indices[i]
-Index: src/lib/sundials_includes.pxd -=================================================================== ---- assimulo/lib/sundials_includes.pxd (revision 839) -+++ assimulo/lib/sundials_includes.pxd (revision 840) -@@ -93,13 +93,29 @@ - ctypedef _DlsMat* DlsMat
- cdef realtype* DENSE_COL(DlsMat A, int j)
-
--IF SUNDIALS_VERSION >= (2,6,0):
-+IF SUNDIALS_VERSION >= (2,6,3):
- cdef extern from "sundials/sundials_sparse.h":
- cdef struct _SlsMat:
- int M
- int N
- int NNZ
-+ int NP
- realtype *data
-+ int sparsetype
-+ int *indexvals
-+ int *indexptrs
-+ int **rowvals
-+ int **colptrs
-+ int **colvals
-+ int **rowptrs
-+ ctypedef _SlsMat* SlsMat
-+ELIF SUNDIALS_VERSION >= (2,6,0):
-+ cdef extern from "sundials/sundials_sparse.h":
-+ cdef struct _SlsMat:
-+ int M
-+ int N
-+ int NNZ
-+ realtype *data
- int *rowvals
- int *colptrs
- ctypedef _SlsMat* SlsMat
|