Skip to content

Instantly share code, notes, and snippets.

View mratsim's full-sized avatar
:shipit:

Mamy Ratsimbazafy mratsim

:shipit:
  • Paris
View GitHub Profile
This file has been truncated, but you can view the full file.
/* Halide.h -- interface for the 'Halide' library.
Copyright (c) 2012-2018 MIT CSAIL, Google Inc., and other contributors
Developed by:
The Halide team
http://halide-lang.org
Permission is hereby granted, free of charge, to any person obtaining a copy of
@mratsim
mratsim / .bashrc
Created January 13, 2019 18:39
Mac bashrc
date
echo
fortune | cowsay -f $(gls /usr/local/Cellar/cowsay/3.04/share/cows/ | gshuf -n1)
echo
if [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
if [ -f $HOME/.git-completion.bash ]; then
@mratsim
mratsim / 0README.md
Created January 9, 2019 15:50 — forked from juancarlospaco/0README.md
Python Versus Nim: Async

Python Versus Nim: Async

  • No performance benchmark.
  • Python ⟿ PEP-8
  • Nim ⟿ NEP1
  • Python ⟿ 3.7
  • Nim ⟿ 0.19
  • No Ofuscation, no Code-Golf.

This is to compare elegant, simple, expressive code.

import
deques, options,
milagro_crypto,
./spec/[datatypes, crypto, digest, helpers, validator], extras,
tables, hashes # For BeaconChainDB stub
type
AttestationCandidate* = object
validator*: int
data*: AttestationData
import algorithm
func cumsum[T](x: openarray[T]): seq[T] =
result = newSeq[T](x.len)
result[0] = x[0]
for i in 1 ..< x.len:
result[i] = x[i] + result[i-1]
func searchsorted[T](a, v: openarray[T], leftSide: static bool = true): seq[T] =
result = newSeqUninitialized[T](v.len)
@mratsim
mratsim / min-char-rnn.py
Created December 9, 2018 20:10 — forked from karpathy/min-char-rnn.py
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
# Laser
# Copyright (c) 2018 Mamy André-Ratsimbazafy
# Distributed under the Apache v2 License (license terms are at http://www.apache.org/licenses/LICENSE-2.0).
# This file may not be copied, modified, or distributed except according to those terms.
import
math
const
bits = 10
# TODO debug multiplication with negative numbers
# Laser
# Copyright (c) 2018 Mamy André-Ratsimbazafy
# Distributed under the Apache v2 License (license terms are at http://www.apache.org/licenses/LICENSE-2.0).
# This file may not be copied, modified, or distributed except according to those terms.
import ../../simd, math
# ############################################################
# Laser
# Copyright (c) 2018 Mamy André-Ratsimbazafy
# Distributed under the Apache v2 License (license terms are at http://www.apache.org/licenses/LICENSE-2.0).
# This file may not be copied, modified, or distributed except according to those terms.
# Generic microkernel for matrix multiplication
import
./laser_gemm_tiling, ./laser_gemm_matrix, ./laser_gemm_utils,
../../../laser/[cpuinfo, compiler_optim_hints],
import macros
type Kernel = object
mr*, nr*: int
epilogue*: NimNode
template impl(c: var int, x, y: int,
mr, nr: static int, epilogue: untyped
): untyped =