Skip to content

Instantly share code, notes, and snippets.

View yohm's full-sized avatar

Yohsuke Murase yohm

View GitHub Profile
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 / 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;
@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;
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 / 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
@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 / 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 / Region01.x10
Created April 27, 2015 05:22
A sample of Region of x10
import x10.regionarray.Region;
class Region01 {
private static def p( o: Any ) {
Console.OUT.println( o );
}
public static def main( args: Rail[String] ) {
val r1 = Region.make( 1..10 );
@yohm
yohm / Point01.x10
Created April 26, 2015 06:33
A sample of x10 Point class
class Point01 {
static def p( o: Any ) {
Console.OUT.println( o );
}
public static def main( args: Rail[String] ) {
Console.OUT.println("hello");
// construct a 1-d point from Long
@yohm
yohm / GlbGlobalRef.x10
Created February 4, 2015 01:59
GLBで実行した結果をGlobalRefで参照している変数に集めようとしている。しかし複数placeだとデッドロックする
import x10.util.ArrayList;
import x10.glb.ArrayListTaskBag;
import x10.glb.TaskQueue;
import x10.glb.TaskBag;
import x10.glb.GLBParameters;
import x10.glb.GLB;
import x10.util.Team;
import x10.glb.Context;
import x10.glb.ContextI;
import x10.glb.GLBResult;