From ccdadc6e932ebbfe34897ecb7ad5bfecc015485b Mon Sep 17 00:00:00 2001 From: Roman Yurchak Date: Fri, 26 Oct 2018 14:51:30 +0200 Subject: [PATCH] Move CLAPACK_WA to the root folder --- .circleci/config.yml | 2 +- Makefile | 14 ++++++++--- packages/scipy/meta.yaml | 2 +- packages/scipy/patches/fix-blas.patch | 36 ++++++++++++--------------- pyodide_build/pywasmcross.py | 3 ++- 5 files changed, 31 insertions(+), 26 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 67029c6cc..1f254eb80 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -23,7 +23,7 @@ jobs: sudo apt-get install gfortran f2c # Download BLAS/LAPACK - git clone https://github.com/rth/CLAPACK-WA.git packages/scipy/CLAPACK-WA + git clone https://github.com/rth/CLAPACK-WA.git CLAPACK-WA - restore_cache: keys: diff --git a/Makefile b/Makefile index 7f2989dd4..84b8fa066 100644 --- a/Makefile +++ b/Makefile @@ -64,7 +64,11 @@ all: build/pyodide.asm.js \ build/pyodide.asm.js: src/main.bc src/jsimport.bc src/jsproxy.bc src/js2python.bc \ src/pyimport.bc src/pyproxy.bc src/python2js.bc \ +<<<<<<< HEAD src/runpython.bc src/hiwire.bc +======= + src/runpython.bc src/hiwire.bc $(CLAPACK) +>>>>>>> Move CLAPACK_WA to the root folder [ -d build ] || mkdir build $(CXX) -s EXPORT_NAME="'pyodide'" -o build/pyodide.asm.html $(filter %.bc,$^) \ $(LDFLAGS) -s FORCE_FILESYSTEM=1 @@ -207,17 +211,21 @@ $(LZ4LIB): make -C lz4 +something: + cd packages/scipy/build/scipy-0.17.1 && emcc -O3 -s BINARYEN_METHOD=native-wasm -Werror -s EMULATED_FUNCTION_POINTERS=1 -s EMULATE_FUNCTION_POINTER_CASTS=1 -s SIDE_MODULE=1 -s WASM=1 -s BINARYEN_TRAP_MODE=clamp --memory-init-file 0 -Wall -g -Wall -g -shared build/temp.linux-x86_64-3.7/build/src.linux-x86_64-3.7/build/src.linux-x86_64-3.7/scipy/linalg/_fblasmodule.bc build/temp.linux-x86_64-3.7/build/src.linux-x86_64-3.7/build/src.linux-x86_64-3.7/build/src.linux-x86_64-3.7/scipy/linalg/fortranobject.bc build/temp.linux-x86_64-3.7/src/packages/scipy/build/scipy-0.17.1/scipy/_build_utils/src/wrap_dummy_g77_abi.bc build/temp.linux-x86_64-3.7/src/packages/scipy/build/scipy-0.17.1/scipy/_build_utils/src/wrap_dummy_accelerate.bc build/temp.linux-x86_64-3.7/build/src.linux-x86_64-3.7/build/src.linux-x86_64-3.7/scipy/linalg/_fblas-f2pywrappers.bc ../../../../CLAPACK-WA/F2CLIBS/libf2c.bc -lblas_WA -llapack_WA -disable-verify -Lbuild/temp.linux-x86_64-3.7 -lgfortran -o build/lib.linux-x86_64-3.7/scipy/linalg/_fblas.cpython-37m-x86_64-linux-gnu.wasm + + $(SIX_LIBS): $(CPYTHONLIB) make -C six -clapack: $(CPYTHONLIB) +$(CLAPACK): $(CPYTHONLIB) # We build BLAS/LAPACK only for target. # On host we include -LCLAPACK-WA path which has no effect on host. # On target it gets rewritten by pywasmcross to the full patch of # blas_WA.bc, lapack_WA.bc which are linked statically in scipy # in each module that needs them. - make -C $(LAPACK_DIR)F2CLIBS/libf2c/ arith.h - emmake make -C $(LAPACK_DIR) + make -C CLAPACK-WA/F2CLIBS/libf2c arith.h + emmake make -C CLAPACK-WA/ $(CLAPACK): $(CPYTHONLIB) make -C CLAPACK diff --git a/packages/scipy/meta.yaml b/packages/scipy/meta.yaml index 8f0ebb2d0..6f4140f4e 100644 --- a/packages/scipy/meta.yaml +++ b/packages/scipy/meta.yaml @@ -26,7 +26,7 @@ source: - patches/fix_mmap.patch build: - cflags: -I../../CLAPACK-WA/INCLUDE -Wno-implicit-function-declaration + cflags: -I../../../../CLAPACK-WA/INCLUDE -Wno-implicit-function-declaration cxxflags: requirements: diff --git a/packages/scipy/patches/fix-blas.patch b/packages/scipy/patches/fix-blas.patch index 7f46ad7c3..55d2b9ef1 100644 --- a/packages/scipy/patches/fix-blas.patch +++ b/packages/scipy/patches/fix-blas.patch @@ -1,30 +1,29 @@ -commit 926f2e3cf302f2e04717675bb8e6cb77c1c9ee3d +commit eba70f7602827851012acd1b836b5a56a3e70e32 Author: Roman Yurchak Date: Mon Oct 8 10:53:11 2018 +0200 Partial fixes for BLAS/LAPACK diff --git a/scipy/linalg/setup.py b/scipy/linalg/setup.py -index 2c9b9ba22..f52f775d6 100755 +index 2c9b9ba22..6a0c4fa65 100755 --- a/scipy/linalg/setup.py +++ b/scipy/linalg/setup.py -@@ -14,7 +14,14 @@ def configuration(parent_package='', top_path=None): +@@ -14,7 +14,13 @@ def configuration(parent_package='', top_path=None): config = Configuration('linalg', parent_package, top_path) - lapack_opt = get_info('lapack_opt') -+ # lapack_opt = get_info('lapack_opt') -+ lapack_opt = { # libraries will be auto-generated by pywasmcross ++ lapack_opt = { # libraries will be auto-generated by pywasmcross + 'libraries': [], + 'include_dirs': [], -+ 'library_dirs': ['../../CLAPACK-WA/'], -+ 'language': 'c', ++ 'library_dirs': ['../../../../CLAPACK-WA/'], ++ 'language': 'f77', + 'define_macros': [('NO_ATLAS_INFO', 1), + ('HAVE_CBLAS', None)]} if not lapack_opt: raise NotFoundError('no lapack/blas resources found') -@@ -117,9 +124,22 @@ def configuration(parent_package='', top_path=None): +@@ -117,9 +123,22 @@ def configuration(parent_package='', top_path=None): fnames = split_fortran_files(join(dirname, 'src', 'id_dist', 'src'), routines_to_split) fnames = [join('src', 'id_dist', 'src', f) for f in fnames] @@ -51,41 +50,38 @@ index 2c9b9ba22..f52f775d6 100755 # _calc_lwork: config.add_extension('_calc_lwork', diff --git a/scipy/sparse/linalg/eigen/arpack/setup.py b/scipy/sparse/linalg/eigen/arpack/setup.py -index a8175a9d5..f7af2f0d9 100755 +index a8175a9d5..0fafd82b3 100755 --- a/scipy/sparse/linalg/eigen/arpack/setup.py +++ b/scipy/sparse/linalg/eigen/arpack/setup.py -@@ -11,7 +11,15 @@ def configuration(parent_package='',top_path=None): +@@ -11,7 +11,13 @@ def configuration(parent_package='',top_path=None): config = Configuration('arpack',parent_package,top_path) - lapack_opt = get_info('lapack_opt') -+ # lapack_opt = get_info('lapack_opt') -+ -+ lapack_opt = { # libraries will be auto-generated by pywasmcross ++ lapack_opt = { # libraries will be auto-generated by pywasmcross + 'libraries': [], + 'include_dirs': [], -+ 'library_dirs': ['../../CLAPACK-WA/'], -+ 'language': 'c', ++ 'library_dirs': ['../../../../CLAPACK-WA/'], ++ 'language': 'f77', + 'define_macros': [('NO_ATLAS_INFO', 1), + ('HAVE_CBLAS', None)]} if not lapack_opt: raise NotFoundError('no lapack/blas resources found') diff --git a/scipy/sparse/linalg/isolve/setup.py b/scipy/sparse/linalg/isolve/setup.py -index becb9237a..971e85b6b 100755 +index becb9237a..c9d4379b1 100755 --- a/scipy/sparse/linalg/isolve/setup.py +++ b/scipy/sparse/linalg/isolve/setup.py -@@ -11,7 +11,14 @@ def configuration(parent_package='',top_path=None): +@@ -11,7 +11,13 @@ def configuration(parent_package='',top_path=None): config = Configuration('isolve',parent_package,top_path) - lapack_opt = get_info('lapack_opt') -+ # lapack_opt = get_info('lapack_opt') + lapack_opt = { # libraries will be auto-generated by pywasmcross + 'libraries': [], + 'include_dirs': [], -+ 'library_dirs': ['../../CLAPACK-WA/'], -+ 'language': 'c', ++ 'library_dirs': ['../../../../CLAPACK-WA/'], ++ 'language': 'f77', + 'define_macros': [('NO_ATLAS_INFO', 1), + ('HAVE_CBLAS', None)]} diff --git a/pyodide_build/pywasmcross.py b/pyodide_build/pywasmcross.py index d17ab1023..cfe4f553c 100755 --- a/pyodide_build/pywasmcross.py +++ b/pyodide_build/pywasmcross.py @@ -263,7 +263,8 @@ def handle_command(line, args, dryrun=False): if arg.startswith('-L') and 'CLAPACK-WA' in arg: lapack_dir = arg.replace('-L', '') for lib_name in ['F2CLIBS/libf2c.bc', - 'blas_WA.bc', 'lapack_WA.bc']: + 'blas_WA.bc', + 'lapack_WA.bc']: arg = os.path.join(lapack_dir, f"{lib_name}") new_args.append(arg) continue