Commit b495ead5 authored by Roman Yurchak's avatar Roman Yurchak

Only include lapack when necessary

parent ccdadc6e
...@@ -211,10 +211,6 @@ $(LZ4LIB): ...@@ -211,10 +211,6 @@ $(LZ4LIB):
make -C lz4 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) $(SIX_LIBS): $(CPYTHONLIB)
make -C six make -C six
......
...@@ -238,6 +238,7 @@ def handle_command(line, args, dryrun=False): ...@@ -238,6 +238,7 @@ def handle_command(line, args, dryrun=False):
lapack_dir = None lapack_dir = None
# rebuild = False
# Go through and adjust arguments # Go through and adjust arguments
for arg in line[1:]: for arg in line[1:]:
if arg.startswith('-I'): if arg.startswith('-I'):
...@@ -259,12 +260,31 @@ def handle_command(line, args, dryrun=False): ...@@ -259,12 +260,31 @@ def handle_command(line, args, dryrun=False):
elif shared and arg.endswith('.so'): elif shared and arg.endswith('.so'):
arg = arg[:-3] + '.wasm' arg = arg[:-3] + '.wasm'
output = arg output = arg
# Fix for scipy to link to the correct BLAS/LAPACK files # Fix for scipy to link to the correct BLAS/LAPACK files
if arg.startswith('-L') and 'CLAPACK-WA' in arg: if arg.startswith('-L') and 'CLAPACK-WA' in arg:
# rebuild = True
out_idx = line.index('-o')
out_idx += 1
module_name = line[out_idx]
module_name = Path(module_name).name.split('.')[0]
if module_name not in ['_fblas', '_flapack', '_flinalg',
'_calc_lwork', 'cython_blas',
'cython_lapack', '_iterative',
'_arpack']:
raise ValueError(f"Unsupported module requiring BLAS/LAPACK "
f"{module_name} in {' '.join(line)}")
lapack_dir = arg.replace('-L', '') lapack_dir = arg.replace('-L', '')
for lib_name in ['F2CLIBS/libf2c.bc', # For convinience we determine needed scipy link libraries
'blas_WA.bc', # here, instead of in patch files
'lapack_WA.bc']: link_libs = ['F2CLIBS/libf2c.bc', 'blas_WA.bc']
if module_name in ['_flapack', '_flinalg', '_calc_lwork',
'cython_lapack', '_iterative', '_arpack']:
link_libs.append('lapack_WA.bc')
for lib_name in link_libs:
arg = os.path.join(lapack_dir, f"{lib_name}") arg = os.path.join(lapack_dir, f"{lib_name}")
new_args.append(arg) new_args.append(arg)
continue continue
...@@ -273,7 +293,7 @@ def handle_command(line, args, dryrun=False): ...@@ -273,7 +293,7 @@ def handle_command(line, args, dryrun=False):
# This can only be used for incremental rebuilds -- it generates # This can only be used for incremental rebuilds -- it generates
# an error during clean build of numpy # an error during clean build of numpy
# if os.path.isfile(output): # if os.path.isfile(output) and not rebuild:
# print('SKIPPING: ' + ' '.join(new_args)) # print('SKIPPING: ' + ' '.join(new_args))
# return # return
...@@ -329,10 +349,10 @@ def install_for_distribution(args): ...@@ -329,10 +349,10 @@ def install_for_distribution(args):
try: try:
subprocess.check_call(commands) subprocess.check_call(commands)
except Exception: except Exception:
print(f'Warning: {" ".join(commands)} failed with distutils, possibly ' print(f'Warning: {" ".join(str(arg) for arg in commands)} failed '
f'due to the use of distutils that does not support the ' f'with distutils, possibly due to the use of distutils '
f'--old-and-unmanageable argument. Re-trying the install ' f'that does not support the --old-and-unmanageable '
f'without this argument.') 'argument. Re-trying the install without this argument.')
subprocess.check_call(commands[:-1]) subprocess.check_call(commands[:-1])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment