1
0
mirror of https://github.com/TREX-CoE/qmckl.git synced 2024-12-31 08:36:11 +01:00

Fixed makefile

This commit is contained in:
Anthony Scemama 2021-03-06 18:19:13 +01:00
parent d7a922b24e
commit f03cff153e
8 changed files with 85 additions and 76 deletions

View File

@ -34,9 +34,10 @@ LIBS=-lm
endif
export CC CFLAGS FC FFLAGS LIBS
QMCKL_ROOT=$(PWD)/..
export CC CFLAGS FC FFLAGS LIBS QMCKL_ROOT
MERGED_ORG=merged_qmckl.org
ORG_SOURCE_FILES=$(wildcard *.org)
OBJECT_FILES=$(filter-out $(EXCLUDED_OBJECTS), $(patsubst %.org,%.o,$(ORG_SOURCE_FILES)))
@ -51,12 +52,12 @@ test: Makefile.generated
doc: $(ORG_SOURCE_FILES)
./create_doc.sh $(MERGED_ORG)
$(QMCKL_ROOT)/tools/create_doc.sh
clean:
rm -f qmckl.h test_qmckl_* test_qmckl.c test_qmckl qmckl_*.f90 qmckl_*.c qmckl_*.o qmckl_*.h Makefile.generated libqmckl.so *.html *.fh *.mod
Makefile.generated: Makefile create_makefile.sh $(ORG_SOURCE_FILES)
./create_makefile.sh $(MERGED_ORG)
Makefile.generated: Makefile $(QMCKL_ROOT)/tools/create_makefile.sh $(ORG_SOURCE_FILES)
$(QMCKL_ROOT)/tools/create_makefile.sh

View File

@ -6,7 +6,7 @@
* Introduction
The ultimate goal of the QMCkl library is to provide a high-performance
implementation of the main kernels of QMC. In this particular
@ -15,9 +15,9 @@
HPC experts to use this repository as a reference for re-writing
optimized libraries.
** Literate programming
In a traditional source code, most of the lines of source files of a program
are code, scripts, Makefiles, and only a few lines are comments explaining
parts of the code that are non-trivial to understand. The documentation of
@ -49,7 +49,7 @@
easily extracted from the org-mode files invoking the Emacs text editor from
the command-line in the =Makefile=, and then the produced files are compiled.
Moreover, within the Emacs text editor the source code blocks can be executed
interactively, in the same spirit as Jupyter notebooks.
interactively, in the same spirit as Jupyter notebooks.
** Source code editing
@ -59,7 +59,7 @@
Any text editor can be used to edit org-mode files. For a better
user experience Emacs is recommended. For users hating Emacs, it
is good to know that Emacs can behave like Vim when switched into
``Evil'' mode.
``Evil'' mode.
In the =tools/init.el= file, we provide a minimal Emacs configuration
file for vim users. This file should be copied into =.emacs.d/init.el=.
@ -137,9 +137,9 @@
If the name of the org-mode file is =xxx.org=, the name of the
produced C files should be =xxx.c= and =xxx.h= and the name of the
produced Fortran file should be =xxx.f90=.
Arrays are in uppercase and scalars are in lowercase.
In the names of the variables and functions, only the singular
form is allowed.
@ -224,7 +224,7 @@
variable.
** Algorithms
Reducing the scaling of an algorithm usually implies also reducing
its arithmetic complexity (number of flops per byte). Therefore,
for small sizes \(\mathcal{O}(N^3)\) and \(\mathcal{O}(N^2)\)
@ -233,11 +233,14 @@
implemented adapted to different problem sizes.
** Rules for the API
- =stdint= should be used for integers (=int32_t=, =int64_t=)
- integers used for counting should always be =int64_t=
- floats should be by default =double=, unless explicitly mentioned
- floats should be by default =double=, unless explicitly mentioned
- pointers are converted to =int64_t= to increase portability
* Documentation
# The .org files will be appended here in the order specified in the
# table_of_contents file

View File

@ -1,41 +0,0 @@
#!/bin/bash
INPUT=$1
SRC=$PWD
# Install htmlize if needed
[[ -f ../docs/htmlize.el ]] || (
cd ../docs/
git clone https://github.com/hniksic/emacs-htmlize
cp emacs-htmlize/htmlize.el .
rm -rf emacs-htmlize
cd -
)
[[ -f ../docs/htmlize.el ]] || exit 1
# Switch to TMPDIR for easy cleanup
TMPDIR=$(mktemp -d)
./merge_org.sh $TMPDIR/$INPUT
cd $TMPDIR
# Create documentation
emacs --batch \
--load ${SRC}/../docs/htmlize.el \
--load ${SRC}/../toold/init.el \
$INPUT -f org-html-export-to-html
if [[ $? -eq 0 ]]
then
rm -rf $TMPDIR
exit 0
else
mv index.html ${SRC}/../docs/
rm -rf $TMPDIR
exit 2
fi

View File

@ -1,17 +0,0 @@
#!/bin/bash
OUTPUT=$1
for i in README.org \
qmckl.org \
qmckl_context.org \
qmckl_error.org \
qmckl_precision.org \
qmckl_memory.org \
qmckl_distance.org \
qmckl_ao.org \
qmckl_footer.org \
test_qmckl.org
do
cat $i >> $1
done

9
src/table_of_contents Normal file
View File

@ -0,0 +1,9 @@
qmckl.org
qmckl_context.org
qmckl_error.org
qmckl_precision.org
qmckl_memory.org
qmckl_distance.org
qmckl_ao.org
test_qmckl.org
qmckl_footer.org

45
tools/create_doc.sh Executable file
View File

@ -0,0 +1,45 @@
#!/bin/bash
INPUT=merged.org
if [[ -z $QMCKL_ROOT ]]
then
print "QMCKL_ROOT is not defined"
exit 1
fi
# Install htmlize if needed
[[ -f ${QMCKL_ROOT}/docs/htmlize.el ]] || (
cd ${QMCKL_ROOT}/docs/
git clone https://github.com/hniksic/emacs-htmlize
cp emacs-htmlize/htmlize.el .
rm -rf emacs-htmlize
cd -
)
[[ -f ${QMCKL_ROOT}/docs/htmlize.el ]] || exit 1
# Switch to TMPDIR for easy cleanup
TMPDIR=$(mktemp -d)
${QMCKL_ROOT}/tools/merge_org.sh $TMPDIR/$INPUT
cd $TMPDIR
# Create documentation
emacs --batch \
--load ${QMCKL_ROOT}/docs/htmlize.el \
--load ${QMCKL_ROOT}/tools/init.el \
$INPUT -f org-html-export-to-html
if [[ $? -eq 0 ]]
then
rm -rf $TMPDIR
exit 0
else
mv index.html ${QMCKL_ROOT}/docs/
rm -rf $TMPDIR
exit 2
fi

View File

@ -1,17 +1,18 @@
#!/bin/bash
INPUT=$1
./merge_org.sh $INPUT
MERGED=merged.org
${QMCKL_ROOT}/tools/merge_org.sh $MERGED
OUTPUT=Makefile.generated
# Tangle org files
emacs \
$INPUT \
$MERGED \
--batch \
-f org-babel-tangle \
--kill
rm $MERGED
# Create the list of *.o files to be created

8
tools/merge_org.sh Executable file
View File

@ -0,0 +1,8 @@
#!/bin/bash
OUTPUT=$1
for i in README.org $(cat $QMCKL_ROOT/src/table_of_contents)
do
cat $i >> $1
done