Skip to content

Instantly share code, notes, and snippets.

View stephenjbarr's full-sized avatar

Stephen Jeffrey Barr stephenjbarr

View GitHub Profile
{-| print_inst_uuid_list
Given a list of [IndividualParameterization], and an output filename
print a csv file describing each IndividualParameterization, one line
each.
-}
print_inst_uuid_list :: [IndividualParameterization] -> String -> IO ()
print_inst_uuid_list xlist fname =
do
let headerstring = inputst_csv_string ++ ",nstep_s,nstep_w,uuid"
let inst_strings = map (inputst_to_csv_string . _ipp_inst) xlist
sudo yum -y update
cabal update
cabal install either-unwrap
cabal install uuid
cabal install roots
cabal install integration
cabal install syb
git clone https://github.com/simonmar/monad-par.git
cd monad-par
sudo yum -y update
sudo yum -y install make glibc-devel gcc47
sudo yum -y install gcc47-c++
sudo yum -y install htop git
sudo yum -y install zlib-devel
sudo yum -y install freeglut-devel
library(ggplot2)
pts = cartesian_product(c('x','y'))
d1 = cbind(pts, runif(nrow(pts),min=0,max=1), 1)
d2 = cbind(pts, runif(nrow(pts),min=0,max=4), 2)
colnames(d1) = colnames(d2) = c("x","y","val","k")
d = rbind(d1,d2)
p1 <- ggplot(d1, aes(x = x, y = y, fill = val))
@stephenjbarr
stephenjbarr / integrator.hs
Last active December 20, 2015 12:39
Example of doing a ton of numerical integrals in parallel using monad-par and hmatrix/gsl
import Numeric.LinearAlgebra
import Numeric.GSL
import Control.Exception
import System.Environment
import Data.Maybe
import Control.Monad.Par
import Control.DeepSeq
----------------------------------------
@stephenjbarr
stephenjbarr / printoutput.java
Created March 10, 2013 20:37
Updated file for Leon
import java.io.*;
public void updateStats(double dt, String output_file_name)
{
if(TNOW>endTime*warmUp)
{
double totalinsystemdt = serversLevels[1].size()+2*serversLevels[2].size()+3*serversLevels[3].size()+4*serversLevels[4].size()+queueVector.size();
if(TNOW>9950){
public void updateStats(double dt)
{
if(TNOW>endTime*warmUp)
{
double totalinsystemdt = serversLevels[1].size()+2*serversLevels[2].size()+3*serversLevels[3].size()+4*serversLevels[4].size()+queueVector.size();
//if(TNOW>9950){
//System.out.println("-----------------------");
//System.out.println("Time elapsed: " +dt);
//System.out.println("Z1: "+serversLevels[1].size()+" Z2: "+serversLevels[2].size()+" Z3: "+serversLevels[3].size()+" Z4: "+serversLevels[4].size()+" Q: "+queueVector.size()+ " Total: "+totalinsystemdt);
clear all; close all; clc
%% Exercise 3-1A
% find reasonable best-fit polynomial for data1 and data2
data1 = load('data1.txt');
data2 = load('data2.txt');
data3 = load('data3.txt');
@stephenjbarr
stephenjbarr / mpi_something.cpp
Created September 7, 2012 20:06
mpi something
/////////////////////
// THE MPI SECTION //
/////////////////////
MPI::Init();
// Next, use GSL to optimize over this
nll_mpi(start_vector, ua, ub, Xmat, Ymat, TASK_PARAM, false);
VectorXd test_vector = start_vector;
double INCREMENT = 0.1;
double my_result;
@stephenjbarr
stephenjbarr / Makefile
Created August 30, 2012 06:25
A few demonstrations of Rcpp::InternalFunction
## -*- mode: make; tab-width: 8; -*-
##
## Simple Makefile
##
## From RInside examples
## TODO:
## proper configure for non-Debian file locations, [ Done ]
## allow RHOME to be set for non-default R etc
## comment this out if you need a different version of R,