Skip to content

Instantly share code, notes, and snippets.

View kaityo256's full-sized avatar
🤖
I, Robot

Hiroshi Watanabe kaityo256

🤖
I, Robot
View GitHub Profile
@kaityo256
kaityo256 / cudatest.cu
Created July 2, 2015 09:01
CUDA sample
#include <stdio.h>
#include <cuda.h>
__global__ void
func(void){
printf("%d %d %d\n",blockIdx.x, blockDim.x, threadIdx.x);
}
int
main(void){
@kaityo256
kaityo256 / curand_sample.cu
Last active June 21, 2018 20:14
CUDA sample for curand_kernel
#include <stdio.h>
#include <cuda.h>
#include <curand_kernel.h>
__global__ void
func(void){
int id = blockIdx.x * blockDim.x + threadIdx.x;
curandState s;
curand_init(0,id,0,&s);
for(int i=0;i<4;i++){
#include <iostream>
#include <cuda.h>
#include <algorithm>
#include <curand_kernel.h>
const int N = 10000;
__global__ void
func(double *out){
int id = blockIdx.x * blockDim.x + threadIdx.x;
@kaityo256
kaityo256 / pi_omp.cc
Created July 2, 2015 11:17
MC calculation of Pi (OpenMP)
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <random>
//----------------------------------------------------------------------
const int N = 10000;
const int SAMPLE = 65536;
//----------------------------------------------------------------------
double
#include <stdio.h>
#include <stdlib.h>
//----------------------------------------------------------------------
const int N = 32768;
const double L = 10.0;
const int D = 3;
const int X = 0;
const int Y = 1;
const int Z = 2;
double q[N][D],p[N][D];
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <cuda.h>
//----------------------------------------------------------------------
const int N = 32768;
const double L = 10.0;
const int D = 3;
const int X = 0;
const int Y = 1;
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <cuda.h>
//----------------------------------------------------------------------
const int N = 32768;
const double L = 10.0;
const int D = 3;
const int X = 0;
const int Y = 1;
@kaityo256
kaityo256 / mkpasswd.rb
Created July 14, 2015 05:38
mkpasswd の使う文字種を列挙
h = Hash.new
1000.times{
`mkpasswd`.split(//).each{|s|
h[s] = true
}
}
h.sort.each{|key,value|
print key
}
puts
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
int
main(void) {
const int n = 94;
const char p[8] = {0, 0, 0, 0, 0, 0, 0, 0};
const char *ans = "~~~~!!!!";
@kaityo256
kaityo256 / st.sh
Created August 31, 2015 07:03
Show status of current repository of git/svn
autoload -U colors; colors
function rprompt-git {
local name st color
name=`git symbolic-ref HEAD 2> /dev/null | sed -e "s/refs\/heads\///g" `
if [[ -z $name ]]; then
return
fi
st=`git status 2> /dev/null`
if [[ -n `echo "$st" | grep "^nothing to"` ]]; then