Skip to content

Instantly share code, notes, and snippets.

View kohnakagawa's full-sized avatar
🌴
On vacation

tsunekoh kohnakagawa

🌴
On vacation
View GitHub Profile
static inline void transpose_4x4(const __m256d& va,
const __m256d& vb,
const __m256d& vc,
const __m256d& vd,
__m256d& vx,
__m256d& vy,
__m256d& vz) {
const auto tmp0 = _mm256_unpacklo_pd(va, vb);
const auto tmp1 = _mm256_unpackhi_pd(va, vb);
const auto tmp2 = _mm256_unpacklo_pd(vc, vd);
@kohnakagawa
kohnakagawa / simd_test.rs
Created February 5, 2018 08:26
stdsimd test of Rust
#![feature(iterator_step_by, cfg_target_feature, target_feature)]
extern crate rand;
use rand::distributions::{IndependentSample, Range};
extern crate stdsimd;
use stdsimd::vendor::*;
use std::time::Instant;
@kohnakagawa
kohnakagawa / cdq_example.c
Created February 3, 2018 13:55
check the behavior of cdq instruction.
#include <stdio.h>
int main() {
int a = -123;
int b = 0, c = 0;
__asm__ volatile("movl %2, %%eax\n\t"
"cdq \n\t"
"movl %%edx, %0\n\t"
"movl %%eax, %1\n\t"
:"=r"(b), "=r"(c)
@kohnakagawa
kohnakagawa / example.asm
Created February 3, 2018 13:09
Darwin nasm example
global start
section .data
message: db 'Hello World', 0xa, 0
numtable: dq '0123456789abcdef'
buffer: db 'abcdefghi'
length: equ $ - buffer
section .text
start:
@kohnakagawa
kohnakagawa / .spacemacs
Last active January 4, 2018 08:44
.spacemacs for Ubuntu 14.04
;; -*- mode: emacs-lisp -*-
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.
(defun dotspacemacs/layers ()
"Configuration Layers declaration.
You should not put any user code in this function besides modifying the variable
values."
(setq-default
;; Base distribution to use. This is a layer contained in the directory
@kohnakagawa
kohnakagawa / .spacemacs
Last active February 18, 2018 03:03
.spacemacs file for Mac OS
;; -*- mode: emacs-lisp -*-
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.
(defun dotspacemacs/layers ()
"Configuration Layers declaration.
You should not put any user code in this function besides modifying the variable
values."
(setq-default
;; Base distribution to use. This is a layer contained in the directory
@kohnakagawa
kohnakagawa / plot_bar_breakdown.R
Created December 23, 2017 08:08
Rで棒グラフをプロットし、さらにbreakdownを示す場合のサンプル。
library(plotly)
library(reshape2)
fname <- "avx2_vs_gpu.dat"
time.breakdown <- read.table(fname, header = TRUE)
time.breakdown <- cbind(nodes = rownames(time.breakdown), time.breakdown)
colnames(time.breakdown) <- c("device", "other", "comm", "pair", "force")
df <- melt(time.breakdown)
@kohnakagawa
kohnakagawa / plot_bar.R
Last active December 12, 2017 04:48
Rで棒グラフをプロットするためのテンプレート
library(ggplot2)
library(reshape2)
out.file <- "test.png" # output file name
dat <- read.table("test.dat") # input data
colnames(dat) <- c("Apple", "Orange", "Grape", "Pear") # column names
df <- melt(dat)
print(df)
000000000040092c <add_v8df(double __vector const&, double __vector const&)>:
40092c: 55 push rbp
40092d: 48 89 e5 mov rbp,rsp
400930: 48 83 ec 60 sub rsp,0x60
400934: 48 89 7d f8 mov QWORD PTR [rbp-0x8],rdi
400938: 48 89 75 a8 mov QWORD PTR [rbp-0x58],rsi
40093c: 48 89 55 b0 mov QWORD PTR [rbp-0x50],rdx
400940: c7 45 a0 08 00 00 00 mov DWORD PTR [rbp-0x60],0x8
400947: c7 45 a4 00 00 00 00 mov DWORD PTR [rbp-0x5c],0x0
40094e: 8b 45 a4 mov eax,DWORD PTR [rbp-0x5c]
@kohnakagawa
kohnakagawa / image_magick_add_notations.bash
Created December 3, 2017 02:56
ImageMatick script to add notations.
#!/bin/bash
convert -font Helvetica -pointsize 60 -gravity south -annotate 0x0-570+525 "(a)" input.jpeg tmp.jpeg
convert -font Helvetica -pointsize 60 -gravity south -annotate 0x0+70+525 "(b)" tmp.jpeg out.jpeg
rm -f tmp.jpeg