Skip to content

Instantly share code, notes, and snippets.

View culurciello's full-sized avatar

Eugenio Culurciello culurciello

View GitHub Profile
@culurciello
culurciello / testffi.lua
Last active August 29, 2015 13:57
torchFFI vs regular lua code: HUGE improvement
-- test of FFI vs regular lua code
-- EC march 21st 2014
torch.setdefaulttensortype('torch.FloatTensor')
require 'sys'
require 'image'
require 'torchffi'
local bit = require('bit')
local ffi = require('ffi')
@culurciello
culurciello / gist:8410551
Last active January 3, 2016 04:39
apple accelerate matrix matrix multiply example
/*
Test of C code speed with Apple Accelerate Framework and openmp
https://developer.apple.com/library/mac/documentation/Accelerate/Reference/BLAS_Ref/Reference/reference.html#//apple_ref/c/func/cblas_sgemm
compile with:
gcc -Ofast -fopenmp -flax-vector-conversions -framework Accelerate acctest.c
*/
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
@culurciello
culurciello / mactest.c
Last active January 3, 2016 01:29
test of computer speed with dummy math/lin algebra code
/*
Test of C code speed
compile with: gcc -Ofast -fopenmp -mavx mactest.c
or gfortran -O3 -fopenmp mactest.c
*/
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <sys/time.h>
@culurciello
culurciello / gist:5189137
Last active November 8, 2016 14:29
test of torch numerical performance
#!/usr/bin/env torch
require 'nn'
require 'image'
require 'xlua'
require 'pl'
opt = lapp[[
-t,--threads (default 8) number of threads
-p,--type (default float) float or cuda