Skip to content

Instantly share code, notes, and snippets.

(gpuc) 14:34:49 vladf@---:/data/vladf$ python tf_random_speed.py
2017-12-23 14:35:45.782703: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1030] Found device 0 with properties:
name: Tesla P100-PCIE-16GB major: 6 minor: 0 memoryClockRate(GHz): 1.3285
pciBusID: 0000:0d:00.0
totalMemory: 15.89GiB freeMemory: 14.60GiB
2017-12-23 14:35:45.782759: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1120] Creating TensorFlow device (/device:GPU:0) -> (device: 0, name: Tesla P100-PCIE-16GB, pci bus id: 0000:0d:00.0, compute capability: 6.0)
****************************************
feed_dict (randomize jit) 17.10606360435486 sec
loss 4542.5 -> 4.09381
****************************************
(gpuc) 16:32:04 vladf@---:/data/vladf$ python tf_random_speed.py
2017-12-23 16:32:34.773396: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1030] Found device 0 with properties:
name: Tesla P100-PCIE-16GB major: 6 minor: 0 memoryClockRate(GHz): 1.3285
pciBusID: 0000:0d:00.0
totalMemory: 15.89GiB freeMemory: 14.60GiB
2017-12-23 16:32:34.773443: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1120] Creating TensorFlow device (/device:GPU:0) -> (device: 0, name: Tesla P100-PCIE-16GB, pci bus id: 0000:0d:00.0, compute capability: 6.0)
****************************************
feed_dict (randomize jit) 16.786871671676636 sec
loss 4542.5 -> 4.15892
****************************************
@vlad17
vlad17 / tf_random_speed.py
Last active December 23, 2017 22:37
Dataset API for in-gpu-mem datasets <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<,
# vladimir feinberg 23 dec 2017 tf 1.4
# feel free to use under Apache 2.0 License terms
import time
import numpy as np
import tensorflow as tf
# pretend we don't have X, Y available until we're about
# to train the network, so we have to use placeholders. This is the case
# in, e.g., RL.
accept-process-output(#<process ycmd-server> 0 100 t)
ycmd--start-server("|\257}\n\362\301\325OW\333&\370I\263\324")
ycmd-open()
ycmd--request("/event_notification" (("event_name" . "FileReadyToParse") ("file_data" ("/home/vlad/Documents/cal/courses-year1/cs294-112/cal-deeprl-hw4/controllers.py" ("contents" . "import tensorflow as tf\nimport numpy as np\nimport time\nfrom utils import get_ac_dim, get_ob_dim, build_mlp\n\n\nclass Controller:\n def __init__(self):\n pass\n\n def get_action(self, state):\n raise NotImplementedError\n\n def fit(self, data):\n pass\n\n def reset(self, nstates):\n pass\n\nclass RandomController(Controller):\n def __init__(self, env):\n super().__init__()\n self.ac_space = env.action_space\n\n def get_action(self, states):\n nstates = len(states)\n return self._sample_n(nstates)\n\n def _sample_n(self, n):\n return np.random.uniform(\n low=self.ac_space.low,\n high=self
@vlad17
vlad17 / 0_reuse_code.js
Created August 4, 2017 16:02
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@vlad17
vlad17 / ill-toep.nb
Created December 3, 2016 21:23
Mathematica code for generating toeplitz condition numbers
URLDownload[
"http://library.wolfram.com/infocenter/MathSource/6770/\
MatrixManipulation.m?file_id=6180", "/tmp/MatrixManipulation.m"];
Quiet@Needs["LinearAlgebra`MatrixManipulation`",
"/tmp/MatrixManipulation.m"];
ListLinePlot[
Table[LinearAlgebra`MatrixManipulation`MatrixConditionNumber[
RandomReal[
]*ToeplitzMatrix[Reverse@Range[n]^10]], {n, 2 ^Range[9]}],
PlotLabel -> "poly deg 10"]
@vlad17
vlad17 / Average.java
Created December 1, 2016 17:00
Wait-free Universal Construction
public class Average implements Sequential<Double, Integer> {
private long count = 0;
private long sum = 0;
private Average() {}
public static class AverageFactory implements Factory<Average> {
public Average generate() { return new Average(); }
}
public Double apply(Integer x) {
sum += x;
count += 1;
vlad@vlad-T460:~$ python
Python 3.5.2 (default, Sep 10 2016, 08:21:44)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from scipy.fftpack import dct
>>> import numpy as np
>>> for n in range(1, 5):
... print(dct(np.identity(n), norm='ortho'))
...
[[ 1.]]
# Subset of the million-song dataset
# Is a song made before or after 2002, based on its vocal features?
# significantly handicapping gbm here:
# - no cv for stopping
# - forcing 0.5 threshold.
# The above is what spark has to do
library(gbm)
library(ROCR)
@vlad17
vlad17 / gbt.spark
Last active August 9, 2016 22:24
[SPARK-16718] benchmark for million song dataset
// See gbm.R for context
// run with options:
// spark-shell --driver-memory 20G --executor-memory 4G --driver-java-options="-Xss500M" -i gbt.spark
import org.apache.spark.sql.DataFrame
import sys.process._
import java.io._
import org.apache.spark.ml.feature.VectorAssembler
import org.apache.spark.ml.classification.GBTClassifier
import org.apache.spark.ml.evaluation._