Personal Slurm Reference 2015-10-18

Slurm reference and useful things for running jobs on the labs cluster. Might be useful for other people, posting here for future reference.

Base slurm batch file

#!/bin/bash
#SBATCH -N 1                      # This requests one node
#SBATCH -n 8                      # Request 8 cores on a node
#SBATCH -t 0-10:00                # Walltime days-hours:minutes
#SBATCH --job-name=job_name       # Name of the job
#SBATCH --array=0-100             # Array job with 100 tasks
cd $SLURM_SUBMIT_DIR              # Change directory to the one where the script was executed
./ThingToRun $SLURM_ARRAY_TASK_ID # Executable that will be run for this job

Reveal.js Vimeo slideshow 2015-10-17

In the lab we’ve sometimes had to show videos at open-house like events for the department or when visitors come. I’d implemented a slideshow using reveal.js and froogaloop in the past but the code was lost to time. I figured that this time I would document it for future use.

For completeness a working example is here

Beyond the Reveal.js and Froogaloop documentations this page has a useful example.

Specifications:

  • Start when user hits the right/left arrow or the play button is clicked on the first video
  • Pause the current video if the next/previous slide is pressed before the current video ends
  • Specify videos in a list that can easily be added/removed from

Asynchronous Simulation And Storage 2015-10-12

This post is about solving a problem that has always been at the back of my mind: How can I speed up my simulations when I have large amounts of File I/O to perform. In many cases I have to write simulation data at 60 FPS for rendering purposes and it can take many seconds to compress and write out a large set of data while it only takes a second or two to simulate.

In this post I will show a simple snippet of code that builds upon an earlier post about using gzwrite to compress data.

NVIDIA Tools Extension Library (NVTX) Scoped Timer 2015-07-20

NVIDIA’s Tools Extension library is an easy way to add profiling information to your code if you use their NSight profiler. Beyond the simple example shown here, timers can be colored, set to a specific version and there are special language specific functions for CUDA and OpenCL. See the reference below for more information.

The example here is extremely simply in nature but shows how NVTX can be used to create a lightweight scoped timer. The idea of a scoped timer useful because it allows you to time a section of code and when the timer loses scope it will stop itself automatically by calling its destructor.

Timing data will automatically show up when enabled in NSight.

References:

NVIDIA Tools Extension

Code

struct NVTXTimer
{
    NVTXTimer(const char *name){
        nvtxRangePushA(name);
    }
    ~NVTXTimer(){
        nvtxRangePop();
    }
};

Add GCC compiler to Xcode 6 2015-02-25

A few years ago I wrote a guide on how to add a newer version of GCC to Xcode. At the time OSX/Xcode came with a version of GCC 4.2 that could be modified to run as a different version of GCC. The problem with newer versions of Xcode is that the GCC compiler was removed making it more difficult to add a custom compiler.

The plugin is based on an older xcode-gcc plugin which hasn’t been updated for Xcode 6 and a post on stackoverflow. The modifications themselves are pretty simple and as long as the plugin structure doesn’t change with future versions of Xcode, they should work with with newer versions of GCC. You can see the modifications in the revision history.