Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# needs to be run as root
# download and install EPD and gfortran
mkdir /tmp/hpc3
cd /tmp/hpc3
curl -L -o e.zip http://bit.ly/hpc_3
unzip e.zip
#!/bin/bash
# user local install
export CLAW=~/opt/clawpack
mkdir -p $CLAW
cp -R /opt/clawpack/* $CLAW
export PATH=/Library/Frameworks/EPD64.framework/Versions/Current/bin:$PATH
export RIEMANN=$CLAW/riemann
export PYCLAW=$CLAW/pyclaw
@ahmadia
ahmadia / install.md
Created June 11, 2012 09:41
Pandoc Markdown code example of building PyClaw on a BlueGene/P supercomputer from scratch

Build Notes

“If you want to make an apple pie from scratch, you must first create the universe.” - Sagan

prep

echo "\nPrep/Setup"
echo "~~~~~~~~~~"
======================================================================
ERROR: test_1d_acoustics
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/aron/.virtualenvs/pyclaw/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
self.test(*self.arg)
File "/Users/aron/sandbox/clawpack/clawpack/pyclaw/util.py", line 126, in test_app
raise VerifyError(err)
VerifyError: /Users/aron/sandbox/clawpack/pyclaw/apps/acoustics_1d_homogeneous/acoustics.py
********************************************************************************
@ahmadia
ahmadia / jed.pyx
Created October 15, 2012 16:17
basic cythonized version of Jed's code
cimport cython
cimport numpy as np
import numpy as np
DTYPE = np.float
ctypedef np.float DTYPE_t
@ahmadia
ahmadia / qt_scikit_capture.py
Last active December 14, 2015 22:59
capture and playback
import os
import sys
import time
import numpy as np
import matplotlib as mpl
mpl.use('Qt4Agg')
mpl.rcParams['backend.qt4']='PySide'
mpl.rcParams['toolbar'] = 'None'
@ahmadia
ahmadia / eulerian_vid_mag.py
Created March 15, 2013 14:51
Eulerian Video Magnification
#!/usr/bin/env python
import cv
import os
import sys
from skimage import io
from skimage.transform import pyramid_expand
from skimage import img_as_ubyte
import numpy as np
@ahmadia
ahmadia / rp2_pwconst_acoustics_module.f90
Created April 14, 2013 09:17
Randy LeVeque's proposed refactor
! Sample rp2 module for an application where the material parameters
! are piecewise constant, with one set of values for x < xdiscont
! and another set for x > xdiscont.
! Rather than storing values in aux arrays, the rpaux derived type
! could be modified to contain x values a the cell centers.
! rpt2 not yet written and this hasn't been tried, so may be bugs!
module rp2_pwconst_acoustics_module
@ahmadia
ahmadia / gist:5550933
Last active December 17, 2015 04:29
numba for USR kernel (dirty)
from numba import autojit
import numpy as np
import numpy.testing as npt
import time
import gc
def usr(x, y, s=0.9, n=10):
scores = 1.0 / (1.0 + 1/12.0 * np.abs(x-y).sum(axis=1))
scores = scores[scores>=s]
scores.sort()
@ahmadia
ahmadia / mf_numba.py
Last active December 17, 2015 10:29
numba tuned version of mf_numba.py, see: https://gist.github.com/jhemann/5584536 for previous versions and provenance. This has been updated to handle default arguments correctly.
# -*- coding: utf-8 -*-
#!/usr/bin/python
#
# Created by Albert Au Yeung (2010)
# http://www.quuxlabs.com/blog/2010/09/matrix-factorization-a-simple-tutorial-and-implementation-in-python/#source-code
#
# Modifications by Josh Hemann and Aron Ahmadia
#
# An implementation of matrix factorization
#