- in DRAMSim2 folder: make libdramsim.so
- in Marss: scons dramsim=/full/path/to/DRAMSim2
DRAMSim2/Makefile: comment -DLOG_OUTPUT for extra logs
* command line call | |
matlabc -nodesktop -nosplash -r "matlabpool 12;benchname = '$bench'; function_name ; quit" | |
* normcdf and precision | |
p = normcdf([256-56 256+56],256, sqrt(128));vpa(p(2)-p(1)) | |
for k=50:56; p = normcdf([256-k 256+k],256, sqrt(128));display(vpa(p(2)-p(1))); end |
* combine pdfs | |
pdfunite *.pdf all.pdf |
* timeout command | |
kill the command after some specified time, to set a hard time limit for the executed command. | |
man timeout to read more. |
ifstream pbinfile(argv[2]); | |
vector<unordered_set<int> > numbers; | |
while(getline(pbinfile, stemp)){ | |
istringstream buffer(stemp); | |
vector<int> line((istream_iterator<int>(buffer)), | |
istream_iterator<int>()); | |
unordered_set<int> s(line.begin(), line.end()); | |
numbers.push_back(s); | |
} |
#!/usr/bin/env python | |
import struct | |
import scipy as sp | |
import numpy as np | |
def binary(num): | |
return ''.join(bin(ord(c)).replace('0b', '').rjust(8, '0') for c in struct.pack('!d', num)) |
inpstream = subprocess.check_output(cmdstr).split('\n') | |
data = sp.genfromtxt(inpstream, dtype=np.uint64) |
# Got an answer from the Scipy user group: | |
# http://stackoverflow.com/questions/8955448/save-load-scipy-sparse-csr-matrix-in-portable-data-format | |
# A csr_matrix has 3 data attributes that matter: .data, .indices, and .indptr. All are simple ndarrays, so numpy.save will work on them. Save the three arrays with numpy.save or numpy.savez, load them back with numpy.load, and then recreate the sparse matrix object with: | |
# new_csr = csr_matrix((data, indices, indptr), shape=(M, N)) | |
# So for example: | |
def save_sparse_csr(filename,array): | |
np.savez(filename,data = array.data ,indices=array.indices, | |
indptr =array.indptr, shape=array.shape ) |
def float64Tobinary(num): | |
return ''.join(bin(ord(c)).replace('0b', '').rjust(8, '0') for c in | |
struct.pack('!d', num)) | |
def convertTo1DIntArray(d, start, end, patternwidth, f): | |
sview = 'S' + str(patternwidth) | |
return f(d[start:end]).view(sview) |
ssh -f -L 24800:127.0.0.1:24800 128.151.160.230 -N |