Tuesday, May 23, 2017

KGen

"KGen is a Python tool that extracts partial codes out of a large Fortran application and converts them into a standalone/verifiable/executable kernel.

A kernel is a small software that represents a certain characteristic of a larger application. It can be compiled and run generally without using external library on a single computing node. Due to its simple usage, it can greatly improve productivity of various software engineering tasks such as performance optimization, debugging, porting, verification, and so on.

In addition, a kernel could be an efficient vehcle for enhancing communication between collaborators possibly from various disciplines. For example, a kernel that contains a compiler bug is useful not only for reporting the bug but also for producing and fixing the bug by compiler engineer.

While a kernel is useful for many software engineering tasks, it is generally hard to create one. Mere copying and pasting an interesting block of code generally does not produce compilable software. In manual kernel extraction, it is common to scan through all source files to find required statements such as variable declaration and importing other modules. Furthermore, preparing state data for driving the execution of a generated kernel is generally harder task. For example, if a structured variable contains a pointer variable of another structured variable, user should manually copy those variables, aka, deep copying.

Fortunately, most of kernel extraction task from large Fortran application can be automated through static analysis, which is a core function of KGen.

KGen is simple to use. First user specifies a block of code in a target Fortran software with Linux commands for clean/build/run the software. Using these information, KGen scans through all the necessary source files and marks statements that are required to make the marked block to be a standalone/executable/verifiable kernel. Current version of KGen extensively uses F2PY, an excellant Fortran parser written in Python, to generate Abstract Syntax Trees. KGen traverses the ASTs instead of actually reading text source files for collecting analysis information and eventually selects a minimal set of statements for kernel generation.

KGen also produces input data to drive kernel execution and output data to verify its corrrectness. The data generation supports Fortran derived types that can contain another derived type variables. When KGen-generated kernel is executed, the details of verification result will be automaticaly shown on screen with timing information for performance measurement.

Original use case that we had in mind when we envisioned this tool was performance optimization of large scientific applications. The application we were optimizing has been being actively developed/used by scientists around the world. To keep the pace of fast chainging code, we have to split a large task with many smaller tasks so that several enginners optimize their part of code parallely. Soon after we have this capability of automated kernel generation, it turned out that we could use this technique for other types of tasks including debugging large applications, verification of simulation result, collaborating with compiler vendors, and creating custom benchmark tests. Several kernels that have been extracted using this tool can be downloaded from github.com/NCAR/kernelOptimization github repository."

https://ncar.github.io/kgendocs/

https://github.com/NCAR/KGen

AxiSEM

"AxiSEM is a parallel spectral-element method to solve 3D wave propagation in a sphere with axisymmetric or spherically symmetric visco-elastic, acoustic, anisotropic structures. "

https://github.com/geodynamics/axisem 

Monday, May 22, 2017

pv_atmos

"Python scripting for scientific visualization software ParaView. Historically, pv_atmos has been developed to work with geophysical, and in particular, atmospheric model data (hence the name). However, pv_atmos has evolved into a very general package, and contains routines for visualizing netCDF data, and the capability to show arbitrary axes and labels in a large variety of geometries (linear and logarithmic axes, spherical geometry).

This package is described in an open access peer-reviewed article: Jucker, M 2014. Scientific Visualisation of Atmospheric Data with ParaView. Journal of Open Research Software 2(1):e4, DOI: http://dx.doi.org/10.5334/jors.al. Please cite this work if you use this software for your publications.

The modules and functions within them include

pv_atmos.basic

Provides functionality to read data on a 2D or 3D linear or logarithmic coordinates grid, including time evolution (if present) from a netCDF file. The netCDF should loosely correspond to the Climate and Forecast (FC) conventions. The important attribute is the time coordinate: ParaView will be looking for the "units: xxxx since xxxx" attribute to decide which dimension corresponds to time.

