On 7/25/22 02:47, Waldek Hebisch wrote:
> On Sun, Jul 24, 2022 at 09:29:24PM +0800, Qian Yun wrote:
>> As you know, the majority time of building FriCAS is to compile
>> over 1000 SPAD files to LSP files and then to LISP_BIN file.
>> Luckily, this step can be paralleled.
>>
>> So on a multi-core machine, to reduce build time, the focus should
>> be on the serial part of build process.
>>
>> The building of algebra/*daase is the most important serial part.
>>
>> I'm not entirely familiar with the process, but it seems there
>> are a few stages to generate daase, and each stage requires to
>> compile many (if not full) spad files, and the compiled result
>> is discarded.
>
> More precisely, the result is replaced by result of subsequent
> compilation. But we compile them because we need to load
> some of them (at it is tricky to decide if we can skip some).
Yes, the step "make stamp-oboo3" loads some files, but we can
use "compile-file before load" to just compile the needed files.
>> So I think in this step, it is wasteful to compile
>> these *lsp file to *fasl file, especially for SBCL with :SB-FASTEVAL.
>
> Quite likely.
Another motivation for this compile speed optimization is that,
when I was compiling use ECL, the total time is over 20 minutes,
and I guess the daase step takes around 10 minutes.
>> So some simple testing:
>>
>> Compile FriCAS (without X11) with 8 cores (2.2GHz) takes
>> 2m53s real time and 11m CPU time.
>>
>> (So a rough estimation is that parallel part takes around 1min10s and
>> serial part takes around 1m40s.)
>
> Build time is rather nonliner, for example CPU time grows with
> growing number of jobs. For example on machine with 20
> physical cores and 40 logical ones due to hypethreading
> (all builds including X11 and generation of textual
> HyperDoc pages):
>
Yeah, the Amdahl's law. So it is more important to shorten the
serial part.
The following is the diff I used during experiment.
(This is without the compile-before-load optimization.)
- Qian
==========
diff --git a/src/algebra/Makefile.in b/src/algebra/Makefile.in
index 9431e0c7..aad42787 100644
--- a/src/algebra/Makefile.in
+++ b/src/algebra/Makefile.in
@@ -462,10 +462,10 @@ stamp-oboo3: stamp-db
@if [ ! -f stamp-oboo3 ] ; then \
echo "Bootstrap object copy" ; \
for A in ${CATLIST} ${DOMLIST} ; do \
- cp $$A.NRLIB/$$A.$(FASLEXT) ${OUT}/$$A.$(FASLEXT) || exit
1 ; \
+ cp $$A.NRLIB/$$A.lsp ${OUT}/$$A.$(FASLEXT).lsp || exit 1 ; \
done; \
for A in ${CATDOMS} ; do \
- cp $${A}-.NRLIB/$${A}-.$(FASLEXT)
${OUT}/$${A}-.$(FASLEXT) || exit 1 ; \
+ cp $${A}-.NRLIB/$${A}-.lsp ${OUT}/$${A}-.$(FASLEXT).lsp
|| exit 1 ; \
done; \
rm -rf *.NRLIB \
echo "Stage 3 object bootstrap (normal mode)" ; \
@@ -477,7 +477,7 @@ stamp-oboo3: stamp-db
DAASE=./r7 ${INTERPSYS} ) || exit 1 ; \
echo "Stage 3 object copy" ; \
for A in ${DOMLIST} ; do \
- cp $$A.NRLIB/$$A.$(FASLEXT) ${OUT}/$$A.$(FASLEXT) || exit
1 ; \
+ cp $$A.NRLIB/$$A.lsp ${OUT}/$$A.$(FASLEXT).lsp || exit 1 ; \
done ; \
touch stamp-oboo3 ; \
fi
diff --git a/src/interp/nlib.lisp b/src/interp/nlib.lisp
index fa10d184..9ff1c2f3 100644
--- a/src/interp/nlib.lisp
+++ b/src/interp/nlib.lisp
@@ -220,7 +220,8 @@
(defun |compile_lib_file|(fn)
(if FRICAS-LISP::algebra-optimization
(proclaim (cons 'optimize FRICAS-LISP::algebra-optimization)))
- (compile-file fn))
+ ;;(compile-file fn)
+)
;; (RDROPITEMS filearg keys) don't delete, used in files.spad
diff --git a/src/lisp/fricas-lisp.lisp b/src/lisp/fricas-lisp.lisp
index aeaa3537..2aa8df23 100644
--- a/src/lisp/fricas-lisp.lisp
+++ b/src/lisp/fricas-lisp.lisp
@@ -355,7 +355,7 @@
;;; (format *error-output* "entred load_quietly ~&")
#-:GCL
(handler-bind ((warning #'muffle-warning))
- (load f))
+ (load (concatenate 'string f ".lsp")))
#+:GCL
(load f)
;;; (format *error-output* "finished load_quietly ~&")