Skip to content

Instantly share code, notes, and snippets.

View jaberg's full-sized avatar

James Bergstra jaberg

  • kindred.ai
  • Toronto ON
View GitHub Profile
@jaberg
jaberg / ElmanComparison.ipynb
Created August 21, 2016 16:45
Shared vars and small functions for fast, flexible way of doing RNNs with Theano
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jaberg
jaberg / bootstrap_python_sharcnet.sh
Created August 16, 2013 16:39
Bootstrap a gcc-based Python environment on Sharcnet (tested on Monk)
#!/bin/bash
# This script installs Python and various site packages on sharcnet using gcc.
# It will create something similar to virtualenv, but with Python itself built
# from scratch. Also, this is not as sophisticated as virtualenv, in particular
# it has no `deactivate` function.
#
# --turn on tracing
@jaberg
jaberg / dot_flops.py
Last active February 25, 2022 22:08
Measure GEMM speed via numpy.dot
#!/bin/python
import sys
import time
import numpy as np
N = int(sys.argv[1])
dtype = sys.argv[2]
A = np.random.rand(N, N).astype(dtype)
B = np.random.rand(N, N).astype(dtype)
@jaberg
jaberg / ondemand_scheduler.py
Created July 8, 2013 01:16
How to generate work on-demand for a dynamically growing cluster of IPython engines.
from IPython.parallel import Client
from IPython.parallel import interactive
import time
import random
@interactive
def work(i):
import time
import random
sleeptime = 1 + random.random() * 2
@jaberg
jaberg / ipython-virtualenv.py
Created November 1, 2012 15:49 — forked from bsweger/ipython-virtualenv.py
(Linux) make iPython virtual env aware
#------------------------------------------------------------------------------
# Make things VirtualEnv aware (Linux version).
# More info: http://www.swegler.com/becky/blog/2011/08/28/python-django-mysql-on-windows-7-part-3-ipython-virtual-environments/
# add this to the end of ipython_config
# (or course, for virtualenvs created via --no-site-packages, it would
# be much easier just to install iPython)
#
# Also consider sourcing this file from ipython_config with execfile().
#
#------------------------------------------------------------------------------
@jaberg
jaberg / gist:3319213
Created August 11, 2012 00:14
LuaTorchTheanoPython
import theano
import numpy as np
class TorchThunk(object):
def __init__(self, op, node, storage, compute, no_recycling):
self.op = op
self.node = node
self.storage = storage
self.compute = compute
self.no_recycling = no_recycling