LoadData()
Read a netCDF file, convert linear to logarithmic (e.g. pressure to log-pressure) coordinate if desired, and transform according to prefered aspect ratio.
Cart2Spherical()
Transform rectangular geometry into a sphere with given radius.
Make3D()
Take a dataset with (a) 2D variable(s), and expand the chosen variable as third dimension. Classic example: Ocean bathymetry on a lon-lat grid.
TransformCoords()
If not already done when loading the data, apply coordinate transformation in Cartesian coordinates, according to specified aspect ratio and logarithmic coordinates.
MakeSelectable()
In order to be able to switch any filter's visibility on/off in the GUI's pipeline, call this helper function.
DeleteAll(), HideAll(), ShowAll()
Delete, hide, or show all filters present in the pipeline.
CartWind2Sphere()
Converts zonal and meridional winds (or any velocity) from m/s into degrees longitude per time step and degrees latitude per time step. It can also convert pressure velocity from hPa/s into the new vertical coordinate measure per time step.
Sphere2xyz(), xyz2Sphere()
Convert a given point in spherical (Cartesian) coordinates into Cartesian (spherical) coordinates, given the transformations applied to the data. Helpful to position labels, camera, etc.

pv_atmos.grids

Provides the possibility to add axes, grid lines, planes (cuts), and labels. In case of spherical geometry, one can also add shells, which are spheres of a radius corresponding to a given vertical level. Planes and shells contain data information, and can therefore be used for data analysis as well as grid information.

These routines are not limited to any kind of data, and can be used with any data, or even without data, to add a custom grid to a visualization.

AddGrid()
Add a full grid, including grid lines at custom levels of all dimensions. This includes the appropriate lables of the grid lines, and labeling the axes.
SphericalShells()
Similar to AddGrid() in Cartesian coordinates, this adds shells around a sphere to serve as grid. These shells are labeled with the appropriate level value, and a water mark can be added to the outermost shell.
AddGridPlane()
Add one grid plane along one dimension.
AddGridLabel()
Add one label along one dimension.
AddAxisLabel()
Label one given axis
SphericalLabels()
Label any number of vertical levels in spherical geometry.
WaterMark()
Add a water mark to one of the spherical shells. Nice to brand your viz.
LonLat2Polar()
Project 2D longitude-latitude or 3D longitude-latitude-vertical data onto polar coordinates around the North or South pole. This has a little 3D twist, in that the projection can be domed in the vertical.

https://github.com/mjucker/pv_atmos

ArduBlock

"ArduBlock is a Block Programming Language for Arduino. The language and functions model closely to Arduino Language Reference.

Ardublock is a free graphical programming environment to make programming physical computing with Arduino as easy as drag and drop. It is based on the popular ‘scratch’ programming language, which many will already be familiar with. Ardublock generates code in C, a text based language used by the Arduino IDE, which can then be studied and modified if desired.

Ardublock is an extension to the Arduino IDE so that will need to be downloaded as well (found here https://www.arduino.cc/en/Main/Software)."

https://github.com/stfc/ardublock

FORD

"This is an automatic documentation generator for modern Fortran programs. FORD stands for FORtran Documenter. As you may know, "to ford" refers to crossing a river (or other body of water). It does not, in this context, refer to any company or individual associated with cars.

Ford was written due to Doxygen's poor handling of Fortran and the lack of comparable alternatives. ROBODoc can't actually extract any information from the source code and just about any other automatic documentation software I found was either proprietary, didn't work very well for Fortran, or was limited in terms of how it produced its output. f90doc is quite good and I managed to modify it so that it could handle most of Fortran 2003, but it produces rather ugly documentation, can't provide as many links between different parts of the documentation as I'd like, and is written in Perl (which I'm not that familiar with and which lacks the sort of libraries found in Python for producing HTML content).

The goal of FORD is to be able to reliably produce documentation for modern Fortran software which is informative and nice to look at. The documentation should be easy to write and non-obtrusive within the code. While it will never be as feature-rich as Doxygen, hopefully FORD will be able to provide a good alternative for documenting Fortran projects.

The features are:
  • the ability to extract information about variables, procedures, procedure arguments, derived types, programs, and modules from the source code.
  • the ability to extract documentation from comments in the source code.
  • LaTeX support in documentation using MathJax.
  • searchable documentation, using Tipue Search.
  • author description and social media (including Github!) links.
  • links to download the source code.
  • links to individual files, both in their raw form or in HTML with syntax highlighting.
  • use of Markdown to type-set documentation.
  • links between related parts of the software.
  • Bootstrap CSS for the documentation, making it both functional and pretty.
  • configurable settings.
  • ability to create a hiearchical set of pages containing general information, not associated with any particular part of the source code.
  • display an entry for non-Fortran source files with file-level documentation and syntax highlighted code.
https://github.com/cmacmackin/ford

Scribbler

"Pelican wrapper for scientific note-taking.

Scribbler is a piece of software for managing a notebook from the command line. It was written with scientific note-taking in mind, but could be used for other purposes as well.

The goal was to allow notes to be taken in Markdown, avoiding the need for irritating button pressing when links and images need to be added, with sufficient extensions to make the inclusion of PDF images, LaTeX, BibTeX-style referencing, and various other features possible. Scribbler achieves this by acting as a wrapper for the Pelican static-site generator, for which various additional plugins have been written to give it the desired features. Scribbler also converts the HTML output of Pelican into PDF files which can be printed and placed in a binder along with any hand-written notes.

By default notes are written in Markdown, although they may also be written in reStructuredText or HTML. As Scribbler is just a wrapper for Pelican, it is strongly recommended that you read its documentation on writing content. Note that what they refer to as "articles" are equivalent to notes and what they refer to as "pages" are equivalent to appendices. The Pelican syntax for internal links will work with Scribbler, although Scribbler's directory structure is a little different. Whereas the root of the directory structure seen by Pelican is the content directory, for Scribbler it is the top level of the notebook's directory. However, links will only be generated to the contents of the notes, appendices, and files folders.

In addition to standard Markdown, various plugins are loaded providing extra functionality. Of particular note is Markdown Extra, which provides syntax for such things as footnotes, tables, and more. CodeHilite provides syntax-highlighting for code-snippets, as described in the Pelican documentation. figureAltCaption will convert each image which stands in its own paragraph into a <figure> element, with the alt-text used as a caption.

Additionally, several Pelican plugins are used to provide further functionality. These plugins can be used with reStructuredText and HTML content as well as Markdown.

render_math provides support for LaTeX equations. In Markdown, inline math appears between dollar signs. However, there must be now white spacce before the ending $ (i.e. $x^2$ will render, but $ x^2 $ will not). Math appearing on its own line should use double dollar-signs ($$). \begin{equation} and \end{equation} can also be used and the equation can be labelled and referenced, as in actual LaTeX. Note that this depends on MathJax to work and will only render if there is an internet connection.

The pdf-img plugin, which I wrote specifically for Scribbler, allows PDF, PS, and EPS graphics to be used as the source for images. This plugin will simply scan through all images in each note and appendix. If it ends with the extension pdf, ps, or eps then it will create a PNG thumbnail of the first page of the document. This thumbnail will be inserted as the image source, while the image itself will act as a link to the original PDF/PS/EPS file.

My figure-ref plugin (also written for Scribbler) will look for any figures in the HTML output whose caption begins with the format labelname ::. This will be replaced by a figure number. Any references to {#labelname} in the rest of the note will also be replaced with the correct figure number.

Finally, pelican-cite allows BibTeX-style referencing within your notes. If a bibfile is specified in your notebook settings then it will be used as a database of bibliographic data. This file may, optionally be provided or overridden on a per-note basis by adding the metadata publications_src. Inline references can then be provided with the syntax [@bibtexkey] (for author names with year in parentheses) or [@@bibtexkey] (for author names and year all in parentheses). The inline citation will act as a link to a full bibliography entry at the end of the note."

https://github.com/cmacmackin/scribbler

Pelican

"Static site generator that supports Markdown and reST syntax.

Pelican is a static site generator, written in Python.
  • Write content in reStructuredText or Markdown using your editor of choice
  • Includes a simple command line tool to (re)generate site files
  • Easy to interface with version control systems and web hooks
  • Completely static output is simple to host anywhere
The features are:
  • Chronological content (e.g., articles, blog posts) as well as static pages
  • Integration with external services (e.g., Google Analytics and Disqus)
  • Site themes (created using Jinja2 templates)
  • Publication of articles in multiple languages
  • Generation of Atom and RSS feeds
  • Syntax highlighting via Pygments
  • Importing existing content from WordPress, Dotclear, and other services
  • Fast rebuild times due to content caching and selective output writing
Check out Pelican's documentation for further information."

https://github.com/getpelican/pelican

http://docs.getpelican.com/en/stable/