Skip to content

Instantly share code, notes, and snippets.

@xilenteyex
xilenteyex / cifar10_train.py
Created March 8, 2018 15:52
Modified the standard cifar10_train.py to create a timeline trace file and reduce the number of max steps
# 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,
@xilenteyex
xilenteyex / cifar10_train.py
Created March 21, 2018 22:47
Modified cifar10_train.py to use timeline to do logging
# 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,
@xilenteyex
xilenteyex / timeline-1.json
Created March 21, 2018 22:53
timeline logfile for cifar10_train.py
This file has been truncated, but you can view the full file.
{
"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,
@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_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 / 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 / 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
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
{
"traceEvents": [
{
"ph": "M",
"args": {
"name": "Allocators"
},
"pid": 0,
"name": "process_name"
},