Skip to content

Instantly share code, notes, and snippets.

View kayceesrk's full-sized avatar

KC Sivaramakrishnan kayceesrk

View GitHub Profile
@kayceesrk
kayceesrk / pldi18_aec_ldrf.md
Created July 2, 2018 12:31
PLDI 18 AEC LDRF

Artefact Evalution for "Bounding Data Races in Space and Time"

This document contains instructions for the artefact evaluation. The draft paper is available at kcsrk.info/papers/pldi18-memory.pdf.

Access to benchmarking machines

The main evaluation in the paper is the overhead of compiling our proposed memory model to relaxed architectures such as ARM and POWER (Fig 7 on page 10).

(* Reverse-mode algorithmic differentiation using effect handlers.
Adapted from https://twitter.com/tiarkrompf/status/963314799521222656.
See https://openreview.net/forum?id=SJxJtYkPG for more information. *)
module F = struct
type t = { v : float; mutable d : float }
let mk v = {v; d = 0.0}
effect Plus : t * t -> t
@kayceesrk
kayceesrk / gcstress.ml
Created August 26, 2017 16:40
OCaml multicore GC stress test
(* GC stress/performance test.
Uses only core GC features - no finalisers, weak references, etc. *)
type work = F : (int -> 'a) * ('a -> int) -> work
type bintree = Leaf of int | Branch of bintree * bintree
let tree =
let rec mktree = function
| 0 -> Leaf 1
| n -> Branch (mktree (n-1), mktree (n-1)) in
(* Requires: OCaml 4.03.0+ *)
(* Usage: `ocaml eff.ml` *)
(** Identifiers *)
module Ident = struct
type t = string
let id = ref 0
let create base =
/***********************************************************************/
/* */
/* OCaml */
/* */
/* Xavier Leroy and Damien Doligez, INRIA Rocquencourt */
/* */
/* Copyright 2009 Institut National de Recherche en Informatique et */
/* en Automatique. All rights reserved. This file is distributed */
/* under the terms of the GNU Library General Public License, with */
/* the special exception on linking described in file ../../LICENSE. */
module type Handler = sig
type effect = ..
type 'a t
type cont
val return : 'a -> 'a t
val (>>=) : 'a t -> ('a -> 'b t) -> 'b t
val run : unit t -> unit
val handle : 'a t -> (effect -> cont -> unit t) -> unit t
val continue : cont -> unit t
## Docker file for OCaml with GDB support
#
# Build
# -----
# $ mkdir monda-docker
# $ cp <this_file> monda-docker/
# $ docker build --force-rm=true -t monda .
# ..takes a while..
#
# Run
## Docker file for OCaml with GDB support
#
# Build
# -----
# $ mkdir monda-docker
# $ cp <this_file> monda-docker/
# $ docker build --force-rm=true -t monda .
# ..takes a while..
#
# Run
#!/bin/sh
sort -n | awk '
BEGIN {
c = 0;
sum = 0;
}
$1 ~ /^[0-9]*(\.[0-9]*)?$/ {
a[c++] = $1;
sum += $1;
}
module Main where
import Debug.Trace
import Control.Exception.Base
import Control.Monad
import Control.Concurrent
import Control.Concurrent.STM
type MyChan a = (TVar (Maybe a), TVar Bool)
newMyChan :: IO (MyChan a)