Skip to content

Instantly share code, notes, and snippets.

View ryanrhymes's full-sized avatar
🎯
Focusing

Liang Wang ryanrhymes

🎯
Focusing
View GitHub Profile
@ryanrhymes
ryanrhymes / exp_opencl.ml
Last active September 23, 2017 11:26
opencl experiment
#require "owl_opencl";;
let prog_s = "
__kernel void hello_kernel(__global const float *a,
__global const float *b,
__global float *result)
{
int gid = get_global_id(0);
result[gid] = a[gid] + b[gid];
}
@ryanrhymes
ryanrhymes / gist.id
Last active August 28, 2017 12:47
Owl's Tutorial at CUFP 2017
c18fdd78b99283a102a721a0fe4f214b
@ryanrhymes
ryanrhymes / test_slice.ml
Last active August 21, 2017 01:22
test new slicing function
let x = Arr.sequential [|2;3;4|];;
Owl_slicing_ext.(get_slice_list_typ [] x);;
Owl_slicing_ext.(get_slice_list_typ [ R[]; R[]; R[]] x);;
Owl_slicing_ext.(get_slice_list_typ [ I 1; R[]; R[]] x);;
Owl_slicing_ext.(get_slice_list_typ [ I 1; I 2; R[]] x);;
Owl_slicing_ext.(get_slice_list_typ [ I 1; I 0; I 3] x);;
Owl_slicing_ext.(get_slice_list_typ [ I 1; I 0; I 2] x);;
Owl_slicing_ext.(get_slice_list_typ [ L [0;1]; I 0; I 2] x);;
Owl_slicing_ext.(get_slice_list_typ [ R [-1;0]; I 0; R []] x);;
Owl_slicing_ext.(get_slice_list_typ [ R [-1;0]; I 0; R [1;2]] x);;
@ryanrhymes
ryanrhymes / gist.id
Last active June 7, 2018 12:29
A Collection of Text Corpora for Owl's Experiment
217ef87bc36845c4e78e398d52bc4c5b
@ryanrhymes
ryanrhymes / #readme.md
Last active May 18, 2018 18:15
CIFAR10 CNN Example

CIFAR10 VGG Example

This example demonstrates how to build a VGG-like convolutional neural network for CIFAR10 dataset.

@ryanrhymes
ryanrhymes / gist.id
Last active February 13, 2018 12:52
Perf_common provides basic functions for Owl's performance test
5ca2fdebb0ccb9ecee6f4331972a9087
@ryanrhymes
ryanrhymes / owl_linalg.ml
Last active June 30, 2017 23:49
owl linalg
let x = Mat.uniform 4 4;;
let x = Mat.symmetric x;;
let v, w = Linalg.D.eig x;;
let w = Dense.Matrix.Z.re w;;
let v = Dense.Matrix.Z.re v;;
let v0 = Mat.col v 0;;
let a = Mat.(x *@ v0);;
let b = Mat.(v0 *$ w.{0,0});;
Mat.(a =~ b);;
This file has been truncated, but you can view the full file.
module CI = Cstubs_internals
external owl_stub_1_LAPACKE_sbdsdc
: int -> char -> char -> int -> _ CI.fatptr -> _ CI.fatptr ->
_ CI.fatptr -> int -> _ CI.fatptr -> int -> _ CI.fatptr -> _ CI.fatptr ->
int = "owl_stub_1_LAPACKE_sbdsdc_byte12" "owl_stub_1_LAPACKE_sbdsdc"
external owl_stub_2_LAPACKE_dbdsdc
: int -> char -> char -> int -> _ CI.fatptr -> _ CI.fatptr ->
_ CI.fatptr -> int -> _ CI.fatptr -> int -> _ CI.fatptr -> _ CI.fatptr ->
function f00()
x = rand(1000, 2000)
t0 = time()
LinAlg.LAPACK.gesvd!('A','A',x)
t1 = time()
@printf "time:\t\t%.8f\n" (t1 -t0)
end
function f00()
@ryanrhymes
ryanrhymes / gist:022151ae7d1b8c94363f509532df7a29
Last active May 2, 2017 23:35
reply to boolean indexing ...
```ocaml
Mat.map (min 5.) x;;
```
```ocaml
let x = Mat.uniform 5 5;;
Mat.filter (( < ) 0.5) x;;
...
```