Skip to content

Instantly share code, notes, and snippets.

View sonots's full-sized avatar
🤗

Naotoshi Seo sonots

🤗
View GitHub Profile
@sonots
sonots / nvvp.md
Last active March 11, 2024 00:53
How to use NVIDIA profiler

Usually, located at /usr/local/cuda/bin

Non-Visual Profiler

$ nvprof python train_mnist.py

I prefer to use --print-gpu-trace.

rb_thread_call_without_gvl を使う

例えば普通に書くと

nvrtcResult status = nvrtcCreateProgram(&_prog, _src, _name, _numHeaders, _headers, _includeNames);

となる C 関数の呼び出しを、GVLを外して呼び出すには、

@sonots
sonots / preprocessor.pyx
Created October 13, 2017 15:54
preprocessor in cython
# A trick to embed preprocessors in cython
cdef extern from *:
cdef void EMIT_IF_PYTHON_VERSION_HEX_LT_37 "#if PY_VERSION_HEX < 0x03070000 //" ()
cdef void EMIT_ELSE "#else //" ()
cdef void EMIT_ENDIF "#endif //" ()
EMIT_IF_PYTHON_VERSION_HEX_LT_37()
EMIT_ELSE()
2019-11-28 08:15:11 +0000 [info]: parsing config file is succeeded path="/etc/google-fluentd/google-fluentd.conf"
2019-11-28 08:15:12 +0000 [info]: Detected GCE platform
2019-11-28 08:15:12 +0000 [info]: Logs viewer address: https://console.cloud.google.com/logs/viewer?project=teak-kit-226806&resource=container/instance_id/7530681816608554840
2019-11-28 08:15:12 +0000 [info]: Detected GCE platform
2019-11-28 08:15:12 +0000 [info]: Logs viewer address: https://console.cloud.google.com/logs/viewer?project=teak-kit-226806&resource=gce_instance/instance_id/7530681816608554840
2019-11-28 08:15:12 +0000 [info]: Detected GCE platform
2019-11-28 08:15:12 +0000 [info]: Logs viewer address: https://console.cloud.google.com/logs/viewer?project=teak-kit-226806&resource=container/instance_id/7530681816608554840
2019-11-28 08:15:13 +0000 [warn]: 'time_format' specified without 'time_key', will be ignored
2019-11-28 08:15:13 +0000 [warn]: 'filters' parameter is deprecated: filters has been renamed as matches
2019-11-28 08:1
@sonots
sonots / cudaMallocBench.cu
Last active January 4, 2023 09:28
Benchmark of cudaMalloc. Allocate 1MB of memory totally with several block sizes
#include <sys/time.h>
#include <cuda_runtime.h>
#include <stdio.h>
inline double seconds()
{
struct timeval tp;
struct timezone tzp;
int i = gettimeofday(&tp, &tzp);
return ((double)tp.tv_sec + (double)tp.tv_usec * 1.e-6);
@sonots
sonots / runs-on: ubuntu-latest.txt
Last active August 26, 2022 09:46
Environment Variables on Github Actions
GOROOT_1_11_X64=/usr/local/go1.11
ANDROID_HOME=/usr/local/lib/android/sdk
JAVA_HOME_11_X64=/usr/lib/jvm/zulu-11-azure-amd64
ImageVersion=20190930.2
LANG=C.UTF-8
INVOCATION_ID=029524e610de4329ac57a8f3e8b21281
JAVA_HOME_12_X64=/usr/lib/jvm/zulu-12-azure-amd64
ANDROID_SDK_ROOT=/usr/local/lib/android/sdk
RUNNER_TOOL_CACHE=/opt/hostedtoolcache
JAVA_HOME=/usr/lib/jvm/zulu-11-azure-amd64
@sonots
sonots / deployment-sample.yaml
Last active February 4, 2022 13:09
fluentd-firehose.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-sweet-api
spec:
template:
metadata:
annotations:
fluentd_firehose_delivery_stream_name: "my-sweet-firehose-stream-name"
@sonots
sonots / out_forward.conf
Last active November 2, 2021 06:14
ログの欠損をできるだけ避ける Fluentd の out_forward 設定サンプル cf. http://blog.livedoor.jp/sonots/archives/44690980.html
<source>
type in_tail
# ...
tag raw.eventlog
</source>
<match raw.**>
type forward
log_level "#{ENV['DEBUG'] ? 'debug' : 'info'}"
@sonots
sonots / fluentd_hacking_guide.md
Last active August 30, 2021 05:57
Fluentd ソースコード完全解説 (v0.10向け)

Fluentd ソースコード完全解説

英題:Fluentd Hacking Guide

目次

30分しかないため斜線部分は今回省く

  • Fluentd の起動シーケンスとプラグインの読み込み
  • Fluentd の設定ファイルのパース
  • Input Plugin から Output Plugin にデータが渡る流れ
@sonots
sonots / gist:9225542
Last active December 30, 2020 14:33
td-agent/make-rpm.sh Found '/root/td-agent/rpmbuild/BUILDROOT/td-agent-1.1.18-0.el6.x86_64' in installed files; aborting

Prepared clean environment using vagrant

$ vagrant box add cenos-6.4 https://github.com/2creatives/vagrant-centos/releases/download/v0.1.0/centos64-x86_64-20131030.box
$ vagrant init centos-6.4
$ vagrant up
$ vagrant ssh

build as below: