Skip to content

Instantly share code, notes, and snippets.

@xilenteyex
xilenteyex / toy_matmul_cdep_fixed.py
Created March 6, 2019 21:39
toy matmul code with placeholders moved out of the control dependency context
import tensorflow as tf
import json
import sys
from tensorflow.python.client import timeline
from protobuf_to_dict import protobuf_to_dict
from google.protobuf.json_format import MessageToJson
from tensorflow.core.protobuf import rewriter_config_pb2
from tensorflow.python.framework import graph_io
import os
@xilenteyex
xilenteyex / toy_matmul_timeline.ctf.json
Created March 6, 2019 21:32
Timeline for toy matmul example with fixed control dependencies and env vars set
{
"traceEvents": [
{
"ph": "M",
"args": {
"name": "Allocators"
},
"pid": 0,
"name": "process_name"
},
@xilenteyex
xilenteyex / feed_dict
Created February 13, 2019 18:33
Toy example for adding control dependencies after graph creation. Note that to run this, you must have 2GPUs
Placeholder_2:0
Placeholder_4:0
Placeholder_6:0
Placeholder_8:0
Placeholder_10:0
Placeholder_12:0
Placeholder_14:0
Placeholder_16:0
Placeholder_3:0
Placeholder_5:0
{
"traceEvents": [
{
"ph": "M",
"args": {
"name": "Allocators"
},
"pid": 0,
"name": "process_name"
},
import tensorflow as tf
import json
import sys
from tensorflow.python.client import timeline
from protobuf_to_dict import protobuf_to_dict
from google.protobuf.json_format import MessageToJson
from tensorflow.core.protobuf import rewriter_config_pb2
from tensorflow.python.framework import graph_io
import os
@xilenteyex
xilenteyex / toy_matmul_graph.py
Created February 8, 2019 21:54
Script to create graph of toy matrix multiplication and add dependencies after creating the graph
import tensorflow as tf
import json
import sys
from tensorflow.python.client import timeline
from protobuf_to_dict import protobuf_to_dict
from google.protobuf.json_format import MessageToJson
from tensorflow.core.protobuf import rewriter_config_pb2
dim = 16384
@xilenteyex
xilenteyex / toy_matmul.py
Created December 27, 2018 00:44
A toy example to check if we can force dependencies between completely unrelated operations
import tensorflow as tf
dim = 32
X1 = tf.random_uniform([dim, dim], 0, 10)
_X1 = tf.placeholder(dtype=tf.float32, shape=[dim, dim])
X2 = tf.random_uniform([dim, dim], 0, 10)
_X2 = tf.placeholder(dtype=tf.float32, shape=[dim, dim])
@xilenteyex
xilenteyex / mnist_step_stats_99.json
Created September 9, 2018 22:23
step stats file for mnist_step_99
{
"devStats": [
{
"device": "/job:localhost/replica:0/task:0/device:CPU:0",
"nodeStats": [
{
"allStartMicros": "1536530947156331",
"opStartRelMicros": "2",
"timelineLabel": "_SOURCE = NoOp()",
"nodeName": "_SOURCE",
@xilenteyex
xilenteyex / mnist_timeline_99.json
Created September 9, 2018 22:22
mnist timeline for step 99
{
"traceEvents": [
{
"ph": "M",
"args": {
"name": "Allocators"
},
"pid": 0,
"name": "process_name"
},
@xilenteyex
xilenteyex / mnist_timeline.py
Created September 9, 2018 22:21
simple script to log timeline for a mint example
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the 'License');
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an 'AS IS' BASIS,