GithubHelp home page GithubHelp logo

sunjin-choi / ocs-mem-prof Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 25.97 MB

Memory Profiling for Fast Reconfigurable OCS System

Python 0.27% Shell 0.15% Go 0.01% Jupyter Notebook 93.19% C 5.40% C++ 0.23% Makefile 0.07% Cuda 0.65% Starlark 0.01% MATLAB 0.02%

ocs-mem-prof's Introduction

ocs-mem-prof

Build instructions

First, install system dependencies (TODO: verify)

sudo apt-get install gcc make flex bison byacc git -y
sudo apt-get install gcc-9 build-essential cmake postgresql postgresql-client -y

Initialize postgresql

sudo -u postgres createuser --superuser $(whoami)

If you want to delete user or created database:

sudo -u postgres -c "dropuser <created_user>" # delete user
sudo -u postgres -c "dropdb <created_db>" # delete db

Initialize environment

git clone https://github.com/sunjin-choi/ocs-mem-prof/tree/master
git submodule update --init --recursive
chmod +x setup_path.sh
source setup_path.sh

Force postgress to only use one worker process (this makes instrumentation simpler)

echo "max_parallel_workers = 1" | sudo tee  -a /etc/postgresql/16/main/postgresql.conf

DynamoRio

cd $OCSMEM_HOME/dynamorio
mkdir build
cd build
cmake ..
make -j
bin64/drrun -t drcachesim  -simulator_type elam -- ls

TPC-DS kit

cd $OCSMEM_HOME/tpcds-kit/tools
make OS=LINUX CC=gcc-9

Create db and load schema

cd $OCSMEM_HOME/tpcds-kit/tools
createdb tpcds
psql tpcds -f tpcds.sql

Change directory into DynamoRio build dir and generate data

source setup_path.sh
cd $OCSMEM_HOME/dynamorio/build
./dsdgen -FORCE -VERBOSE
for i in `ls *.dat`; do
  table=${i/.dat/}
  echo "Loading $table..."
  sed 's/|$//' $i > /tmp/$i
  psql tpcds -q -c "TRUNCATE $table"
  psql tpcds -c "\\copy $table FROM '/tmp/$i' CSV DELIMITER '|'"
done
dsdgen -DISTRIBUTIONS $TPCHOME/tools/tpcds.idx

Generate queries inside DynamoRio build dir

cd $OCSMEM_HOME/dynamorio/build
dsqgen -DIRECTORY $TPCHOME/query_templates -INPUT $TPCHOME/query_templates/templates.lst -VERBOSE Y -QUALIFY Y -SCALE 1 -DIALECT netezza -OUTPUT_DIR . -DISTRIBUTIONS $TPCHOME/tools/tpcds.idx

Wrap psql query into bash: for two reasons, psql is a terminal wrapper which is a perl script and < does not look compatible with dynamorio

cd $OCSMEM_HOME/dynamorio/build
echo "perl /usr/bin/psql tpcds < query_0.sql" >> run_psql_query_0.sh
chmod +x run_psql_query_0.sh
./bin64/drrun -t drcachesim -simulator_type elam -- bash run_psql_query_0.sh 2> data.csv

Data profiling

Mounting Bucket with GCSFuse

install gcsfuse from https://cloud.google.com/storage/docs/gcsfuse-quickstart-mount-bucket

gcsfuse tpcds-trace bucket_data

Run cache simulation

bazel build //ocs_cache_sim:run_cache_sim ./run_cache_sim.sh [path_to_trace.csv] or run the binary directly (optionally writing a results csv with -o) ./bazel-bin/ocs_cache_sim/run_cache_sim tests/fixture/two_pages.csv -n $( wc -l tests/fixture/two_pages.csv | awk '{print $1}') -o results.csv

Run Tests

bazel test //ocs_cache_sim:basic_functionality_test

Update compile_commands.json

bazel run @hedron_compile_commands//:refresh_all

Set up and run mysql benchmark (full scan on an in-memory table)

cd mysql; ./setup_script.sh cd dynamorio/; echo "mysql -u test < '../mysql/bmark.sql'" > bmark_mysql.sh" ./bin64/drrun -t drcachesim -simulator_type elam -- bash bmark_mysql.sh 2> data.csv

Contiguous Access Example

cd tests; g++ contrived_increasing_access.cpp ./bin64/drrun -t drcachesim -simulator_type elam -- ./a.out 2> data.csv It'll print out the base address

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.