Skip to content

Instantly share code, notes, and snippets.

View nouiz's full-sized avatar

Frédéric Bastien nouiz

  • NVIDIA
  • Montréal
View GitHub Profile
@nouiz
nouiz / gist:2038703
Created March 14, 2012 19:04 — forked from benanne/gist:2025317
lngamma in theano
import numpy as np
import theano
import theano.tensor as T
def log_gamma_lanczos(z):
assert z.dtype.startswith("float")
# reflection formula. Normally only used for negative arguments,
# but here it's also used for 0 < z < 0.5 to improve accuracy in
# this region.
@nouiz
nouiz / time_cudaMemcpyAsync.cu
Created October 1, 2012 20:26 — forked from mrocklin/time_cudaMemcpyAsync.cu
A quick CUDA program to time the effectiveness of using asynchronous CPU-GPU memory transfers.
#include <stdio.h>
#include <sys/time.h>
const int n = 160000000;
// Print number of milliseconds between timevals
void printDuration(timeval a, timeval b, char* message)
{
double elapsedTime = (b.tv_sec - a.tv_sec) * 1000.0;
elapsedTime += (b.tv_usec - a.tv_usec) / 1000.0;