-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parallization of Makefiles #408
Comments
And a small addition to that: # Makefile
all: result.txt
targets = a.txt b.txt c.txt d.txt
$(targets) &:
touch a.txt b.txt c.txt d.txt
result.txt: $(targets)
touch result.txt Same Example as in the details above# Makefile 'old version'
all: build/v16516.pdf
# hier Python-Skripte:
build/plot-g_ball.pdf: auswertung.py ../matplotlibrc ../header-matplotlib.tex data/*| build
# so that matplotlib can find the tex header when running
# LaTeX in the tmp directory
# and set the matplotlibrc
TEXINPUTS=$$(pwd)/..: MATPLOTLIBRC=../matplotlibrc python auswertung.py
build/parameter-g_ball.tex: build/plot_ball_g.pdf
build/parameter-t0-g_ball.tex: build/parameter-g_ball.tex
build/plot-g_cylinder.pdf: build/parameter-t0-g_ball.tex
build/parameter-g_cylinder.tex: build/plot_cylinder_g.pdf
build/parameter-t0-g_cylinder.tex: build/parameter-g_cylinder.tex
build/plot-I_ball.pdf: build/parameter-g_cylinder.tex
build/parameter-I_ball.tex: build/plot_ball_I.pdf
build/parameter-t0-I_ball.tex: build/parameter-I_ball.tex
build/plot-I_cylinder.pdf: build/parameter-t0-I_ball.tex
build/parameter-I_cylinder.tex: build/plot_cylinder_I.pdf
build/parameter-t0-I_cylinder.tex: build/parameter-I_cylinder.tex
build/table_all-measurements.tex: build/parameter-t0-I_cylinder.tex
build/table_averaged-measurements.tex: build/table_all-measurements.tex
build/tracklength.tex: build/table_averaged-measurements.tex
build/framerate.tex: build/tracklength.tex
build/mass_ball.tex: build/framerate.tex
build/radius_ball.tex: build/mass_ball.tex
build/theoretical-I_ball.tex: build/radius_ball.tex
build/mass_cylinder.tex: build/theoretical-I_ball.tex
build/radius-inner_cylinder.tex: build/mass_cylinder.tex
build/radius-outer_cylinder.tex: build/radius-inner_cylinder.tex
build/theoretical-I_cylinder.tex: build/radius-outer_cylinder.tex
# hier weitere Abhängigkeiten für build/vXXX.pdf deklarieren:
# These dependencies arent even complete
build/v16516.pdf: build/plot_ball_g.pdf build/plot_ball_I.pdf build/plot_cylinder_g.pdf build/plot_cylinder_I.pdf
build/v16516.pdf: FORCE | build
# to find header and bib files in the main directory
TEXINPUTS=..: \
BIBINPUTS=..: \
max_print_line=1048576 \
latexmk \
--lualatex \
--output-directory=build \
--interaction=nonstopmode \
--halt-on-error \
v16516.tex
build:
mkdir -p build
clean:
rm -rf build
FORCE:
.PHONY: all clean # Makefile 'new version'
all: build/v16516.pdf
script_targets = build/plot-g_ball.pdf \
build/parameter-g_ball.tex\
build/parameter-t0-g_ball.tex\
build/plot-g_cylinder.pdf\
build/parameter-g_cylinder.tex\
build/parameter-t0-g_cylinder.tex\
build/plot-I_ball.pdf\
build/parameter-I_ball.tex\
build/parameter-t0-I_ball.tex\
build/plot-I_cylinder.pdf\
build/parameter-I_cylinder.tex\
build/parameter-t0-I_cylinder.tex\
build/framerate.tex\
build/theoretical-I_ball.tex\
build/theoretical-I_cylinder.tex\
build/tracklength.tex\
build/mass_ball.tex\
build/mass_cylinder.tex\
build/radius_ball.tex\
build/radius-inner_cylinder.tex\
build/radius-outer_cylinder.tex\
build/table_all-measurements.tex\
build/table_averaged-measurements.tex
# hier Python-Skripte:
$(script_targets): auswertung.py ../matplotlibrc ../header-matplotlib.tex data/*| build
# so that matplotlib can find the tex header when running
# LaTeX in the tmp directory
# and set the matplotlibrc
TEXINPUTS=$$(pwd)/..: MATPLOTLIBRC=../matplotlibrc python auswertung.py
# hier weitere Abhängigkeiten für build/vXXX.pdf deklarieren:
build/v16516.pdf: $(script_targets)
build/v16516.pdf: FORCE | build
# to find header and bib files in the main directory
TEXINPUTS=..: \
BIBINPUTS=..: \
max_print_line=1048576 \
latexmk \
--lualatex \
--output-directory=build \
--interaction=nonstopmode \
--halt-on-error \
v16516.tex
build:
mkdir -p build
clean:
rm -rf build
FORCE:
.PHONY: all clean
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Another thing I found working on the lab report:
The context:
For the most extensive solution (exporting every value from the python script into a tex file) I added the manual synchronization from the last `make` -slide:does not look very nice in my opinion ... and it is also somewhat tedious to write
... though come to think of it, might be a prime example for multiline editing 🤔
I found a relatively recent addition to Make (4.3), so called 'grouped targets'
docs
grouped targets are all created by just on execution of the specific rule.
So the manual changing for parallel processing is not necessary.
Example
results in
> make -j4 touch a.txt b.txt c.txt d.txt touch a.txt b.txt c.txt d.txt touch a.txt b.txt c.txt d.txt touch a.txt b.txt c.txt d.txt touch result.txt
> make -j4 touch a.txt b.txt c.txt d.txt touch result.txt
The text was updated successfully, but these errors were encountered: