Posterous theme by Cory Watilo

New Screencasts

A few of the yt developers have been experimenting with screencasts to show off new features or demonstrate how to do some things.  Sam and I have both prepared screencasts on volume rendering and getting started with developing, respectively.  Check them out below, and please feel free to leave comments and let us know what you think -- not just about the screencasts, but about what they demonstrate, and if you think any of the concepts or routines could be made easier.

Dataset Tracking with yt

In this post I'd like to discuss a bit of work in progress to highlight some exciting new features that we hope to have working in yt sometime soon.

On any machine that runs yt, there is a file created in the users home directory named ~/.yt/parameter_files.csv that yt uses internally to keep track of datasets it has seen. This is just a simple text file containing comma-separated entries with a few pieces of information about datasets, like their location on disk and the last date and time they were 'seen' by yt. To keep this file from exploding, it's kept at some maximum number of entries. But, clearly, text is not the ideal way to store this kind of information for anything over a few hundred entries. Recently Matt has been working on updating this system to use a SQLite database, which should have several advantages over the text file in terms of speed and disk usage.

This got me thinking about what could be done to extend this local listing of datasets into something more useful, globally. What if there was a way to view any and all datasets ever seen by yt in one convenient place? It could be searchable over a number of attributes, including creation date and when it was last seen by yt, and it would list which machine the dataset is stored on. Finally, this functionality should be transparent to the user once it is set up (with minimal effort) - the global listing of datasets should just be updated automatically in the background as part of the normal workflow.

Over a couple days last week I did a quick and dirty implementation of this using Amazon AWS SimpleDB and a simple web-cgi script I wrote in Python. The advantages of SimpleDB are that it is "in the cloud" (sheesh) and very inexpensive. In fact, for small databases with low usage levels, it is free. (As an aside, Amazon is very generous with academic grants, which could be used for this or other yt-related services.) The Python script is very simple and can be cloned off of BitBucket. The script can be run on any computer with a webserver and Python (which includes Macs and Linux machines), and I envision a website (perhaps mydb.yt-project.org, for example) being created where a user can login from anywhere to view their datasets easily.

The entire thing is not finished yet: the updates to SimpleDB are not automatic, nor have we settled on a final list of which attributes to store in the listing. However, in two days I was able to get enough working to show what I think are the key killer features of the system in a screencast which I've linked below. I should note that in the time since I made the screencast, I have made a few improvements. In particular, the numerical columns can now be sorted correctly.

I'm excited about the prospects for a simple system like this!

Optimizing yt

This last week, following the release of version 2.2 of yt, I spent a bit of time looking at speed improvements.  There were several places that the code was unacceptably slow:
  • 1D profiles (as noted in our method paper, even)
  • Ghost-zone generation
  • RAMSES grid data loading
The first of these was relatively easy to fix.  In the past, 1D profiles (unlike 2D profiles) were calculated using pure-python mechanisms; numpy was used for digitization, then inverse binning was conducted by the numpy "where" command, and these binnings were used to generate the overall histogram.  However, with 2D and 3D profiles, we used specialized C code written expressly for our purposes.  This last week I found myself waiting for profiles for too long, and I wrote a specialized C function that conducted binning in one-dimensions.  This sped up my profiling code by a factor of 3-4, depending on the specific field being profiled.

The second, ghost zone generation, was harder.  To generated a 'smoothed' grid, interpolation is performed cascading down from the root grid to the final grid, allowing for a buffer region.  This helps to avoid dangling nodes.  Ideally, filling ghost zones would be easier and require less interpolation; however, as we do not restrict the characteristics of the mesh in such a way as to ease this, we have to use the most general case.  I spent some time looking over the code, however, and realized that the most general method of interpolation was being used -- which allowed for interpolation from a regular grid onto arbitrary shapes.  After writing a specialized regular-grid to regular-grid interpolator (and ensuring consistency and identicality of results) I saw a speedup of a factor of about 2.5-3 in generating ghost zones; this has applications from volume rendering to finite differencing and so on.

Finally, in the past, RAMSES grids following regridding were allowed to cross domains (i.e., processor files.)  By rewriting the regridding process to only allow regrids to exist within a single domain, I was able to speed up the process of loading data, allowing it to preload data for things like projections, as well.  Next this will be used as a load balancer, and it will also ease the process of loading particles from disk.  I am optimistic that this will also enable faster, more specific read times to bring down peak memory usage.

Hopefully over the next few months more optimization can be conducted.  If you want to test out how long something takes, particularly if it's a long-running task, I recommend using "pyprof2html", which you can install with "pip install pyprof2html".  Then run a profiling code:

$ python2.7 -m cProfile -o my_slow_script.cprof my_slow_script.py
$ pyprof2html my_slow_script.cprof

This will create a directory called 'html', which has a nice presentation of where things are slow.  If you send the .cprof file to the mailing list, we can take a look, too, and see if there are some obvious places to speed things up.

yt-2.2 Release Announcement


Release Announcement

(Please feel encouraged to forward this message to any other interested parties.)


We are proud to announce the release of yt version 2.2.  This release includes several new features, bug fixes, and numerous improvements to the code base and documentation.  At the new yt homepage,
http://yt-project.org/ , an installation script, a cookbook, documentation and a guide to getting involved can be found.  We are particularly proud of the new GUI, entitled “Reason,” which allows real-time exploration of datasets, and which can be used (locally or remotely over SSH) with no dependencies other than a web browser.  A basic demonstration of its usage can be found at: http://vimeo.com/groups/ytgallery/videos/28506477 .

yt is a community-developed analysis and visualization toolkit for astrophysical simulation data.  yt provides full support for Enzo, Orion, Nyx, and FLASH codes, with preliminary support for the RAMSES, ART, and Maestro codes.  It can be used to create many common types of data products such as:

* Slices
* Projections
* Profiles
* Arbitrary Data Selection
* Cosmological Analysis
* Halo finding
* Parallel AMR Volume Rendering
* Gravitationally Bound Objects Analysis

There are a few major additions since yt-2.1 (Released April 8, 2011), including:

* New web GUI “Reason,” designed for efficient remote usage over SSH tunnels
* Command-line submission to the yt Hub (http://hub.yt-project.org/)
* Absorption line spectrum generator for cosmological simulations
* Support for the Nyx code
* An order of magnitude speed improvement in the RAMSES support
* Experimental interoperability with ParaView
* Quad-tree projections, speeding up the process of projecting by up to an order of magnitude and providing better load balancing
* “mapserver” for in-browser, Google Maps-style slice and projection visualization
* Many bug fixes and performance improvements

With this release, we also unveil the yt Hub, an astrophysical simulation-specific location for sharing scripts, analysis and visualization tools, documents and repositories used to generated publications.  The yt Hub has been designed to allow programmatic access from the command line, and we encourage you to browse the current offerings and contribute your own.  The yt Hub can be found at http://hub.yt-project.org/ .

Documentation: http://yt-project.org/doc/
Installation:http://yt-project.org/doc/advanced/installing.html
Cookbook: http://yt-project.org/doc/cookbook/recipes.html
Get Involved:http://yt-project.org/doc/advanced/developing.html

If you can’t wait to get started, install with:

$ wget http://hg.yt-project.org/yt/raw/stable/doc/install_script.sh
$ bash install_script.sh

-->

Development has been sponsored by the NSF, DOE, and University funding.  We invite you to get involved with developing and using yt!

Please forward this announcement to interested parties.

Sincerely,

The yt development team