Skip to content
Snippets Groups Projects
Commit 5cb7798c authored by Andreas Herten's avatar Andreas Herten
Browse files

First version of 2019 tasks

parent 2f8bb956
Branches
Tags
No related merge requests found
Showing
with 4871 additions and 7783 deletions
...@@ -82,32 +82,25 @@ graph_task2c: plot-task2c.pdf ...@@ -82,32 +82,25 @@ graph_task2c: plot-task2c.pdf
graph_task4: plot-task4.pdf graph_task4: plot-task4.pdf
graph_task4-2: plot-task4-2.pdf graph_task4-2: plot-task4-2.pdf
plot-task1.pdf: poisson2d.ins_cyc.bin.csv plot-task1.pdf: poisson2d.ins_cyc.bin.csv
@test "$$SC19_MODULE_ACTIVE_1" -eq "1" || "Please load the module of this task, sc18/handson1."
python3 -c "import graphing; graphing.task1()" python3 -c "import graphing; graphing.task1()"
@test -n "$$DISPLAY" || "No X forwarding found. Either reconnect with X forwarding (-X / -Y) or download $@ with scp." @test -n "$$DISPLAY" || "No X forwarding found. Either reconnect with X forwarding (-X / -Y) or download $@ with scp."
display $@ display $@
plot-task2a.pdf: poisson2d.ld_st.bin.csv plot-task2a.pdf: poisson2d.ld_st.bin.csv
@test "$$SC19_MODULE_ACTIVE_1" -eq "1" || "Please load the module of this task, sc18/handson1."
python3 -c "import graphing; graphing.task2a()" python3 -c "import graphing; graphing.task2a()"
display $@ display $@
plot-task2b.pdf: poisson2d.vld.bin.csv poisson2d.vst.bin.csv plot-task2b.pdf: poisson2d.vld.bin.csv poisson2d.vst.bin.csv
@test "$$SC19_MODULE_ACTIVE_1" -eq "1" || "Please load the module of this task, sc18/handson1."
python3 -c "import graphing; graphing.task2b()" python3 -c "import graphing; graphing.task2b()"
display $@ display $@
plot-task2b-2.pdf: poisson2d.vld.bin.csv poisson2d.vst.bin.csv poisson2d.ld_st.bin.csv plot-task2b-2.pdf: poisson2d.vld.bin.csv poisson2d.vst.bin.csv poisson2d.ld_st.bin.csv
@test "$$SC19_MODULE_ACTIVE_1" -eq "1" || "Please load the module of this task, sc18/handson1."
python3 -c "import graphing; graphing.task2b(bytes=True)" python3 -c "import graphing; graphing.task2b(bytes=True)"
display $@ display $@
plot-task2c.pdf: poisson2d.vld.bin.csv poisson2d.vst.bin.csv poisson2d.ld_st.bin.csv poisson2d.ins_cyc.bin.csv plot-task2c.pdf: poisson2d.vld.bin.csv poisson2d.vst.bin.csv poisson2d.ld_st.bin.csv poisson2d.ins_cyc.bin.csv
@test "$$SC19_MODULE_ACTIVE_1" -eq "1" || "Please load the module of this task, sc18/handson1."
python3 -c "import graphing; graphing.task2c()" python3 -c "import graphing; graphing.task2c()"
display $@ display $@
plot-task4.pdf: poisson2d.sflop.bin.csv poisson2d.vflop.bin.csv plot-task4.pdf: poisson2d.sflop.bin.csv poisson2d.vflop.bin.csv
@test "$$SC19_MODULE_ACTIVE_1" -eq "1" || "Please load the module of this task, sc18/handson1."
python3 -c "import graphing; graphing.task4()" python3 -c "import graphing; graphing.task4()"
display $@ display $@
plot-task4-2.pdf: poisson2d.sflop.bin.csv poisson2d.vflop.bin.csv plot-task4-2.pdf: poisson2d.sflop.bin.csv poisson2d.vflop.bin.csv
@test "$$SC19_MODULE_ACTIVE_1" -eq "1" || "Please load the module of this task, sc18/handson1."
python3 -c "import graphing; graphing.task4(ai=True)" python3 -c "import graphing; graphing.task4(ai=True)"
display $@ display $@
......
...@@ -2,7 +2,5 @@ ...@@ -2,7 +2,5 @@
This folder holds the files for the first hands-on exercise about Performance Counters on POWER9. This folder holds the files for the first hands-on exercise about Performance Counters on POWER9.
Make sure to load all modules of this session by typing `module load sc18/handson1` into the shell.
All task description is in an accompanying Jupyter Notebook. Open it interactively on Ascent with port forwarding. If that is impossible to do, use the static convert to HTML or PDF of the Notebook and follow along accordingly. All task description is in an accompanying Jupyter Notebook. Open it interactively on Ascent with port forwarding. If that is impossible to do, use the static convert to HTML or PDF of the Notebook and follow along accordingly.
def normalize(df, old_column, new_column): def normalize(df, old_column, new_column):
df[new_column] = df[old_column] / (df["ny"] * df["nx"]) df[new_column] = df[old_column] / (df["ny"] * df["nx"])
def print_and_return_fit(list_of_quantities, dataframe, function, format_value=">7.4f", format_uncertainty="f", _print=True):
"""Use `curve_fit` to fit each quantity in `list_of_quantity` wrt to `dataframe.index`. Print (selectable) and return the result."""
import numpy as np
from scipy.optimize import curve_fit
_fit_parameters = {}
_fit_covariance = {}
_quantity_padding = np.max([len(_str) for _str in list_of_quantities])
for quantity in list_of_quantities:
_fit_parameters[quantity], _fit_covariance[quantity] = curve_fit(function, dataframe.index, dataframe[quantity])
if (_print):
print("Counter {:>{_quantity_padding}} is proportional to the grid points (nx*ny) by a factor of {:{format_value}} (± {:{format_uncertainty}})".format(
quantity,
_fit_parameters[quantity][0],
np.sqrt(np.diag(_fit_covariance[quantity]))[0],
_quantity_padding=_quantity_padding,
format_value=format_value,
format_uncertainty=format_uncertainty
))
return (_fit_parameters, _fit_covariance)
\ No newline at end of file
...@@ -21,17 +21,17 @@ solutions: $(TGT_SOLUTIONS) ...@@ -21,17 +21,17 @@ solutions: $(TGT_SOLUTIONS)
tasks: $(TGT_BLANK) tasks: $(TGT_BLANK)
$(addprefix ../,$(addsuffix .html,$(basename $(SRC)))): $(SRC) $(addprefix ../,$(addsuffix .html,$(basename $(SRC)))): $(SRC)
jupyter nbconvert --to html --output $@ --ClearOutputPreprocessor.enabled=True $< notebook-splitter --remove solution --keep task $< | jupyter nbconvert --to html --output $@ --ClearOutputPreprocessor.enabled=True --stdin
$(addprefix ../,$(addsuffix .pdf,$(basename $(SRC)))): $(SRC) $(addprefix ../,$(addsuffix .pdf,$(basename $(SRC)))): $(SRC)
jupyter nbconvert --to pdf --output $@ --template better-article.tplx --ClearOutputPreprocessor.enabled=True $< notebook-splitter --remove solution --keep task $< | jupyter nbconvert --to pdf --output $@ --template better-article.tplx --ClearOutputPreprocessor.enabled=True --stdin
mv $@.pdf $@ mv $@.pdf $@
$(addprefix ../,$(SRC)): $(SRC) $(addprefix ../,$(SRC)): $(SRC)
jupyter nbconvert --to ipynb --output $@ --ClearOutputPreprocessor.enabled=True $< notebook-splitter --remove solution --keep task $< | jupyter nbconvert --to ipynb --output $@ --ClearOutputPreprocessor.enabled=True --stdin
$(addprefix ../Solutions/,$(addsuffix .html,$(basename $(SRC)))): $(SRC) $(addprefix ../Solutions/,$(addsuffix .html,$(basename $(SRC)))): $(SRC)
jupyter nbconvert --to html --output $@ $< notebook-splitter --remove task --keep solution $< | jupyter nbconvert --to html --output $@ --stdin
$(addprefix ../Solutions/,$(addsuffix .pdf,$(basename $(SRC)))): $(SRC) $(addprefix ../Solutions/,$(addsuffix .pdf,$(basename $(SRC)))): $(SRC)
jupyter nbconvert --to pdf --output $@ --template better-article.tplx $< notebook-splitter --remove task --keep solution $< | jupyter nbconvert --to pdf --output $@ --template better-article.tplx --stdin
mv $@.pdf $@ mv $@.pdf $@
$(addprefix ../Solutions/,$(SRC)): $(SRC) $(addprefix ../Solutions/,$(SRC)): $(SRC)
cp $< $@ notebook-splitter --remove task --keep solution $< -o $@
No preview for this file type
...@@ -2,7 +2,5 @@ ...@@ -2,7 +2,5 @@
This folder holds the files for the first hands-on exercise about Performance Counters on POWER9. This folder holds the files for the first hands-on exercise about Performance Counters on POWER9.
Make sure to load all modules of this session by typing `module load sc18/handson1` into the shell.
All task description is in an accompanying Jupyter Notebook. Open it interactively on Ascent with port forwarding. If that is impossible to do, use the static convert to HTML or PDF of the Notebook and follow along accordingly. All task description is in an accompanying Jupyter Notebook. Open it interactively on Ascent with port forwarding. If that is impossible to do, use the static convert to HTML or PDF of the Notebook and follow along accordingly.
No preview for this file type
...@@ -34,42 +34,42 @@ clean: ...@@ -34,42 +34,42 @@ clean:
${RM} -f *.bin ${RM} -f *.bin
run_task1: poisson2d.ins_cyc.bin run_task1: poisson2d.ins_cyc.bin
$(SC18_SUBMIT_CMD) ./$< 200 1024 $(SC19_SUBMIT_CMD) ./$< 200 1024
run_task2: poisson2d.ld_st.bin run_task2: poisson2d.ld_st.bin
$(SC18_SUBMIT_CMD) ./$< 200 1024 $(SC19_SUBMIT_CMD) ./$< 200 1024
run_task3_1: poisson2d.vld.bin run_task3_1: poisson2d.vld.bin
$(SC18_SUBMIT_CMD) ./$< 200 1024 $(SC19_SUBMIT_CMD) ./$< 200 1024
run_task3_2: poisson2d.vst.bin run_task3_2: poisson2d.vst.bin
$(SC18_SUBMIT_CMD) ./$< 200 1024 $(SC19_SUBMIT_CMD) ./$< 200 1024
run_task3: run_task3_1 run_task3_2 run_task3: run_task3_1 run_task3_2
run_task4_1: poisson2d.sflop.bin run_task4_1: poisson2d.sflop.bin
$(SC18_SUBMIT_CMD) ./$< 200 1024 $(SC19_SUBMIT_CMD) ./$< 200 1024
run_task4_2: poisson2d.vflop.bin run_task4_2: poisson2d.vflop.bin
$(SC18_SUBMIT_CMD) ./$< 200 1024 $(SC19_SUBMIT_CMD) ./$< 200 1024
run_task4: run_task4_1 run_task4_2 run_task4: run_task4_1 run_task4_2
bench_task1: poisson2d.ins_cyc.bin bench_task1: poisson2d.ins_cyc.bin
$(SC18_SUBMIT_CMD) ./bench.sh $< $(SC18_DIR_SCRATCH)/$<.csv $(SC19_SUBMIT_CMD) ./bench.sh $< $(SC19_DIR_SCRATCH)/$<.csv
mv $(SC18_DIR_SCRATCH)/$<.csv . mv $(SC19_DIR_SCRATCH)/$<.csv .
bench_task2: poisson2d.ld_st.bin bench_task2: poisson2d.ld_st.bin
$(SC18_SUBMIT_CMD) ./bench.sh $< $(SC18_DIR_SCRATCH)/$<.csv $(SC19_SUBMIT_CMD) ./bench.sh $< $(SC19_DIR_SCRATCH)/$<.csv
mv $(SC18_DIR_SCRATCH)/$<.csv . mv $(SC19_DIR_SCRATCH)/$<.csv .
bench_task3_1: poisson2d.vld.bin bench_task3_1: poisson2d.vld.bin
$(SC18_SUBMIT_CMD) ./bench.sh $< $(SC18_DIR_SCRATCH)/$<.csv $(SC19_SUBMIT_CMD) ./bench.sh $< $(SC19_DIR_SCRATCH)/$<.csv
mv $(SC18_DIR_SCRATCH)/$<.csv . mv $(SC19_DIR_SCRATCH)/$<.csv .
bench_task3_2: poisson2d.vst.bin bench_task3_2: poisson2d.vst.bin
$(SC18_SUBMIT_CMD) ./bench.sh $< $(SC18_DIR_SCRATCH)/$<.csv $(SC19_SUBMIT_CMD) ./bench.sh $< $(SC19_DIR_SCRATCH)/$<.csv
mv $(SC18_DIR_SCRATCH)/$<.csv . mv $(SC19_DIR_SCRATCH)/$<.csv .
bench_task3: bench_task3_1 bench_task3_2 bench_task3: bench_task3_1 bench_task3_2
bench_task4_1: poisson2d.sflop.bin bench_task4_1: poisson2d.sflop.bin
$(SC18_SUBMIT_CMD) ./bench.sh $< $(SC18_DIR_SCRATCH)/$<.csv $(SC19_SUBMIT_CMD) ./bench.sh $< $(SC19_DIR_SCRATCH)/$<.csv
mv $(SC18_DIR_SCRATCH)/$<.csv . mv $(SC19_DIR_SCRATCH)/$<.csv .
bench_task4_2: poisson2d.vflop.bin bench_task4_2: poisson2d.vflop.bin
$(SC18_SUBMIT_CMD) ./bench.sh $< $(SC18_DIR_SCRATCH)/$<.csv $(SC19_SUBMIT_CMD) ./bench.sh $< $(SC19_DIR_SCRATCH)/$<.csv
mv $(SC18_DIR_SCRATCH)/$<.csv . mv $(SC19_DIR_SCRATCH)/$<.csv .
bench_task4: bench_task4_1 bench_task4_2 bench_task4: bench_task4_1 bench_task4_2
clean_scratch_csv: clean_scratch_csv:
${RM} $(SC18_DIR_SCRATCH)/*.csv ${RM} $(SC19_DIR_SCRATCH)/*.csv
clean_csv: clean_scratch_csv clean_csv: clean_scratch_csv
${RM} *.csv ${RM} *.csv
...@@ -82,32 +82,25 @@ graph_task2c: plot-task2c.pdf ...@@ -82,32 +82,25 @@ graph_task2c: plot-task2c.pdf
graph_task4: plot-task4.pdf graph_task4: plot-task4.pdf
graph_task4-2: plot-task4-2.pdf graph_task4-2: plot-task4-2.pdf
plot-task1.pdf: poisson2d.ins_cyc.bin.csv plot-task1.pdf: poisson2d.ins_cyc.bin.csv
@test "$$SC18_MODULE_ACTIVE_1" -eq "1" || "Please load the module of this task, sc18/handson1."
python3 -c "import graphing; graphing.task1()" python3 -c "import graphing; graphing.task1()"
@test -n "$$DISPLAY" || "No X forwarding found. Either reconnect with X forwarding (-X / -Y) or download $@ with scp." @test -n "$$DISPLAY" || "No X forwarding found. Either reconnect with X forwarding (-X / -Y) or download $@ with scp."
display $@ display $@
plot-task2a.pdf: poisson2d.ld_st.bin.csv plot-task2a.pdf: poisson2d.ld_st.bin.csv
@test "$$SC18_MODULE_ACTIVE_1" -eq "1" || "Please load the module of this task, sc18/handson1."
python3 -c "import graphing; graphing.task2a()" python3 -c "import graphing; graphing.task2a()"
display $@ display $@
plot-task2b.pdf: poisson2d.vld.bin.csv poisson2d.vst.bin.csv plot-task2b.pdf: poisson2d.vld.bin.csv poisson2d.vst.bin.csv
@test "$$SC18_MODULE_ACTIVE_1" -eq "1" || "Please load the module of this task, sc18/handson1."
python3 -c "import graphing; graphing.task2b()" python3 -c "import graphing; graphing.task2b()"
display $@ display $@
plot-task2b-2.pdf: poisson2d.vld.bin.csv poisson2d.vst.bin.csv poisson2d.ld_st.bin.csv plot-task2b-2.pdf: poisson2d.vld.bin.csv poisson2d.vst.bin.csv poisson2d.ld_st.bin.csv
@test "$$SC18_MODULE_ACTIVE_1" -eq "1" || "Please load the module of this task, sc18/handson1."
python3 -c "import graphing; graphing.task2b(bytes=True)" python3 -c "import graphing; graphing.task2b(bytes=True)"
display $@ display $@
plot-task2c.pdf: poisson2d.vld.bin.csv poisson2d.vst.bin.csv poisson2d.ld_st.bin.csv poisson2d.ins_cyc.bin.csv plot-task2c.pdf: poisson2d.vld.bin.csv poisson2d.vst.bin.csv poisson2d.ld_st.bin.csv poisson2d.ins_cyc.bin.csv
@test "$$SC18_MODULE_ACTIVE_1" -eq "1" || "Please load the module of this task, sc18/handson1."
python3 -c "import graphing; graphing.task2c()" python3 -c "import graphing; graphing.task2c()"
display $@ display $@
plot-task4.pdf: poisson2d.sflop.bin.csv poisson2d.vflop.bin.csv plot-task4.pdf: poisson2d.sflop.bin.csv poisson2d.vflop.bin.csv
@test "$$SC18_MODULE_ACTIVE_1" -eq "1" || "Please load the module of this task, sc18/handson1."
python3 -c "import graphing; graphing.task4()" python3 -c "import graphing; graphing.task4()"
display $@ display $@
plot-task4-2.pdf: poisson2d.sflop.bin.csv poisson2d.vflop.bin.csv plot-task4-2.pdf: poisson2d.sflop.bin.csv poisson2d.vflop.bin.csv
@test "$$SC18_MODULE_ACTIVE_1" -eq "1" || "Please load the module of this task, sc18/handson1."
python3 -c "import graphing; graphing.task4(ai=True)" python3 -c "import graphing; graphing.task4(ai=True)"
display $@ display $@
......
def normalize(df, old_column, new_column): def normalize(df, old_column, new_column):
df[new_column] = df[old_column] / (df["ny"] * df["nx"]) df[new_column] = df[old_column] / (df["ny"] * df["nx"])
def print_and_return_fit(list_of_quantities, dataframe, function, format_value=">7.4f", format_uncertainty="f", _print=True):
"""Use `curve_fit` to fit each quantity in `list_of_quantity` wrt to `dataframe.index`. Print (selectable) and return the result."""
import numpy as np
from scipy.optimize import curve_fit
_fit_parameters = {}
_fit_covariance = {}
_quantity_padding = np.max([len(_str) for _str in list_of_quantities])
for quantity in list_of_quantities:
_fit_parameters[quantity], _fit_covariance[quantity] = curve_fit(function, dataframe.index, dataframe[quantity])
if (_print):
print("Counter {:>{_quantity_padding}} is proportional to the grid points (nx*ny) by a factor of {:{format_value}} (± {:{format_uncertainty}})".format(
quantity,
_fit_parameters[quantity][0],
np.sqrt(np.diag(_fit_covariance[quantity]))[0],
_quantity_padding=_quantity_padding,
format_value=format_value,
format_uncertainty=format_uncertainty
))
return (_fit_parameters, _fit_covariance)
\ No newline at end of file
...@@ -34,42 +34,42 @@ clean: ...@@ -34,42 +34,42 @@ clean:
${RM} -f *.bin ${RM} -f *.bin
run_task1: poisson2d.ins_cyc.bin run_task1: poisson2d.ins_cyc.bin
$(SC18_SUBMIT_CMD) ./$< 200 1024 $(SC19_SUBMIT_CMD) ./$< 200 1024
run_task2: poisson2d.ld_st.bin run_task2: poisson2d.ld_st.bin
$(SC18_SUBMIT_CMD) ./$< 200 1024 $(SC19_SUBMIT_CMD) ./$< 200 1024
run_task3_1: poisson2d.vld.bin run_task3_1: poisson2d.vld.bin
$(SC18_SUBMIT_CMD) ./$< 200 1024 $(SC19_SUBMIT_CMD) ./$< 200 1024
run_task3_2: poisson2d.vst.bin run_task3_2: poisson2d.vst.bin
$(SC18_SUBMIT_CMD) ./$< 200 1024 $(SC19_SUBMIT_CMD) ./$< 200 1024
run_task3: run_task3_1 run_task3_2 run_task3: run_task3_1 run_task3_2
run_task4_1: poisson2d.sflop.bin run_task4_1: poisson2d.sflop.bin
$(SC18_SUBMIT_CMD) ./$< 200 1024 $(SC19_SUBMIT_CMD) ./$< 200 1024
run_task4_2: poisson2d.vflop.bin run_task4_2: poisson2d.vflop.bin
$(SC18_SUBMIT_CMD) ./$< 200 1024 $(SC19_SUBMIT_CMD) ./$< 200 1024
run_task4: run_task4_1 run_task4_2 run_task4: run_task4_1 run_task4_2
bench_task1: poisson2d.ins_cyc.bin bench_task1: poisson2d.ins_cyc.bin
$(SC18_SUBMIT_CMD) ./bench.sh $< $(SC18_DIR_SCRATCH)/$<.csv $(SC19_SUBMIT_CMD) ./bench.sh $< $(SC19_DIR_SCRATCH)/$<.csv
mv $(SC18_DIR_SCRATCH)/$<.csv . mv $(SC19_DIR_SCRATCH)/$<.csv .
bench_task2: poisson2d.ld_st.bin bench_task2: poisson2d.ld_st.bin
$(SC18_SUBMIT_CMD) ./bench.sh $< $(SC18_DIR_SCRATCH)/$<.csv $(SC19_SUBMIT_CMD) ./bench.sh $< $(SC19_DIR_SCRATCH)/$<.csv
mv $(SC18_DIR_SCRATCH)/$<.csv . mv $(SC19_DIR_SCRATCH)/$<.csv .
bench_task3_1: poisson2d.vld.bin bench_task3_1: poisson2d.vld.bin
$(SC18_SUBMIT_CMD) ./bench.sh $< $(SC18_DIR_SCRATCH)/$<.csv $(SC19_SUBMIT_CMD) ./bench.sh $< $(SC19_DIR_SCRATCH)/$<.csv
mv $(SC18_DIR_SCRATCH)/$<.csv . mv $(SC19_DIR_SCRATCH)/$<.csv .
bench_task3_2: poisson2d.vst.bin bench_task3_2: poisson2d.vst.bin
$(SC18_SUBMIT_CMD) ./bench.sh $< $(SC18_DIR_SCRATCH)/$<.csv $(SC19_SUBMIT_CMD) ./bench.sh $< $(SC19_DIR_SCRATCH)/$<.csv
mv $(SC18_DIR_SCRATCH)/$<.csv . mv $(SC19_DIR_SCRATCH)/$<.csv .
bench_task3: bench_task3_1 bench_task3_2 bench_task3: bench_task3_1 bench_task3_2
bench_task4_1: poisson2d.sflop.bin bench_task4_1: poisson2d.sflop.bin
$(SC18_SUBMIT_CMD) ./bench.sh $< $(SC18_DIR_SCRATCH)/$<.csv $(SC19_SUBMIT_CMD) ./bench.sh $< $(SC19_DIR_SCRATCH)/$<.csv
mv $(SC18_DIR_SCRATCH)/$<.csv . mv $(SC19_DIR_SCRATCH)/$<.csv .
bench_task4_2: poisson2d.vflop.bin bench_task4_2: poisson2d.vflop.bin
$(SC18_SUBMIT_CMD) ./bench.sh $< $(SC18_DIR_SCRATCH)/$<.csv $(SC19_SUBMIT_CMD) ./bench.sh $< $(SC19_DIR_SCRATCH)/$<.csv
mv $(SC18_DIR_SCRATCH)/$<.csv . mv $(SC19_DIR_SCRATCH)/$<.csv .
bench_task4: bench_task4_1 bench_task4_2 bench_task4: bench_task4_1 bench_task4_2
clean_scratch_csv: clean_scratch_csv:
${RM} $(SC18_DIR_SCRATCH)/*.csv ${RM} $(SC19_DIR_SCRATCH)/*.csv
clean_csv: clean_scratch_csv clean_csv: clean_scratch_csv
${RM} *.csv ${RM} *.csv
...@@ -82,32 +82,25 @@ graph_task2c: plot-task2c.pdf ...@@ -82,32 +82,25 @@ graph_task2c: plot-task2c.pdf
graph_task4: plot-task4.pdf graph_task4: plot-task4.pdf
graph_task4-2: plot-task4-2.pdf graph_task4-2: plot-task4-2.pdf
plot-task1.pdf: poisson2d.ins_cyc.bin.csv plot-task1.pdf: poisson2d.ins_cyc.bin.csv
@test "$$SC18_MODULE_ACTIVE_1" -eq "1" || "Please load the module of this task, sc18/handson1."
python3 -c "import graphing; graphing.task1()" python3 -c "import graphing; graphing.task1()"
@test -n "$$DISPLAY" || "No X forwarding found. Either reconnect with X forwarding (-X / -Y) or download $@ with scp." @test -n "$$DISPLAY" || "No X forwarding found. Either reconnect with X forwarding (-X / -Y) or download $@ with scp."
display $@ display $@
plot-task2a.pdf: poisson2d.ld_st.bin.csv plot-task2a.pdf: poisson2d.ld_st.bin.csv
@test "$$SC18_MODULE_ACTIVE_1" -eq "1" || "Please load the module of this task, sc18/handson1."
python3 -c "import graphing; graphing.task2a()" python3 -c "import graphing; graphing.task2a()"
display $@ display $@
plot-task2b.pdf: poisson2d.vld.bin.csv poisson2d.vst.bin.csv plot-task2b.pdf: poisson2d.vld.bin.csv poisson2d.vst.bin.csv
@test "$$SC18_MODULE_ACTIVE_1" -eq "1" || "Please load the module of this task, sc18/handson1."
python3 -c "import graphing; graphing.task2b()" python3 -c "import graphing; graphing.task2b()"
display $@ display $@
plot-task2b-2.pdf: poisson2d.vld.bin.csv poisson2d.vst.bin.csv poisson2d.ld_st.bin.csv plot-task2b-2.pdf: poisson2d.vld.bin.csv poisson2d.vst.bin.csv poisson2d.ld_st.bin.csv
@test "$$SC18_MODULE_ACTIVE_1" -eq "1" || "Please load the module of this task, sc18/handson1."
python3 -c "import graphing; graphing.task2b(bytes=True)" python3 -c "import graphing; graphing.task2b(bytes=True)"
display $@ display $@
plot-task2c.pdf: poisson2d.vld.bin.csv poisson2d.vst.bin.csv poisson2d.ld_st.bin.csv poisson2d.ins_cyc.bin.csv plot-task2c.pdf: poisson2d.vld.bin.csv poisson2d.vst.bin.csv poisson2d.ld_st.bin.csv poisson2d.ins_cyc.bin.csv
@test "$$SC18_MODULE_ACTIVE_1" -eq "1" || "Please load the module of this task, sc18/handson1."
python3 -c "import graphing; graphing.task2c()" python3 -c "import graphing; graphing.task2c()"
display $@ display $@
plot-task4.pdf: poisson2d.sflop.bin.csv poisson2d.vflop.bin.csv plot-task4.pdf: poisson2d.sflop.bin.csv poisson2d.vflop.bin.csv
@test "$$SC18_MODULE_ACTIVE_1" -eq "1" || "Please load the module of this task, sc18/handson1."
python3 -c "import graphing; graphing.task4()" python3 -c "import graphing; graphing.task4()"
display $@ display $@
plot-task4-2.pdf: poisson2d.sflop.bin.csv poisson2d.vflop.bin.csv plot-task4-2.pdf: poisson2d.sflop.bin.csv poisson2d.vflop.bin.csv
@test "$$SC18_MODULE_ACTIVE_1" -eq "1" || "Please load the module of this task, sc18/handson1."
python3 -c "import graphing; graphing.task4(ai=True)" python3 -c "import graphing; graphing.task4(ai=True)"
display $@ display $@
......
def normalize(df, old_column, new_column): def normalize(df, old_column, new_column):
df[new_column] = df[old_column] / (df["ny"] * df["nx"]) df[new_column] = df[old_column] / (df["ny"] * df["nx"])
def print_and_return_fit(list_of_quantities, dataframe, function, format_value=">7.4f", format_uncertainty="f", _print=True):
"""Use `curve_fit` to fit each quantity in `list_of_quantity` wrt to `dataframe.index`. Print (selectable) and return the result."""
import numpy as np
from scipy.optimize import curve_fit
_fit_parameters = {}
_fit_covariance = {}
_quantity_padding = np.max([len(_str) for _str in list_of_quantities])
for quantity in list_of_quantities:
_fit_parameters[quantity], _fit_covariance[quantity] = curve_fit(function, dataframe.index, dataframe[quantity])
if (_print):
print("Counter {:>{_quantity_padding}} is proportional to the grid points (nx*ny) by a factor of {:{format_value}} (± {:{format_uncertainty}})".format(
quantity,
_fit_parameters[quantity][0],
np.sqrt(np.diag(_fit_covariance[quantity]))[0],
_quantity_padding=_quantity_padding,
format_value=format_value,
format_uncertainty=format_uncertainty
))
return (_fit_parameters, _fit_covariance)
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment