Skip to content

Instantly share code, notes, and snippets.

View shreyash14s's full-sized avatar
🤔
thinking

Shreyash S Sarnayak shreyash14s

🤔
thinking
  • Boulder, CO
  • 22:19 (UTC -06:00)
View GitHub Profile
==9626== Profiling application: ./a.out
==9626== Profiling result:
Time(%) Time Calls Avg Min Max Name
24.78% 3.7241ms 53 70.266us 64.898us 118.66us block_sum(float const *, float*, unsigned long)
19.86% 2.9851ms 17 175.60us 164.23us 265.61us calculatePR_part1(float*, float*, int*, int*, unsigned long, unsigned long, float*, float)
18.42% 2.7685ms 17 162.85us 154.82us 249.29us calculatePR_part3(float*, float*, unsigned long)
11.22% 1.6866ms 17 99.211us 92.164us 151.01us calculatePR_part2(float*, unsigned long, float*, float)
11.06% 1.6623ms 17 97.782us 91.459us 148.36us calculatePR_part4(float*, unsigned long, float)
11.05% 1.6610ms 17 97.703us 92.323us 145.86us calculatePR_part0(float*, float*)
3.12% 469.49us 174 2.6980us 2.0480us 10.593us [CUDA memcpy DtoH]
import numpy as np
from skimage import data,io
import matplotlib.pyplot as plt
def get(im, i, j):
if 0 <= i < im.shape[0] and 0 <= j < im.shape[1]:
return im[i, j]
return 0
def GAP(im, i, j):
# Source: https://www.tensorflow.org/get_started/mnist/pros
# Modified to reduce memory usage by removing a hidden layer.
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
# input
mnist = input_data.read_data_sets("MNIST_data/", one_hot=True)
#helper
def weight_variable(shape):
# Source: https://www.tensorflow.org/get_started/mnist/beginners
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("MNIST_data/", one_hot=True)
x = tf.placeholder(tf.float32, [None, 784])
W = tf.Variable(tf.zeros([784, 10]))
b = tf.Variable(tf.zeros([10]))
import multiprocessing
def square(n, l):
for i in range(n):
l.append(i * i)
n = 10000000
pcount = 4
processes = []
for i in range(pcount):
import threading
def square(n, l):
for i in range(n):
l.append(i * i)
n = 10000000
tcount = 4
threads = []
for i in range(tcount):