Skip to content

Instantly share code, notes, and snippets.

View tanmaykm's full-sized avatar

Tanmay Mohapatra tanmaykm

  • Bangalore, India
View GitHub Profile
@tanmaykm
tanmaykm / setup.sh
Last active August 29, 2015 14:18
PackageEvaluator.jl setup.sh for Hadoop
#!/usr/bin/env bash
#######################################################################
# PackageEvaluator
# https://github.com/IainNZ/PackageEvaluator.jl
# (c) Iain Dunning 2015
# Licensed under the MIT License
#######################################################################
# This script file is the provisioning script run by Vagrant after
# the VM is created. It sets up the environment for running PkgEval,
# then runs it to produce the JSON result files.
@tanmaykm
tanmaykm / safe.jl
Created March 17, 2015 13:49
safe (no overflow) methods
safe_add{T<:Integer}(n1::T, n2::T) = ((n2 > 0) ? (n1 > (typemax(T) - n2)) : (n1 < (typemin(T) - n2))) ? Nullable{T}() : Nullable{T}(n1 + n2)
safe_mul{T<:Integer}(n1::T, n2::T) = ((n2 > 0) ? ((n1 > div(typemax(T),n2)) || (n1 < div(typemin(T),n2))) :
(n2 < -1) ? ((n1 > div(typemin(T),n2)) || (n1 < div(typemax(T),n2))) :
((n2 == -1) && n1 == typemin(T))) ? Nullable{T}() : Nullable{T}(n1 * n2)
#safe_sub{T<:Integer}(n1::T, n2::T) = ((n2 > 0) ? (n1 < (typemin(T) + n2)) : (n1 > (typemax(T) + n2))) ? Nullable{T}() : Nullable{T}(n1 - n2)
#safe_div{T<:Integer}(n1::T, n2::T) = ((n1 == typemin(T)) && (n2 == T(-1))) ? Nullable{T}() : Nullable{T}(div(n1, n2))
#safe_abs{T<:Integer}(n::T) = (n == typemin(T)) ? Nullable{T}() : abs(n)
@tanmaykm
tanmaykm / 10418.txt
Created March 10, 2015 02:11
#10418 perf tests
sparse_getindex_small1 0.367 11.558 0.386 0.175
sparse_getindex_small2 0.548 1.406 0.573 0.044
sparse_getindex_small3 0.516 1.261 0.538 0.045
sparse_getindex_medium1 0.671 1.557 0.726 0.128
sparse_getindex_medium2 0.951 1.926 0.993 0.074
sparse_getindex_medium3 0.895 1.761 0.936 0.062
sparse_getindex_small4 0.095 1.218 0.111 0.058
sparse_getindex_small5 0.591 2.105 0.709 0.209
sparse_getindex_small6 1.733 3.884 1.908 0.258
sparse_getindex_small7 0.211 1.446 0.234 0.072
@tanmaykm
tanmaykm / comp_perf.jl
Created March 10, 2015 01:53
comp perf
t1file = "/tmp/after.txt"
t2file = "/tmp/before.txt"
NS = 5
TP = 2.31
data1 = readdlm(t1file);
data2 = readdlm(t2file);
testnames = data1[1:end,1];
mean1 = data1[1:end,3];
@tanmaykm
tanmaykm / matlab_results.txt
Last active August 29, 2015 14:13
sparse get methods
S = nnz rows per column of the sparse matrix
I = num rows being indexed
J = num cols being indexed
sorted = indexing time with sorted I and J
unsorted = index time with unsorted I and J
S | I | J | sorted | unsorted
1559 | 16384 | 16384 | 3.21e-01 | 2.16e+00
1559 | 16384 | 1638 | 3.29e-02 | 2.27e-01
@tanmaykm
tanmaykm / results.txt
Last active August 29, 2015 14:12
maybeint and maybefloat tests
julia> time_int64(10^8, "23423432423")
maybeint64:
elapsed time: 9.7062274 seconds (0 bytes allocated)
int64:
elapsed time: 12.49588723 seconds (0 bytes allocated)
julia> time_float32(10^8, "23423432423.234234324324")
maybefloat32:
elapsed time: 7.356884435 seconds (0 bytes allocated)
float32:
@tanmaykm
tanmaykm / julia_pkg_loader.txt
Created December 6, 2014 13:07
Julia package installation & loading discussions
https://groups.google.com/forum/#!topic/julia-dev/Z6GsLURuIZE/discussion
https://github.com/JuliaLang/julia/issues/2295
https://github.com/JuliaLang/julia/issues/8015
https://groups.google.com/forum/#!searchin/julia-users/site$20packages/julia-users/4aBT28XF3eo/DTT9oMBnD9oJ
https://github.com/JuliaLang/julia/pull/3344
@tanmaykm
tanmaykm / mkuserimg.jl
Created December 6, 2014 11:56
Precompiling Julia Packages
require("/home/tanmaykm/julia/contrib/build_sysimg.jl")
println("BUILDING SYS")
println("============")
build_sysimg("/home/tanmaykm/userimg/sys", force=true)
println("BUILDING SYS_USER1")
println("============")
build_sysimg("/home/tanmaykm/userimg/sys_user1", "native", "/home/tanmaykm/userimg/userimg1.jl", force=true)
@tanmaykm
tanmaykm / install.sh
Last active August 29, 2015 14:07
texlive 2014
wget http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz
tar -xzvf install-tl-unx.tar.gz
cd install-tl-2014*
./install-tl --profile=../texlive.profile
export PATH=/usr/local/texlive/2014/bin/x86_64-linux:$PATH
export INFOPATH=/usr/local/texlive/2014/texmf-dist/doc/info:$INFOPATH
export MANPATH=/usr/local/texlive/2014/texmf-dist/doc/man:$MANPATH
@tanmaykm
tanmaykm / err.txt
Created September 29, 2014 17:19
Ipopt test failure with coinor-libipopt-dev
julia> Pkg.test("Ipopt")
INFO: Testing Ipopt
[5af43612d9f4:02355] mca: base: component_find: unable to open /usr/lib/openmpi/lib/openmpi/mca_paffinity_hwloc: perhaps a missing symbol, or compiled for a different version of Open MPI? (ignored)
[5af43612d9f4:02355] mca: base: component_find: unable to open /usr/lib/openmpi/lib/openmpi/mca_carto_auto_detect: perhaps a missing symbol, or compiled for a different version of Open MPI? (ignored)
[5af43612d9f4:02355] mca: base: component_find: unable to open /usr/lib/openmpi/lib/openmpi/mca_carto_file: perhaps a missing symbol, or compiled for a different version of Open MPI? (ignored)
[5af43612d9f4:02355] mca: base: component_find: unable to open /usr/lib/openmpi/lib/openmpi/mca_shmem_mmap: perhaps a missing symbol, or compiled for a different version of Open MPI? (ignored)
[5af43612d9f4:02355] mca: base: component_find: unable to open /usr/lib/openmpi/lib/openmpi/mca_shmem_posix: perhaps a missing symbol, or compiled for a different version of Open MPI? (ignored)
[