From: Francis Russell Date: Mon, 18 Feb 2013 18:33:47 +0000 (+0000) Subject: Add diagram of simulation cell and example of DSL syntax. X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=b349f15be4981ff6123bf844833aa89a5d1742fe;p=francis%2Fpsl_presentation_20130225.git Add diagram of simulation cell and example of DSL syntax. --- diff --git a/.gitignore b/.gitignore index 8ae8e9d..8138dbc 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ /*.toc /code/*.tex /images-dot/*.tex +/images-svg/*.pdf diff --git a/Makefile b/Makefile index bbbf133..228e24c 100644 --- a/Makefile +++ b/Makefile @@ -7,6 +7,7 @@ SVG_OUTPUTS=${patsubst %.svg,%.pdf,$(SVG_SOURCES)} CODE_FOLDER=code CODE_F90_TEX_FILES=${patsubst %.F90,%.tex,$(wildcard $(CODE_FOLDER)/*.F90)} CODE_UFL_TEX_FILES=${patsubst %.ufl,%.tex,$(wildcard $(CODE_FOLDER)/*.ufl)} +CODE_RAW_FILES=$(wildcard $(CODE_FOLDER)/*.ofl) CODE_TEX_FILES=$(CODE_F90_TEX_FILES) $(CODE_UFL_TEX_FILES) DOT_FOLDER=images-dot @@ -28,7 +29,7 @@ display-4up: presentation-4up.pdf presentation-4up.pdf: presentation.pdf pdfnup --nup 2x2 --a4paper --scale 0.95 --frame true presentation.pdf -o presentation-4up.pdf -presentation.pdf: $(IMAGE_FILES) $(SVG_OUTPUTS) $(CODE_TEX_FILES) $(DOT_TEX_FILES) $(wildcard *.tex *.sty) pygments.sty +presentation.pdf: $(IMAGE_FILES) $(SVG_OUTPUTS) $(CODE_TEX_FILES) $(CODE_RAW_FILES) $(DOT_TEX_FILES) $(wildcard *.tex *.sty) pygments.sty pdflatex -draftmode presentation &&\ while(pdflatex presentation | tee $(PDFLATEX_OUTPUT_LOG) && grep "Rerun to get cross-references right" $(PDFLATEX_OUTPUT_LOG)); do true; done &&\ rm -f $(PDFLATEX_OUTPUT_LOG) diff --git a/code/density_on_dbl_grid.ofl b/code/density_on_dbl_grid.ofl new file mode 100644 index 0000000..506af46 --- /dev/null +++ b/code/density_on_dbl_grid.ofl @@ -0,0 +1,23 @@ +# Parameter information +Function[SpinIndex] density_dbl +Real[SpinIndex, FunctionIndex, FunctionIndex] denskern +Real[FunctionIndex, FunctionIndex] overlap +Function[FunctionIndex] ngwfs +SpinIndex spin +FunctionIndex alpha, beta + +# Computation +density_dbl[spin] = sum(ngwfs[alpha]*sum(denskern[spin, alpha, beta] * ngwfs[beta], beta), alpha) + +# Implementation specific +target ONETEP +Variable density_dbl = fortran_param with name("density_dbl"), type(double(a,b,c,d)), + space(psinc_fine_grid(a,b,c)), indexed(spin(d)) +Variable denskern = fortran_param with name("denskern"), type(spam3(a)), + indexed(direction(a) * row * col) +Variable overlap = fortran_param with name("overlap"), type(spam3) +Parameter ngwf_basis = fortran_param with name("ngwf_basis"), type(func_basis) +Parameter ngwfs_on_grid = fortran_param with name("ngwfs_on_grid"), type(double(:)) +Variable ngwfs = ppd_function_set with data(ngwfs_on_grid), basis(ngwf_basis) +OutputFunction output = fortran_function with name("density_on_dbl_grid"), + params(density_dbl, denskern, overlap, ngwfs_on_grid, ngwf_basis) diff --git a/images-svg/simulation_cell.svg b/images-svg/simulation_cell.svg new file mode 100644 index 0000000..77d328d --- /dev/null +++ b/images-svg/simulation_cell.svg @@ -0,0 +1,416 @@ + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + α + + + + β + + + + simulation cell + FFT box + zero padding region + bra function + ket function + + + + + + + diff --git a/presentation.tex b/presentation.tex index 17059bb..e5b4927 100644 --- a/presentation.tex +++ b/presentation.tex @@ -346,7 +346,7 @@ of distinct patterns. \frametitle{Variability in ONETEP} -Calculations in ONETEP typically computer either: +Calculations in ONETEP typically compute either: \begin{enumerate} @@ -380,7 +380,7 @@ ways. These include: \item Up-sampling fields. \item Down-sampling fields. -\item Computing gradients operations in momentum space. +\item Computing gradient operations in momentum space. \end{itemize} @@ -402,18 +402,63 @@ ways. These include: \item Down-sampling involves discarding parts of the frequency decomposition returned by an FFT (the high-frequency components). -\item Often, the region being transformed by an FFT is filled with mostly zeros. +\item Quite often, a region needing to be upsampled is filled with mostly zeros, +although the output may be dense and completely fill an FFT box. \end{itemize} +} + +\frame{ + +\frametitle{Sparsity in the simulation cell} + \centering -%\resizebox{0.5\linewidth}{!}{\includegraphics{images/fftbox}} -\footnote{Skylaris, Mostofi, Haynes, Pickard \& Payne, 2001, "Accurate kinetic -energy evaluation in electronic structure calculations with localized functions -on a real space grid".} +\resizebox{\textwidth}{!}{ +\includegraphics{images-svg/simulation_cell} +} } + + +\frame{ + +\frametitle{Our new approach} + +\begin{itemize} + +\item We have developed a Haskell implementation that parses a refined DSL that + was developed at one ONETEP masterclass. + +\item One of the hardest parts is developing a syntax that permits a reasonably + flexible mapping from the abstractly defined operands to the specific data + structures used within ONETEP. + +\item Our intent is to ``pattern match'' on the calculation to generate code + with a structure similar to the optimised implementations used in ONETEP. + +\item Within the generated code, we will look at how to compose the component + Fourier transforms to reduce computation. + +\end{itemize} + +} + +\frame{ + +\frametitle{Current DSL syntax} + +\resizebox{\textwidth}{!}{ +\begin{minipage}{1.6\textwidth} +\begin{alltt} +\input{code/density_on_dbl_grid.ofl} +\end{alltt} +\end{minipage} +} + +} + \end{document}