Skip to content

Instantly share code, notes, and snippets.

View keisukefukuda's full-sized avatar

Keisuke Fukuda keisukefukuda

View GitHub Profile
@keisukefukuda
keisukefukuda / nfslock.py
Created August 29, 2014 17:56
A very simple task management system using proper locking on NFS
import random
import os, os.path, sys
import time
import itertools
class TaskAssigner:
def __init__(self, *arrays, **kwd):
print arrays
self.arrays = arrays
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
fig, ax = plt.subplots()
x = np.logspace(-4, 8, 100, base=2.0)
y1 = x
y2 = x * x
@keisukefukuda
keisukefukuda / project.clj
Created November 14, 2014 20:48
How to use ^:skip-aot to avoid problems when using clojure.tools.namespace.repl/refresh
(defproject myproj "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:main ^:skip-aot myproj.core
:dependencies [[org.clojure/clojure "1.6.0"]])
@keisukefukuda
keisukefukuda / uniq.cpp
Created January 29, 2015 11:50
Compare speeds of "uniq" operation to std::vector
#include <cstdlib>
#include <ctime>
#include <cassert>
#include <sys/time.h>
#include <unistd.h>
#include <set>
#include <vector>
#include <algorithm>
@keisukefukuda
keisukefukuda / template.sh
Last active January 30, 2018 20:33
A general-purpose bash script template file
#!/bin/sh
# Written by Keisuke Fukuda
# Except explicitly stated, all right reserved by Keisuke Fukuda and
# the script is licensed under the MIT license.
# bash options
#set -e
function main {
}
@keisukefukuda
keisukefukuda / mpi-1.c
Created July 12, 2015 11:12
計算機システム MPIサンプル [1]
/*
* 計算機システム MPIサンプル [1]
* MPIを使って起動・終了するだけのプログラム(MPIのインストール/動作の確認)
*/
#include <mpi.h>
int main(int argc, char **argv) {
MPI_Init(&argc, &argv);
@keisukefukuda
keisukefukuda / mpi-2.c
Created July 12, 2015 11:51
計算機システム MPIサンプル [2]
/*
* 計算機システム MPIサンプル [2]
* MPIが起動されているプロセス数と、各プロセスが自分のプロセスIDを表示する
*/
#include <stdio.h>
#include <mpi.h>
int main(int argc, char **argv) {
int rank; /* 自分自身のプロセスID */
@keisukefukuda
keisukefukuda / mpi-3.c
Created July 12, 2015 11:52
計算機システム MPIサンプル [3]
/*
* 計算機システム MPIサンプル [3]
* MPI_Send と MPI_Recv を使ったサンプル
* 各プロセスが、rank 0 へとデータを送る(データ=自分のプロセスIDを二乗した値の整数1個)
*/
#include <stdio.h>
#include <assert.h>
#include <mpi.h>
@keisukefukuda
keisukefukuda / mpi-4.c
Created July 12, 2015 11:54
計算機システム MPIサンプル [4]
/*
* 計算機システム MPIサンプル [4]
* rank 0 のプロセスから、0以外のプロセスへ、配列を送信し、各プロセスは、データの各要素に自分のrankをかけ算し、
* その配列をrank 0へ送り返す
*/
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <mpi.h>
@keisukefukuda
keisukefukuda / mpi-5.c
Created July 12, 2015 11:55
算機システム MPIサンプル [5]
/*
* 計算機システム MPIサンプル [5]
* サンプル[4]の処理は、通信と受信を一発で行うAPIが用意されている
* ここでは MPI_Scatter と MPI_Gather の例を示す。
* 実行結果は、サンプル[4]と全く同じになる.
*/
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>