Skip to content

Instantly share code, notes, and snippets.

View rrnewton's full-sized avatar

Ryan Newton rrnewton

View GitHub Profile
@rrnewton
rrnewton / cuda_backend_bug
Created June 18, 2012 16:00
Accelerate cuda backend bug reproducer
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE CPP #-}
-- Naive translation of shen_anova1_batch.m into Accelerate.
module Main (main) where
@rrnewton
rrnewton / magnitude.hs
Created May 14, 2012 05:09
Better Haskell magnitude
import Data.Complex
-- This should be the biggest representable double:
big :: Double
big = 1.7976931348623157e308
-- This uses OCaml's approach at overflow-avoidance:
mag :: Complex Double -> Double
mag (x:+y) =
@rrnewton
rrnewton / meta-par-accelerate_blog_post.lhs
Created May 4, 2012 19:19
meta-par-accelerate blog post
> module Main where
How to write hybrid CPU/GPU programs with Haskell
-------------------------------------------------
What's better than programming a GPU with a high-level,
Haskell-embedded DSL (domain-specific-language)? Well, perhaps
writing portable CPU/GPU programs that utilize both pieces of
@rrnewton
rrnewton / forksplit_sketch.hs
Created April 2, 2012 18:36
A sketch of what types for an ST + Par + MVector combination
{-# LANGUAGE RankNTypes, GeneralizedNewtypeDeriving, CPP #-}
import Data.Vector.Mutable as MV
import qualified Data.Vector as V -- ((!), freeze)
import Control.Monad.ST
import Control.Monad.Primitive
import Prelude hiding (read)
type Splitter a = a -> (a,a)
@rrnewton
rrnewton / results0.1
Created February 24, 2012 15:51
Current performance (latency) of different network-transport backends
This is the average latency as measured by a single trial run of 100K ping/pongs with several different transports.
PingTCP: 7.34s >80%CPU
PingTCPTransport: 19s ~60%CPU
PingPipes: 6.36s >=100%CPU
The machine is a 3.1 ghz Intel Westmere (Dell workstation) running RHEL 6.2.
The PingTCP is a baseline that uses the raw Network.Socket interface rather than the Network.Transport abstraction.