Skip to content

Instantly share code, notes, and snippets.

Yuta Okamoto okapies

Block or report user

Report or block okapies

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@okapies
okapies / train_mnist_logreport.py
Created Jun 12, 2019
A customized train_mnist example to measure the performance of extension
View train_mnist_logreport.py
#!/usr/bin/env python
import argparse
import chainer
import chainer.functions as F
import chainer.links as L
from chainer import training
from chainer.training import extensions
import numpy as np
@okapies
okapies / np_array_order.py
Last active Mar 20, 2019
How `numpy.array(order='F')` works
View np_array_order.py
>>> np.array([[[0, 4], [2, 6]], [[1, 5], [3, 7]]], dtype='b')
array([[[0, 4],
[2, 6]],
[[1, 5],
[3, 7]]], dtype=int8)
>>> ctypes.string_at(np.array([[[0, 4], [2, 6]], [[1, 5], [3, 7]]], dtype='b').ctypes.data, 8) # .data.tobytes() doesn't work properly
b'\x00\x04\x02\x06\x01\x05\x03\x07'
>>> np.array([[[0, 4], [2, 6]], [[1, 5], [3, 7]]], dtype='b').__array_interface__
{'data': (23426096, False), 'strides': None, 'descr': [('', '|i1')], 'typestr': '|i1', 'shape': (2, 2, 2), 'version': 3}
>>> np.array([[[0, 4], [2, 6]], [[1, 5], [3, 7]]], dtype='b').flags
@okapies
okapies / xp_nested_array-usage.md
Last active Jun 12, 2019
A performance evaluation of creating a (numpy|cupy) array from nested arrays
View xp_nested_array-usage.md
$ python xp_nested_array.py --src-xp numpy --dst-xp numpy --shape "(3, 224, 224)" --batch-size 10
Shape: (3, 224, 224)
Batch size: 10
Running numpy.array(<List[numpy.ndarray]>) in 10000 times...
3.857709832955152
@okapies
okapies / keymap.c
Last active Feb 2, 2019
ErgoDash keymap implementing “correct” dual role RAISE/LOWER keys without `LT` advanced keycode
View keymap.c
#include QMK_KEYBOARD_H
extern keymap_config_t keymap_config;
#define _QWERTY 0
#define _LOWER 1
#define _RAISE 2
#define _ADJUST 16
enum custom_keycodes {
@okapies
okapies / perf_chx_take.py
Last active Feb 12, 2019
Benchmark script for `ndarray.take` in ChainerX
View perf_chx_take.py
import argparse
import timeit
parser = argparse.ArgumentParser()
parser.add_argument('--number', type=int, default=20)
parser.add_argument('--device', type=str, default="native:0")
parser.add_argument('--batch-size', type=int, default=1)
parser.add_argument('--indices', choices=['list', 'numpy', 'chainerx'])
parser.add_argument('--data', default='mnist', help='Path to the directory that contains MNIST dataset')
args = parser.parse_args()
@okapies
okapies / perf_variable.py
Last active Jan 21, 2019
Benchmark script for `Variable` in Chainer
View perf_variable.py
import argparse
import timeit
parser = argparse.ArgumentParser()
parser.add_argument('--number', type=int, default=10000000)
parser.add_argument('--device', type=str, default="native:0")
parser.add_argument('--variables', type=int, default=1)
parser.add_argument('--require-grad', action="store_true", default=False)
parser.add_argument('--batch-size', type=int, default=1)
parser.add_argument('--unsafe', action="store_true", default=False)
@okapies
okapies / perf_extract_apply_in_data.py
Last active Jan 17, 2019
Benchmarking for `_extract_apply_in_data` in Chainer's `function_node`
View perf_extract_apply_in_data.py
import argparse
import timeit
parser = argparse.ArgumentParser()
parser.add_argument('--number', type=int, default=10000000)
parser.add_argument('--device', type=str, default="native:0")
parser.add_argument('--nargs', type=int, default=2)
parser.add_argument('--wrap-variable', action='store_true', default=False)
parser.add_argument('--batch-size', type=int, default=1)
args = parser.parse_args()
@okapies
okapies / chainer_iter_perf.py
Last active Dec 20, 2018
A performance testing for Chainer's `Iterator` on various `ndarray`s
View chainer_iter_perf.py
import sys
import timeit
sys.stdout.write("numpy array: ")
print(
timeit.timeit(
"[iter.next() for i in range(0, 60000, 100)]",
setup="""
import numpy as np
import chainer
View skuber-to-json.scala
import $ivy.`io.skuber::skuber:2.0.5`
import skuber._
import skuber.json.format._
val nginxSelector = Map("app" -> "nginx")
val nginxService = Service("nginx").withSelector(nginxSelector).exposeOnNodePort(30001 -> 80)
import akka.actor.ActorSystem
import akka.stream.ActorMaterializer
View gist:b5880ac5cb507871ad43e6dd13d8b835

ローカル環境で Kubernetes を構築できる Minikube (https://github.com/kubernetes/minikube) を使っていろいろ試してみる。

導入手順

公式の手順にしたがって手元のマシンに minikubekubectl をインストールする。基本的に VirtualBox で動かすので併せてインストールする(Linux の場合は --vm-driver=none を使えば Docker 上で動かせるが起動時にセキュリティ関連の設定をするように警告が出る)。

触ってみる

下記の記事の手順にしたがって操作してみる。minikube start で k8s を起動したあとは kubectl を使う。ダッシュボードを出すには minikube dashboard

https://qiita.com/nirasan/items/6207cf7ef94e04640fbf

You can’t perform that action at this time.