Skip to content

Instantly share code, notes, and snippets.

View yohm's full-sized avatar

Yohsuke Murase yohm

View GitHub Profile
@yohm
yohm / regular_random_graph.py
Last active August 29, 2015 14:25
creating a regular random graph with degree d and size N
import networkx
import sys
G = networkx.Graph()
argvs = sys.argv
if( len(argvs) != 4 ):
print 'Usage: python %s <d> <n> <seed>' % argvs[0]
quit()
d = int( argvs[1] )
n = int( argvs[2] )
@yohm
yohm / replace_by_ps.rb
Created November 9, 2015 08:26
OACISでParameterSetQueryを指定して、配下のRunを一括replaceするスクリプト。
require './config/environment'
psq_id = ARGV[0]
psq = ParameterSetQuery.find(psq_id)
$stderr.puts "Number of found PS: #{psq.parameter_sets.count}"
def replace_runs(run)
run_attr = { submitted_to: run.submitted_to,
mpi_procs: run.mpi_procs,
omp_threads: run.omp_threads,
@yohm
yohm / setup_oacis.sh
Created December 8, 2015 04:43
setting up OACIS on EC2
sudo yum update
echo "[MongoDB]
name=MongoDB Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64
gpgcheck=0
enabled=1" | sudo tee -a /etc/yum.repos.d/mongodb.repo
sudo yum install -y mongodb-org-server mongodb-org-shell mongodb-org-tools 
sudo service mongod start
sudo chkconfig mongod on
var fileref=document.createElement('script')
fileref.setAttribute("type","text/javascript")
fileref.setAttribute("src", "http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML")
document.getElementsByTagName("head")[0].appendChild(fileref)
@yohm
yohm / test_threads_omp.cpp
Created April 13, 2016 07:30
testing coexistence of pthread and OpenMP
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <omp.h>
#define NTHREADS 4
void *myFun(void *x)
{
int tid;
@yohm
yohm / main.cpp
Last active May 25, 2016 08:20
Calculation of Equation (7) in our sampling paper.
#include <iostream>
#define _USE_MATH_DEFINES
#include <cmath>
#include <boost/math/special_functions/beta.hpp>
double Q_k0( double f0, double k0, double k ) {
double c = 1.0 / ( f0 * (k0+1.0) );
double x = f0 / (1.0-f0);
double a = k + 1.0;
import x10.io.Console;
import x10.util.Timer;
class ParallelHelloWorld {
public static def main(args:Rail[String]):void {
val timer = new Timer();
val begin = timer.milliTime();
finish for (p in Place.places()) {
async at (p) {
Console.OUT.println("Hello, I'm " + here);
@yohm
yohm / mnist_tensorflow.py
Created July 3, 2016 14:05
A MNIST tutorial code of TensorFlow.
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("MNIST_data/", one_hot=True)
import tensorflow as tf
x = tf.placeholder(tf.float32, [None, 784])
W = tf.Variable(tf.zeros([784, 10]))
b = tf.Variable(tf.zeros([10]))
y = tf.nn.softmax(tf.matmul(x, W) + b)
y_ = tf.placeholder(tf.float32, [None, 10])
@yohm
yohm / daru_tutorial.ipynb
Created October 4, 2016 11:33
DARU primer
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@yohm
yohm / 1d_RidgeRegression.ipynb
Last active November 4, 2016 07:27
A sample of Ridge regression using scikit-learn.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.