Skip to content

Instantly share code, notes, and snippets.

'''
Crude script to analyze which CPU features are used by a given executable/library.
Created on Jun 2, 2019
@author: SleepProgger
'''
import json
import argparse
import sys
@kmhofmann
kmhofmann / building_tensorflow.md
Last active March 2, 2024 18:37
Building TensorFlow from source

Building TensorFlow from source (TF 2.3.0, Ubuntu 20.04)

Why build from source?

The official instructions on installing TensorFlow are here: https://www.tensorflow.org/install. If you want to install TensorFlow just using pip, you are running a supported Ubuntu LTS distribution, and you're happy to install the respective tested CUDA versions (which often are outdated), by all means go ahead. A good alternative may be to run a Docker image.

I am usually unhappy with installing what in effect are pre-built binaries. These binaries are often not compatible with the Ubuntu version I am running, the CUDA version that I have installed, and so on. Furthermore, they may be slower than binaries optimized for the target architecture, since certain instructions are not being used (e.g. AVX2, FMA).

So installing TensorFlow from source becomes a necessity. The official instructions on building TensorFlow from source are here: ht

@yaroslavvb
yaroslavvb / simple_barrier.py
Created December 16, 2016 06:03
Example of using shared counters to implement Barrier primitive
"""Example of barrier implementation using TensorFlow shared variables.
All workers synchronize on barrier, copy global parameters to local versions
and increment global parameter variable asynchronously. Should see something
like this:
bash> killall python
bash> python simple_barrier.py --num_workers=4
worker 0, local_param 4 global_param 5
worker 2, local_param 4 global_param 7
@Mistobaan
Mistobaan / TENSORFLOW_DEBUG.md
Last active June 29, 2023 06:32
Tensorflow Internals Debugging Techniques

Machine Setup August 2016

Linux Ubuntu 2016.

  • 1080 GTX
  • SDK 8.0
  • CuDNN 5.1

ENABLE Core dumps

ulimit -c unlimited
@CMCDragonkai
CMCDragonkai / memory_layout.md
Last active April 28, 2024 18:50
Linux: Understanding the Memory Layout of Linux Executables

Understanding the Memory Layout of Linux Executables

Required tools for playing around with memory:

  • hexdump
  • objdump
  • readelf
  • xxd
  • gcore
@jtilly
jtilly / install-gcc-4.9.3.sh
Last active April 11, 2024 07:28
Install GCC 4.9.3
#!/bin/bash
# this script installs GCC 4.9.3
# to use it navigate to your home directory and type:
# sh install-gcc-4.9.3.sh
# download and install gcc 4.9.3
wget https://ftp.gnu.org/gnu/gcc/gcc-4.9.3/gcc-4.9.3.tar.gz
tar xzf gcc-4.9.3.tar.gz
cd gcc-4.9.3
@gblmarquez
gblmarquez / .tmux.conf
Created August 6, 2015 14:28
.tmux.conf with fish as default shell
# Default termtype. If the rcfile sets $TERM, that overrides this value.
set -g default-terminal screen-256color
# support logging out and back in
set -g update-environment "SSH_ASKPASS SSH_AUTH_SOCK SSH_AGENT_PID SSH_CONNECTION"
# pbcopy support
set-option -g default-command "reattach-to-user-namespace -l bash"
# vi mode
@pkmishra
pkmishra / middlewares.py
Last active November 8, 2020 05:26
Scrapy middlewares for random agent list and proxy server usage.
import os
import random
from scrapy.conf import settings
class RandomUserAgentMiddleware(object):
def process_request(self, request, spider):
ua = random.choice(settings.get('USER_AGENT_LIST'))
if ua:
request.headers.setdefault('User-Agent', ua)
class ProxyMiddleware(object):
@josegonzalez
josegonzalez / category.rb
Created August 14, 2010 21:41
Category plugin for Jekyll
module Jekyll
class CategoryIndex < Page
def initialize(site, base, dir, category)
@site = site
@base = base
@dir = dir
@name = 'index.html'
self.process(@name)
self.read_yaml(File.join(base, '_layouts'), 'category_index.html')