Skip to content

Instantly share code, notes, and snippets.

View vchuravy's full-sized avatar
✈️
Travelling

Valentin Churavy vchuravy

✈️
Travelling
View GitHub Profile
@vchuravy
vchuravy / test_opencl_callbacks.jl
Last active August 29, 2015 14:02
Testing OpenCL callback integration
using OpenCL; const cl = OpenCL
type Event
status :: Symbol
error_code :: Int
Event() = Event(:undefined)
Event(status :: Symbol) = new(status, 0)
end
device = first(cl.devices())

Keybase proof

I hereby claim:

  • I am vchuravy on github.
  • I am vchuravy (https://keybase.io/vchuravy) on keybase.
  • I have a public key whose fingerprint is 85F8 E5A2 466D 8BA8 5699 0E95 F1AE DCA6 54FC 59A3 To claim this, I am signing this object:
{
    "body": {
 "client": {
@vchuravy
vchuravy / speed.jl
Created August 5, 2014 16:39
Julia
x = {[1:100]...}
function f1(X)
T = None
for x in X
T = promote_type(T,typeof(x))
end
return T
end
@vchuravy
vchuravy / test-pair-vs-dict.jl
Created October 14, 2014 12:14
Performance pair vs dict
# Pair
immutable Pair{A,B}
first::A
second::B
end
start(p::Pair) = 1
done(p::Pair, i) = i>2
next(p::Pair, i) = (getfield(p,i), i+1)
function ljconfig(N, per=0.2)
# mesh-grid-like construction
X = (0:N) * ones(1,N)
Y = X'
# write all particles into a single array
x = [X[:]', Y[:]']
x = x + per * rand(size(x))
end
N=50
@vchuravy
vchuravy / hl2_optirun_start.sh
Created September 8, 2012 14:59 — forked from zipizap/hl2_optirun_start.sh
Half Life 2, wine and optirun :)
#!/bin/bash
function msg {
# Description:
# This function echoes-with-colors the arguments passed in
# Usage:
# msg 'whatever you want to print :)'
echo -e '\033[33m\033[44m'$@'\033[0m'
}
@vchuravy
vchuravy / threads.S
Last active September 19, 2016 17:10
PPC llvm 3.9 threads
.text
Filename: threads.jl
ld 2, -8(12)
add 2, 2, 12
mflr 0
std 31, -8(1)
std 0, 16(1)
stdu 1, -1264(1)
mr 31, 1
std 14, 1120(31)
@vchuravy
vchuravy / ls.jl
Last active October 14, 2016 10:48
Pipe ls -l into DataFrame
using DataFrames
using Dates # I am on 0.3
# Note the quoting style and the custom time-style
# sed is used to remove softlinks "dir" -> "../dir"
cmd = `ls -1 -l --quoting-style=c --time-style='+%Y-%m-%d_%H:%M'` |> `sed 's/ -> ".*"$//g'`
df = open(cmd, "r", STDOUT) do io
readtable(io, header=false,
separator=' ',
@vchuravy
vchuravy / debug_qjulia.log
Created June 17, 2014 22:55
Log of INTEL_DEBUG=aub,batch julia qjulia.jl
INTEL_DEBUG=aub,batch julia qjulia.jl
INFO: loaded GLFW 3.0.4 X11 GLX glXGetProcAddress clock_gettime /dev/js shared from /home/wallnuss/.julia/v0.3/GLFW/deps/usr/lib/libglfw
intel_extensions.c:144: Batchbuffer flush with 132b (pkt) + 0b (state) = 132b (0.4%)
0x15208000: 0x7a000003: PIPE_CONTROL
0x15208004: 0x00100002: no write, cs stall, stall at scoreboard,
0x15208008: 0x00000000: destination address
0x1520800c: 0x00000000: immediate dword low
0x15208010: 0x00000000: immediate dword high
0x15208014: 0x7a000003: PIPE_CONTROL
0x15208018: 0x00004000: qword write,
@vchuravy
vchuravy / CMakeLists.txt
Last active March 9, 2018 18:43 — forked from SimonDanisch/gltest.c
OpenCL OpenGL interop test
cmake_minimum_required (VERSION 2.6)
project (ogltest)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR})
find_package(PkgConfig REQUIRED)
pkg_search_module(GLFW REQUIRED glfw3)
find_package(OpenGL REQUIRED)
if(NOT OPENGL_FOUND)