A small set of tools
Project description
pywup
A small set of tools.
TODO: Expand this markdown
How to install / update
pip3 install --upgrade pywup --user --no-cache-dir
If you cannot run the wup command after installation, check if the path to the folder .local/bin is in your PATH. If not, add the following to the end of your ~/.bashrc:
export PATH=/home/<YOUR_USERNAME>/.local/bin:$PATH
The library
configure
This is a python library for creating template-based configure scripts.
#!/usr/bin/env python3
from pywup.configure import *
mf = TemplateBuilder()
mf.compiler = find_program_or_abort(["clang++", "g++"], "Compiler", "clang")
mf.python = find_header_or_abort("m/Python.h", "Python header", "python3-dev")
mf.highgui = find_header_or_abort("/highgui.hpp", "Opencv's highgui", "opencv-dev")
mf.imgproc = find_header_or_abort("/imgproc.hpp", "Opencv's imgproc", "opencv-dev")
mf.valgrind_py = find_file_or_abort("python3-devel/valgrind-python.supp", "valgrind suppression file for python3", "python3-dev")
mf.libimgcodecs = find_lib("libopencv_imgcodecs.so", "libopencv_imgcodecs")
mf.libs = "-lopencv_core -lopencv_highgui -lopencv_imgproc -I../../wup/cpp/include"
mf.headers = "-DPYTHON_H=$(PYTHON_H) -DHIGHGUI_H=$(HIGHGUI_H) -DIMGPROC_H=$(IMGPROC_H)"
if mf.libimgcodecs:
mf.libs += " -lopencv_imgcodecs"
mf.build("Makefile", """\
CC={compiler}
HIGHGUI_H={highgui}
PYTHON_H={python}
IMGPROC_H={imgproc}
VALGRIND_PYTHON={valgrind_py}
LIBS = {libs}
HEADERS= {headers}
all:
$(CC) -fPIC -shared wup_wrapper.cpp -o libwup.so -Wall -O3 -std=c++11 $(LIBS) $(HEADERS)
run:
$(CC) main.cpp -o main -Wall -O3 -std=c++11 $(LIBS) $(HEADERS)
./main
debug:
$(CC) main.cpp -o main -Wall -g -std=c++11 $(LIBS) $(HEADERS)
gdb main
valgrind:
$(CC) -fPIC -shared wup_wrapper.cpp -o libwup.so -Wall -O1 -g -std=c++11 $(LIBS) $(HEADERS)
valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes --verbose --suppressions=$(VALGRIND_PYTHON) python3 main3.py --model wisard --dataset mnist 2> valgrind.out
""")
wup
This is a command line utility for running experiments, plotting and executing repetitive tasks.
collect
collect runs a program multiple times and collects outputs.
wup collect \
--p TRAIN_TIME "Info: Time to train was ([-0-9\.e\+]+) μs" \
--p TEST_TIME "Info: Time to test was ([-0-9\.e\+]+) μs" \
--p ACC "Test Acc = ([0-9\.]+)" \
--runs 10 \
--va THREADS 1 17 2 \
--vg JOBS 1 80000 1.6 \
--o wespa.csv \
--c "./wisard -createModel RamWisard -ramBits 28 -decoder classic -ramType prime \
-train mnist ../data/emnist/byclass/emnist-byclass-train \
-test mnist ../data/emnist/byclass/emnist-byclass-test \
-times -numThreads {} -hashSize 18041 -jobsPerThread {} -bleaching Y -pPredict 2"
heatmap
heatmap receives a csv file and generates a heatmap.
wup heatmap \
--data ./wespa.csv \
--y "THREADS" \
--x "JOBS" \
--z "TEST_TIME" \
--tz "data[0,z] / data[i,z]" \
--tx "\"%d\" % int(float(data[i,x]))" \
--ty "\"%d\" % int(float(data[i,y]))" \
--tzz "\"%.2f\" % data[i,j]" \
--title "Speedup (threads / blockSize)" \
--size 10 4 \
--o heatmap_wespa.png
bars
Generates a bar graphic using one or more csv files.
wup bars \
--load ./note.csv \
--line THREADS TEST_TIME "note test" \
--line THREADS TRAIN_TIME "note train" \
\
--load ./out.csv \
--line THREADS TEST_TIME "wespa test" \
--line THREADS TRAIN_TIME "wespa train"\
\
--title "Predict speedups (threads / speedup)" \
--ty "y[0,0] / y[i,j]" \
--ts "y[0,0]*s[i,j] / (y[i,j]**2)" \
--tyy "\"%.2f\" % ty[i,j] if ty[i,j] else ''" \
--tx "int(float(x[i]))" \
--xlabel "Threads" \
--ylabel "Speedup" \
--barwidth 0.9 \
--size 10 4 \
--verbose \
--o bars_parallelPredictSpeedup.png
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pywup-0.0.10.tar.gz.
File metadata
- Download URL: pywup-0.0.10.tar.gz
- Upload date:
- Size: 10.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.20.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.6.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
36ed88e234656830695a4c800dc36776cdb5bcb0cf5a23e0acc2c5cc93f2cb38
|
|
| MD5 |
83749fb9d8b258a71c90e7a2c75b7632
|
|
| BLAKE2b-256 |
a06412e40a00fbb29354bf60ee9c252a92fb165b2f7ca83350dfd18cfe503253
|
File details
Details for the file pywup-0.0.10-py3-none-any.whl.
File metadata
- Download URL: pywup-0.0.10-py3-none-any.whl
- Upload date:
- Size: 12.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.20.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.6.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7771c6776e05a94b9148377605071c8acdef27f217e1bc58b4c67c31a5543561
|
|
| MD5 |
4430fa2153176d11750028719e071ee3
|
|
| BLAKE2b-256 |
49290021d83336f1f553679fbeb5cdaf6d6747035836661a62316c5a8f805c40
|