Skip to content

Instantly share code, notes, and snippets.

View mkolod's full-sized avatar

Marek Kolodziej mkolod

  • San Francisco Bay Area, CA
View GitHub Profile
@sandeepkumar-skb
sandeepkumar-skb / pointwise_multi_thread_multi_stream.cu
Last active October 10, 2020 00:30
Multi-Streaming Experiments
#include <stdio.h>
#include <thread>
#include <chrono>
#include <iostream>
const int N = 1 << 20;
__global__ void kernel(float *x, int n)
{
int tid = threadIdx.x + blockIdx.x * blockDim.x;
" Use Vim settings, rather then Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible
" TODO: this may not be in the correct place. It is intended to allow overriding <Leader>.
" source ~/.vimrc.before if it exists.
if filereadable(expand("~/.vimrc.before"))
source ~/.vimrc.before
endif
@dojoteef
dojoteef / profile.py
Last active June 5, 2023 11:44
A CUDA memory profiler for pytorch
'''
Memory profiling utilities
'''
import gc
import inspect
import linecache
import os.path
import sys
import time
import threading
@KellenSunderland
KellenSunderland / Dockerfile.build.master.jetson
Last active August 19, 2023 16:12
Jetson MXNet build recipe
# -*- mode: dockerfile -*-
# Work in progress, some of the manual steps below will be fixed in a subsequent release.
# Dockerfile to build libmxnet.so, and a python wheel for the Jetson TX1 and TX2
# Builds from Github MXNet master branch
# Once complete copy artifacts from /work/build to target device.
# Install by running 'pip wheel name_of_wheel.whl' and copying the .so to a folder on your LD_LIBRARY_PATH
FROM nvidia/cuda:8.0-cudnn5-devel as cudabuilder
FROM dockcross/linux-arm64
@Badel2
Badel2 / spectre.c
Last active March 12, 2023 00:18
Spectre attack example implementation
/* https://spectreattack.com/spectre.pdf */
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#ifdef _MSC_VER
#include <intrin.h> /* for rdtscp and clflush */
#pragma optimize("gt",on)
#else
#include <x86intrin.h> /* for rdtscp and clflush */
#endif
@malcolmgreaves
malcolmgreaves / return_memory_as_np_array.pyx
Created March 3, 2017 23:58
Take some malloc'd memory, stuff it into a NumPy ndarray so that, when this array is out of scope, the original memory is free'd.
import numpy as np
cimport numpy as np
cdef extern from "numpy/arrayobject.h":
void PyArray_ENABLEFLAGS(np.ndarray arr, int flags)
object PyArray_SimpleNewFromData(int nd, np.npy_intp* dims, int typenum, void* data)
void _import_array()
cdef np.ndarray[np.int32_t, ndim=1, mode='c'] from_pointer_to_ndarray(np.npy_intp n_elements,
np.int32_t* values):
@udibr
udibr / gruln.py
Last active November 7, 2020 02:34
Keras GRU with Layer Normalization
import numpy as np
from keras.layers import GRU, initializations, K
from collections import OrderedDict
class GRULN(GRU):
'''Gated Recurrent Unit with Layer Normalization
Current impelemtation only works with consume_less = 'gpu' which is already
set.
# Arguments
@danijar
danijar / blog_tensorflow_sequence_classification.py
Last active December 24, 2021 03:53
TensorFlow Sequence Classification
# Example for my blog post at:
# https://danijar.com/introduction-to-recurrent-networks-in-tensorflow/
import functools
import sets
import tensorflow as tf
def lazy_property(function):
attribute = '_' + function.__name__
@gkossakowski
gkossakowski / asSeenFrom.md
Last active June 19, 2018 18:27
Understand Scala's core typechecking rules

Scala's "type T in class C as seen from a prefix type S" with examples

Introduction

Recently, I found myself in need to precisely understand Scala's core typechecking rules. I was particulary interested in understanding rules responsible for typechecking signatures of members defined in classes (and all types derived from them). Scala Language Specification (SLS) contains definition of the rules but lacks any examples. The definition of the rules uses mutual recursion and nested switch-like constructs that make it hard to follow. I've written down examples together with explanation how specific set of rules (grouped thematically) is applied. These notes helped me gain confidence that I fully understand Scala's core typechecking algorithm.

As Seen From

Let's quote the Scala spec for As Seen From (ASF) rules numbered for an easier reference:

@Qwlouse
Qwlouse / Prepare_TIMIT.ipynb
Last active October 1, 2022 22:20
This notebook preprocesses the TIMIT dataset using MFCCs in the same way that the paper "LSTM: A Search Space Odyssey" used it.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.