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
@mkolod
mkolod / cpp11_threads_dining_philosophers.cpp
Created April 20, 2018 05:46
C++11 Dining Philosophers
//-----------------------------------------------------------------------------
// Desc: Dining Philosophers sample.
//
// Demonstrates how to use Monitor object (lock) to protect critical section.
//
// Scenario is such that there are 5 philosophers and 5 tools on each side of a philosopher.
// Each philosopher can only take one tool on the left and one on the right.
// One of the philosophers must wait for a tool to become available because whoever grabs
// a tool will hold it until he eats and puts the tool back on the table.
//
@mkolod
mkolod / profile.py
Created December 13, 2018 00:12 — forked from dojoteef/profile.py
A CUDA memory profiler for pytorch
'''
Memory profiling utilities
'''
import gc
import inspect
import linecache
import os.path
import sys
import time
import threading
@mkolod
mkolod / ARMDebianUbuntu.md
Created June 30, 2019 18:48 — forked from Liryna/ARMDebianUbuntu.md
Emulating ARM on Debian/Ubuntu

You might want to read this to get an introduction to armel vs armhf.

If the below is too much, you can try Ubuntu-ARMv7-Qemu but note it contains non-free blobs.

Running ARM programs under linux (without starting QEMU VM!)

First, cross-compile user programs with GCC-ARM toolchain. Then install qemu-arm-static so that you can run ARM executables directly on linux

@mkolod
mkolod / delete_git_submodule.md
Created September 3, 2019 16:34 — forked from myusuf3/delete_git_submodule.md
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
@mkolod
mkolod / ipc_demo.py
Created April 16, 2020 18:45 — forked from lebedov/ipc_demo.py
Demonstrate how to pass IPC handles to GPU data between processes in Python
#!/usr/bin/env python
"""
Demonstrate how to pass IPC handles to GPU data between processes in Python.
"""
import ctypes
import numpy as np
import multiprocessing as mp
import zmq
#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;