Skip to the relevant sections if needed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "caffeclassifier.h" | |
CaffeClassifier::CaffeClassifier(const string& model_file, | |
const string& trained_file, | |
const string& mean_file, | |
const string& label_file, | |
const bool use_GPU, | |
const int batch_size) { | |
if (use_GPU) | |
Caffe::set_mode(Caffe::GPU); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Try to copy "a" value to "c" while simultaneously adding vector of 1's to a. | |
# If the copy is started before the first assign_add, the copied value will be inconsistent. | |
# | |
# Running it on macbook my "c" ends up with a mix of values between 1 and 6 | |
# | |
# | |
# 16.017478 copy 1 (0) starting | |
# 17.006894 write 1 (0) starting | |
# 28.431654 write 1 ending (11.4247 sec) | |
# 29.436692 write 1 (1) starting |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Dependencies: | |
# portpicker (pip install portpicker) | |
# tcmalloc4 (sudo apt-get install google-perftools) | |
# TF 0.12 | |
# | |
# | |
# Benchmarks on Xeon E5-2630 v3 @ 2.40GHz | |
# | |
# export LD_PRELOAD=/usr/lib/libtcmalloc.so.4 | |
# python benchmark_grpc_recv.py --data_mb=128 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# Benchmark transferring data, part of troubleshooting https://github.com/tensorflow/tensorflow/issues/6116 | |
# | |
# Take a independent workers communicating with b parameter shards | |
# Each worker tries to add to variables stored on parameter server as fast as | |
# possible. | |
# | |
# macbook | |
# ps=1: 1.6 GB/s | |
# ps=2: 2.6 GB/s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Example of profiling session.run overhead | |
# for python profiling | |
# python -m cProfile -o session-run-benchmark-feed.prof session-run-benchmark.py feed_dict | |
# python -m cProfile -o session-run-benchmark-variable.prof session-run-benchmark.py variable | |
# pip install snakeviz | |
# snakeviz session-run-benchmark-feed.prof | |
# snakeviz session-run-benchmark.prof | |
# | |
# | |
# Feed_dict: 147 usec, no feed dict, 71 usec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# try running cpu intensive test on two devices | |
import tensorflow as tf | |
import time | |
def matmul_op(): | |
"""Multiply two matrices together""" | |
n = 2000 | |
a = tf.ones((n, n), dtype=tf.float32) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tensorflow as tf | |
from tensorflow.python.client import timeline | |
n = 1024 | |
with tf.device("cpu:0"): | |
a1 = tf.ones((n, n)) | |
a2 = tf.ones((n, n)) | |
with tf.device("cpu:1"): | |
a3 = tf.matmul(a1, a2) | |
with tf.device("cpu:2"): |
##git mergetool
In the middle file (future merged file), you can navigate between conflicts with ]c
and [c
.
Choose which version you want to keep with :diffget //2
or :diffget //3
(the //2
and //3
are unique identifiers for the target/master copy and the merge/branch copy file names).
:diffupdate (to remove leftover spacing issues)
:only (once you’re done reviewing all conflicts, this shows only the middle/merged file)