Skip to content

Instantly share code, notes, and snippets.

View sonots's full-sized avatar
🤗

Naotoshi Seo sonots

🤗
View GitHub Profile
dtype = numpy.float32
batch_size = 2
in_channels = 3
out_channels =2
kernel_size = (3, 3, 1)
stride = (1, 1, 1)
pad = (0, 0, 0)
in_dims = (1000, 768, 3)
out_dims = (998, 766, 3)
x_shape = (batch_size, in_channels) + in_dims
@sonots
sonots / bangaihen.md
Last active May 19, 2018 13:02
Rubyプロセスを追いかけるツール(番外編)

[C] perf

perf というのは performance analytics tool for Linux とかいうやつでコレを使うと cpu の何クロック使ったとか、L1 cache ミスヒット率といったような、よりハードウェアレイヤーに近いプロファイリング、Kernel レベルのプロファイリングができる。

CentOS なら yum install perf で入る。

perf top コマンドを使うと、イベントが発生した割合を top コマンド的に逐次的に更新して表示してくれる。

$ sudo perf top -p 23975
@sonots
sonots / test-thread.rb
Last active May 19, 2018 13:01
ruby のスレッドのコンテキストスイッチがおもくて sleep 時間以上の wait タイムが発生する件 (Fluentd で起きる)
# Rerequisites:
# gem install ruby-prof
# 1600 threads
MODE = ARGV.shift || 'PROCESS_TIME'
require 'ruby-prof'
RubyProf.measure_mode = eval("RubyProf::#{MODE}")
RubyProf.start
threads = (1..1600).map {|i|
@sonots
sonots / dotfiles.sh
Created December 8, 2012 11:02
Install .dotfiles
#!/bin/sh
[[ -e ~/.dotfiles ]] || git clone git@github.com:sonots/.dotfiles.git ~/.dotfiles
pushd ~/.dotfiles
git submodule init
git submodule update
for i in `ls -a`
do
[ $i = "." ] && continue
@sonots
sonots / gist:bdce8e970227eeb7bb0d29d0fa03452c
Last active February 5, 2018 16:35
nvvp with thrust::reduce
Is is asynchronous? or synchronous? How can we run asynchronously?
@sonots
sonots / gdb with ruby.md
Last active January 4, 2018 16:26
gdb with ruby

bundle exec gdb とやると環境変数が渡って楽

$ bundle exec gdb ruby
gdb> run test.rb

コマンドラインで ruby への引数も渡したいときは --args オプションが使える。 ちなみに man gdb には出てこないが、gdb --help には出てくるオプション。

@sonots
sonots / slack_integration.md
Last active September 28, 2017 06:16
What happens to slack integration when a member is deactivated?
Integration Auto-Disable? Notify? What we need to do NOTE
email No Amazingly, it is not disabled
github Yes Yes Click enable link on the notification
google calendar don't know
hubot don't know
@sonots
sonots / bm_string_interpolation.rb
Created September 20, 2017 08:38
string interpolation performance 2.4.1 vs trunk (2.5.0dev)
b = 'b'
1_000_000.times { "a#{b}c" }

https://github.com/sonots/embulk-filter-timestamp_format/tree/master/bench

🍣  $ embulk run -I lib bench/config_java.yml
2017-07-10 17:58:32.524 +0900: Embulk v0.8.27
2017-07-10 17:58:33.709 +0900 [INFO] (0001:transaction): Loaded plugin embulk/filter/timestamp_format from a load path
2017-07-10 17:58:33.727 +0900 [INFO] (0001:transaction): Listing local files at directory 'bench' filtering filename by prefix 'dummy'
2017-07-10 17:58:33.729 +0900 [INFO] (0001:transaction): "follow_symlinks" is set false. Note that symbolic links to directories are skipped.
2017-07-10 17:58:33.734 +0900 [INFO] (0001:transaction): Loading files [bench/dummy.csv]
2017-07-10 17:58:33.792 +0900 [INFO] (0001:transaction): Using local thread executor with max_threads=16 / output tasks 8 = input tasks 1 * 8
@sonots
sonots / cudaMallocVScuMemAllocBench.cu
Last active July 9, 2017 11:55
nvcc cudaMallocVScuMemAllocBench.cu -L /usr/local/cuda/lib64 -l cuda
#include <sys/time.h>
#include <cuda.h>
#include <cuda_runtime.h>
#include <stdio.h>
#define CHECK(call) \
{ \
const cudaError_t error = call; \
if (error != cudaSuccess) \
{ \