use flto on clapack-wasm
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -5,4 +5,5 @@ minitest
|
|||||||
libarchive
|
libarchive
|
||||||
.vscode
|
.vscode
|
||||||
clapack-wasm
|
clapack-wasm
|
||||||
|
openfst
|
||||||
emsdk
|
emsdk
|
||||||
@@ -14,7 +14,7 @@ COMPILE_JOBS?:=$(nproc)
|
|||||||
SRC:=$(realpath src)
|
SRC:=$(realpath src)
|
||||||
KALDI:=$(realpath kaldi)
|
KALDI:=$(realpath kaldi)
|
||||||
VOSK:=$(realpath vosk-api)
|
VOSK:=$(realpath vosk-api)
|
||||||
OPENFST:=$(KALDI)/tools/openfst
|
OPENFST:=$(realpath openfst)
|
||||||
LIBARCHIVE:=$(realpath libarchive)
|
LIBARCHIVE:=$(realpath libarchive)
|
||||||
ZSTD:=$(realpath zstd)
|
ZSTD:=$(realpath zstd)
|
||||||
CLAPACK_WASM:=$(realpath clapack-wasm)
|
CLAPACK_WASM:=$(realpath clapack-wasm)
|
||||||
@@ -29,7 +29,7 @@ browser-recognizer: vosk libarchive
|
|||||||
|
|
||||||
prepare:
|
prepare:
|
||||||
sudo apt install shtool libtool autogen autotools-dev pkg-config make && \
|
sudo apt install shtool libtool autogen autotools-dev pkg-config make && \
|
||||||
[ $(EMSDK) != ../emsdk -a ! -d $(EMSDK) ] && \
|
[ $(EMSDK) != ../emsdk ! -d $(EMSDK) ] && \
|
||||||
echo "Invalid emsdk path"; \
|
echo "Invalid emsdk path"; \
|
||||||
exit 1; \
|
exit 1; \
|
||||||
[ $(MAX_THREAD) -lt 2 ] && \
|
[ $(MAX_THREAD) -lt 2 ] && \
|
||||||
@@ -69,6 +69,7 @@ libarchive: zstd
|
|||||||
clapack-wasm: prepare
|
clapack-wasm: prepare
|
||||||
git clone --depth=1 https://gitlab.inria.fr/multispeech/kaldi.web/clapack-wasm.git $(CLAPACK_WASM) && \
|
git clone --depth=1 https://gitlab.inria.fr/multispeech/kaldi.web/clapack-wasm.git $(CLAPACK_WASM) && \
|
||||||
cd $(CLAPACK_WASM) && \
|
cd $(CLAPACK_WASM) && \
|
||||||
|
git apply $(SRC)/clapack-wasm.patch &&
|
||||||
bash ./install_repo.sh emcc
|
bash ./install_repo.sh emcc
|
||||||
|
|
||||||
openfst: prepare
|
openfst: prepare
|
||||||
@@ -85,7 +86,7 @@ kaldi: openfst clapack-wasm
|
|||||||
git clone -b vosk --depth=1 https://github.com/alphacep/kaldi $(KALDI) && \
|
git clone -b vosk --depth=1 https://github.com/alphacep/kaldi $(KALDI) && \
|
||||||
cd $(KALDI)/src && \
|
cd $(KALDI)/src && \
|
||||||
git apply $(SRC)/kaldi.patch && \
|
git apply $(SRC)/kaldi.patch && \
|
||||||
CXXFLAGS="-O3 -msimd128 -UHAVE_EXECINFO_H -pthread -flto" LDFLAGS="-O3 -sERROR_ON_UNDEFINED_SYMBOLS=0 -lembind -pthread -flto" emconfigure ./configure --use-cuda=no --with-cudadecoder=no --static --static-math=yes --static-fst=yes --debug-level=0 --double-precision=yes --clapack-root=$(CLAPACK_WASM) --host=WASM && \
|
CXXFLAGS="-O3 -msimd128 -UHAVE_EXECINFO_H -pthread -flto" LDFLAGS="-O3 -sERROR_ON_UNDEFINED_SYMBOLS=0 -lembind -pthread -flto" emconfigure ./configure --use-cuda=no --with-cudadecoder=no --static --static-math=yes --static-fst=yes --debug-level=0 --double-precision=yes --fst-root=$(OPENFST) --clapack-root=$(CLAPACK_WASM) --host=WASM && \
|
||||||
emmake make -j$(COMPILE_JOBS) online2 lm rnnlm
|
emmake make -j$(COMPILE_JOBS) online2 lm rnnlm
|
||||||
|
|
||||||
vosk: kaldi
|
vosk: kaldi
|
||||||
|
|||||||
@@ -1,16 +1,61 @@
|
|||||||
diff --git a/libf2c/main.c b/libf2c/main.c
|
diff --git a/CBLAS/Makefile.in.WASM b/CBLAS/Makefile.in.WASM
|
||||||
index d95fdc9..ac82f68 100644
|
index bf7eda6..5fedaf6 100644
|
||||||
--- a/libf2c/main.c
|
--- a/CBLAS/Makefile.in.WASM
|
||||||
+++ b/libf2c/main.c
|
+++ b/CBLAS/Makefile.in.WASM
|
||||||
@@ -105,9 +105,9 @@ char **xargv;
|
@@ -36,7 +36,7 @@ LOADER = $(CC)
|
||||||
|
# Flags for Compilers
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
|
||||||
int
|
-CFLAGS = -DADD_ -O3
|
||||||
#ifdef KR_headers
|
+CFLAGS = -DADD_ -O3 -flto
|
||||||
-main(argc, argv) int argc; char **argv;
|
|
||||||
+m(argc, argv) int argc; char **argv;
|
#-----------------------------------------------------------------------------
|
||||||
#else
|
# Archive programs and flags
|
||||||
-main(int argc, char **argv)
|
diff --git a/CLAPACK-3.2.1/make.inc.WASM b/CLAPACK-3.2.1/make.inc.WASM
|
||||||
+m(int argc, char **argv)
|
index 80037d0..a964b2d 100644
|
||||||
#endif
|
--- a/CLAPACK-3.2.1/make.inc.WASM
|
||||||
{
|
+++ b/CLAPACK-3.2.1/make.inc.WASM
|
||||||
xargc = argc;
|
@@ -23,7 +23,7 @@ PLAT =
|
||||||
|
# This is used to compile C libary
|
||||||
|
# if no wrapping of the blas library is needed, uncomment next line
|
||||||
|
CC = emcc # -DNO_BLAS_WRAP
|
||||||
|
-CFLAGS = -I$(TOPDIR)/INCLUDE -I$(TOPDIR)/../libf2c -O3
|
||||||
|
+CFLAGS = -I$(TOPDIR)/INCLUDE -I$(TOPDIR)/../libf2c -O3 -flto
|
||||||
|
LOADER = $(CC)
|
||||||
|
LOADOPTS =
|
||||||
|
NOOPT = -O0 -I$(TOPDIR)/INCLUDE -I$(TOPDIR)/../libf2c
|
||||||
|
diff --git a/f2c_BLAS-3.8.0/make.inc.WASM b/f2c_BLAS-3.8.0/make.inc.WASM
|
||||||
|
index e071614..4647c2b 100644
|
||||||
|
--- a/f2c_BLAS-3.8.0/make.inc.WASM
|
||||||
|
+++ b/f2c_BLAS-3.8.0/make.inc.WASM
|
||||||
|
@@ -16,7 +16,7 @@ PLAT =
|
||||||
|
# desired load options for your machine.
|
||||||
|
#
|
||||||
|
CC = emcc
|
||||||
|
-CFLAGS = -I../libf2c -O3
|
||||||
|
+CFLAGS = -I../libf2c -O3 -flto
|
||||||
|
DRVOPTS = $(OPTS)
|
||||||
|
NOOPT =
|
||||||
|
LOADER = emcc
|
||||||
|
diff --git a/libf2c/makefile.WASM b/libf2c/makefile.WASM
|
||||||
|
index 6221401..d93b87f 100644
|
||||||
|
--- a/libf2c/makefile.WASM
|
||||||
|
+++ b/libf2c/makefile.WASM
|
||||||
|
@@ -15,7 +15,7 @@
|
||||||
|
.SUFFIXES: .c .o
|
||||||
|
CC = emcc
|
||||||
|
SHELL = /bin/sh
|
||||||
|
-CFLAGS = -DNON_UNIX_STDIO -O3
|
||||||
|
+CFLAGS = -DNON_UNIX_STDIO -O3 -flto
|
||||||
|
|
||||||
|
LD = wasm-ld
|
||||||
|
RANLIB = emranlib
|
||||||
|
@@ -24,7 +24,7 @@ AR = emar
|
||||||
|
# compile, then strip unnecessary symbols
|
||||||
|
.c.o:
|
||||||
|
$(CC) -c -DSkip_f2c_Undefs $(CFLAGS) $*.c
|
||||||
|
- $(LD) --relocatable -o $*.xxx $*.o
|
||||||
|
+ $(LD) --no-entry -r -o $*.xxx $*.o
|
||||||
|
mv $*.xxx $*.o
|
||||||
|
## Under Solaris (and other systems that do not understand ld -x),
|
||||||
|
## omit -x in the ld line above.
|
||||||
|
|||||||
Reference in New Issue
Block a user