-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Layout changes #237
base: main
Are you sure you want to change the base?
Layout changes #237
Changes from all commits
15420f2
df7386f
71a07bb
4803d91
85b9f2a
e38eee8
5026a72
8441a8e
753eed4
06d69d5
5937956
21dda55
5f33802
e0b4495
7d079c8
e541ab4
a7103dc
1c9b980
2d7234c
c34321d
801083c
bc7bca8
16aded2
d42428b
fdea1ec
3280574
95a4499
365a109
be07b89
47b9d3c
9fc8680
60e4a60
5ff5eed
6c85f54
4c5da78
c2d1501
5365ab0
e9a3c19
9f848dc
ec35973
0747fe8
fa7950a
e705da4
3fb658e
2bbd45a
627b354
1307d9c
5f0360e
2d8b49b
d9de77c
9cc1817
b66273b
4f5efe7
9958c73
81cf339
12fbb16
6a8b8f5
4e729e2
6f36fdb
c94f78c
cbc361f
cc4eb76
cecb100
daebd24
2729734
508d2b0
ef5e75e
a164373
d01ccdd
9a5d02e
aa7b456
80f6cbf
663ab3b
fd8880c
fdc9970
3b66084
d465842
a1b4724
7cc0726
3940da9
d59bf09
a6cd95d
25fa6ec
9918357
3da170f
a82d9bb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# Ubuntu 22 | ||
FROM ubuntu:22.04 | ||
ARG DEBIAN_FRONTEND=noninteractive | ||
ENV USERNAME=root | ||
|
||
|
||
# install dependencies | ||
RUN apt-get update && \ | ||
apt-get -y install --no-install-recommends software-properties-common && \ | ||
apt-get -y install --no-install-recommends \ | ||
libgc-dev \ | ||
python3 python3-dev python3-setuptools python-is-python3 python3-pip \ | ||
libgmp-dev \ | ||
build-essential \ | ||
uthash-dev \ | ||
vim \ | ||
wget \ | ||
curl | ||
|
||
RUN wget --no-check-certificate https://mirror.racket-lang.org/installers/7.5/racket-7.5-x86_64-linux.sh | ||
RUN chmod +x racket-7.5-x86_64-linux.sh | ||
RUN ./racket-7.5-x86_64-linux.sh | ||
|
||
|
||
# update path | ||
USER ${USERNAME} | ||
WORKDIR /${USERNAME} | ||
ENV PATH="/${USERNAME}/.local/bin:/${USERNAME}/.cabal/bin:/${USERNAME}/.ghcup/bin:$PATH" | ||
RUN echo "export PATH=${PATH}" >> /${USERNAME}/.profile | ||
|
||
#install ghcup | ||
RUN curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | BOOTSTRAP_HASKELL_NONINTERACTIVE=1 BOOTSTRAP_HASKELL_GHC_VERSION=9.4.6 BOOTSTRAP_HASKELL_CABAL_VERSION=3.8.1.0 BOOTSTRAP_HASKELL_INSTALL_STACK=1 BOOTSTRAP_HASKELL_INSTALL_HLS=1 BOOTSTRAP_HASKELL_ADJUST_BASHRC=P sh | ||
|
||
# update cabal package list | ||
RUN cabal update | ||
|
||
ARG RUST=1.71.0 | ||
|
||
# install rustup, rustc, and cargo | ||
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain=${RUST} | ||
|
||
RUN . "$HOME/.cargo/env" | ||
|
||
ADD . /gibbon | ||
|
||
RUN rm /gibbon/gibbon-rts/build/gibbon_rts.h | ||
|
||
ENV PATH="$PATH:/gibbon/dist-newstyle/build/x86_64-linux/ghc-9.0.1/gibbon-0.3/x/gibbon/build/gibbon" | ||
|
||
#Python dependencies | ||
RUN pip install cplex | ||
RUN pip install docplex | ||
RUN pip install statistics | ||
RUN pip install numpy as np | ||
RUN pip install scipy | ||
RUN pip install re | ||
|
||
|
||
#Install PAPI | ||
RUN wget https://github.com/icl-utk-edu/papi/archive/refs/tags/papi-7-1-0-t.tar.gz | ||
RUN mkdir papi | ||
RUN tar -xvzf papi-7-1-0-t.tar.gz -C papi | ||
RUN cd papi | ||
RUN cd papi-papi-7-1-0-t | ||
RUN cd src | ||
RUN ./configure | ||
RUN make -j10 | ||
RUN make install | ||
|
||
|
||
|
||
|
||
CMD ["bash"] |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,10 +25,12 @@ similar to Typed Racket, and a small subset of Haskell. | |
|
||
## Building Gibbon | ||
|
||
Gibbon is implemented in Haskell, and is set up to be built with | ||
[Cabal](https://cabal.readthedocs.io/en/3.4/). | ||
### Getting Dependencies | ||
|
||
Follow the instructions below to have all dependencies. | ||
Gibbon is implemented in Haskell, and is set up to be built with | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The README changes come from a different PR merged earlier. Just a heads-up. |
||
[Cabal](https://cabal.readthedocs.io/en/latest/), but it has a number of native dependencies. | ||
Follow the instructions below to get all dependencies or enter the Nix shell | ||
with `nix-shell` to get them via [Nix](https://nix.dev/). | ||
|
||
- Ubuntu 22.04: | ||
(Parallelism support temporarily not available with ubuntu 22.04 as Cilk support is not avaiable with newer gcc) | ||
|
@@ -77,24 +79,25 @@ Others require a few extra steps: | |
|
||
2. [uthash](https://github.com/troydhanson/uthash): Clone the [repository](https://github.com/troydhanson/uthash) and copy all the `.h` files in `src` to `/usr/local/include` | ||
|
||
### Actually Building Gibbon | ||
|
||
After you have both Cabal and all the dependencies installed, you can build | ||
Gibbon from source: | ||
|
||
$ git clone https://github.com/iu-parfunc/gibbon | ||
$ cd gibbon && source set_env.sh | ||
$ cd gibbon-compiler && cabal v2-build . -w ghc-9.4.6 | ||
$ cd gibbon-compiler && cabal v2-build | ||
|
||
At this point you can run the Gibbon executable: | ||
|
||
$ cabal v2-exec -w ghc-9.4.6 gibbon -- -h | ||
$ cabal v2-run gibbon -- -h | ||
|
||
If you'd like to run the testsuite, you can do so with: | ||
|
||
$ cd $GIBBONDIR && ./run_all_tests.sh | ||
$ ./run_all_tests.sh | ||
|
||
|
||
## Building a Developement docker container for Gibbon | ||
### Building a Developement docker container for Gibbon | ||
|
||
To build the Dockerfile for dev purposes run the command below from the gibbon directory. | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
import os | ||
import subprocess | ||
import re | ||
import numpy as np | ||
import scipy.stats | ||
import json | ||
|
||
|
||
rootdir="/local/scratch/a/singhav/gibbon/gibbon-compiler/PAPI_BINARIES/" | ||
papi_dir = "/local/scratch/a/singhav/gibbon/gibbon-compiler/PAPI_BINARIES/papi_hl_output/" | ||
|
||
iterations = 9 | ||
|
||
for subdir, dirs, files in os.walk(rootdir): | ||
|
||
# subdirectories where the c++ compilation occurs have dirs == [] | ||
#if dirs == []: | ||
|
||
# Opening JSON file | ||
|
||
papi_tot_ins = 0 | ||
papi_tot_cyc = 0 | ||
papi_l3 = 0 | ||
papi_l2_dcm = 0 | ||
papi_l3_accesses = 0 | ||
for f in files: | ||
if "." not in f: | ||
|
||
#print(subdir) | ||
#print(f) | ||
|
||
cmd2 = ["rm", "-rf", papi_dir] | ||
c1 = subprocess.Popen(cmd2, stdout=subprocess.PIPE, stderr=subprocess.PIPE) | ||
c1.wait() | ||
|
||
|
||
#if "Solver" in f and "Filter" not in f: | ||
# cmd = ["./" + f , "--inf-buffer-size", "10000000000", "--biginf-buffer-size", "1000000000", "--iterate", "9"] | ||
#else: | ||
# cmd = ["./" + f , "--iterate", "9"] | ||
|
||
#c = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) | ||
#c.wait() | ||
cmd = ["./" + f , "--inf-buffer-size", "10000000000", "--iterate", "9"] | ||
|
||
#print(cmd) | ||
#writeFileHandle = open(runtimeFile, "w") | ||
|
||
try: | ||
c = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True) | ||
c.wait() | ||
output, error = c.communicate() | ||
#if error is not None: | ||
# cmd = ["./" + f , "--iterate", "9"] | ||
# c = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True) | ||
# c.wait() | ||
except: | ||
print("ERROR!") | ||
print(e.message) | ||
#cmd = ["./" + f , "--iterate", "9"] | ||
#c = subprocess.Popen(cmd, stdout=writeFileHandle, stderr=subprocess.PIPE, universal_newlines=True) | ||
#c.wait() | ||
|
||
#if error is not None: | ||
# cmd = ["./" + f , "--iterate", "9"] | ||
# c = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True) | ||
# c.wait() | ||
|
||
if not os.path.exists(papi_dir): | ||
cmd = ["./" + f , "--iterate", "9"] | ||
c = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True) | ||
c.wait() | ||
|
||
|
||
file_name = os.listdir(papi_dir)[0] | ||
file_path = os.path.join(papi_dir, file_name) | ||
fl = open(file_path) | ||
|
||
# returns JSON object as | ||
# a dictionary | ||
data = json.load(fl) | ||
|
||
# Iterating through the json | ||
# list | ||
|
||
#for key in data: | ||
# print(key) | ||
# print(data[key]) | ||
# print() | ||
|
||
#print(data['threads']) | ||
|
||
stats = data['threads']['0']['regions'] | ||
#print(stats) | ||
if len(stats) == iterations: | ||
for i in range(0, iterations): | ||
#print(i) | ||
#print(stats[str(i)]) | ||
#print() | ||
|
||
iter_stats = stats[str(i)] | ||
#print(iter_stats['PAPI_TOT_INS']) | ||
#print(iter_stats['PAPI_TOT_CYC']) | ||
#print(iter_stats['PAPI_L2_DCM']) | ||
#print() | ||
|
||
papi_tot_ins += int(iter_stats['PAPI_TOT_INS']) | ||
papi_tot_cyc += int(iter_stats['PAPI_TOT_CYC']) | ||
#papi_l3 += int(iter_stats['PAPI_L3_TCM']) | ||
#papi_l3_accesses += int(iter_stats['PAPI_L3_DCA']) | ||
papi_l2_dcm += int(iter_stats['PAPI_L2_DCM']) | ||
|
||
tot_ins_avg = papi_tot_ins / iterations | ||
papi_tot_cyc = papi_tot_cyc / iterations | ||
#papi_l3_avg = papi_l3 / iterations | ||
#papi_l3_accesses_avg = papi_l3_accesses / iterations | ||
papi_l2_dcm_avg = papi_l2_dcm / iterations | ||
|
||
#print(f + " : " + "ins : {}, cyc : {}, l3 misses : {}, l3 accesses : {}, miss rate : {}".format(tot_ins_avg, papi_tot_cyc, papi_l3_avg, papi_l3_accesses_avg, float(papi_l3_avg/papi_l3_accesses_avg))) | ||
print(f + " : " + "ins : {}, cyc : {}, l2 dcm : {}".format(tot_ins_avg, papi_tot_cyc, papi_l2_dcm_avg)) | ||
|
||
#print(tot_ins_avg) | ||
#print(papi_tot_cyc) | ||
#print(papi_l2_avg) | ||
|
||
papi_tot_ins = 0 | ||
papi_tot_cyc = 0 | ||
papi_l3 = 0 | ||
papi_l3_accesses = 0 | ||
papi_l2_dcm = 0 | ||
|
||
|
||
# Closing file | ||
fl.close() | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
module Bench where | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is it Also, I propose adding more subdirectories inside |
||
|
||
import Basics | ||
import Gibbon.Vector | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you squint, you will notice in this line and many others there is a trailing space. This usually can be handled appropriately by your editor. E.g. VS Code: https://stackoverflow.com/a/53663494/465100 |
||
import Gibbon.PList | ||
|
||
type String = Vector Char | ||
|
||
data PackedBool = B Int | ||
|
||
data DecisionTree = Node PackedBool Inline DecisionTree DecisionTree | Leaf Inline | ||
|
||
|
||
|
||
mkRandomDecisionTree :: Int -> DecisionTree | ||
mkRandomDecisionTree depth = if depth <= 0 then Leaf (Str (getRandomString 10)) | ||
else | ||
let randBool = mod rand 2 | ||
randString = getRandomString 500 | ||
inline = Str randString | ||
leftSubtree = mkRandomDecisionTree (depth-1) | ||
rightSubtree = mkRandomDecisionTree (depth-1) | ||
in Node (B randBool) inline leftSubtree rightSubtree | ||
|
||
|
||
|
||
fromInline :: Inline -> String | ||
fromInline inline = case inline of | ||
Str a -> a | ||
|
||
fromBool :: PackedBool -> Int | ||
fromBool b = case b of | ||
B bb -> bb | ||
|
||
merge_plist :: PList Inline -> PList Inline -> PList Inline | ||
merge_plist lst1 lst2 = case lst1 of | ||
Cons x rst -> Cons x (merge_plist rst lst2) | ||
Nil -> lst2 | ||
|
||
|
||
append_plist :: PList Inline -> Inline -> PList Inline | ||
append_plist lst elem = case lst of | ||
Nil -> (Cons elem) Nil | ||
Cons x rst -> Cons x (append_plist rst elem) | ||
|
||
singleton_plist :: Inline -> PList Inline | ||
singleton_plist elem = (Cons elem) Nil | ||
|
||
|
||
accumulateDecisions :: DecisionTree -> PList Inline | ||
accumulateDecisions tree = case tree of | ||
Node b str left right -> let bb = fromBool b | ||
in if bb == 1 | ||
then | ||
let curr = append_plist Nil str | ||
vecLeft = accumulateDecisions left | ||
temp = merge_plist curr vecLeft | ||
vecRight = accumulateDecisions right | ||
in merge_plist temp vecRight | ||
else | ||
let vecLeft = accumulateDecisions left | ||
vecRight = accumulateDecisions right | ||
in merge_plist vecLeft vecRight | ||
|
||
Leaf str -> (Cons str) Nil | ||
|
||
|
||
gibbon_main = | ||
let tree = mkRandomDecisionTree 20 | ||
vec = iterate (accumulateDecisions tree) | ||
in () | ||
|
||
--- filter | ||
|
||
--- Map | ||
|
||
--- Search | ||
|
||
--- Length |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
9.6.3 is the latest now :-)