\#/bin/bash

\# On denali, the hpctoolkit is installed at /home/yy8/install/hpctoolkit\-install and hpcviewer at /home/yy8/install/hpcviewer.

\# Add their bin folder to your PATH env: 

\# export PATH=$PATH:/home/yy8/install/hpctoolkit\-install/bin:/home/yy8/install/hpcviewer\\

\# Simple instructions to use HPCToolkit:

\# 1. Running the profile:

\#      hpcrun \-e PAPI_TOT_INS@1000000 \-e PAPI_FP_INS@100000 ./fib \-nproc 1 20 

\# 2. Recovering program structure information (only need to run once)

\#        hpcstruct fib 

\#     This command will produce a file myprogram.hpcstruct that should be passed to hpcprof with the \-S argument.

\# 3. Correlate the profile with the object file

\#        hpcprof \-S fib.hpcstruct \-I .. hpctoolkit\-fib\-measurements/fib\-*.hpcrun

\#   This will create a database directory called "hpctoolkit\-fib\-database"

\# 4. Display the data

\#        hpcviewer hpctoolkit\-fib\-database

\#

\# For details of HPCToolkit, check www.hpctoolkit.org

OUTPUT_DIRNAME=hpctoolkit\-fib\-$1-$2-`uname \-n` 

rm \-rf hpctoolkit\-fib\-measurements ${OUTPUT_DIRNAME}

hpcrun \-e PAPI_TOT_INS@1000000 ./fib \-nproc $1 $2

hpcstruct fib 

hpcprof \-S fib.hpcstruct \-I .. hpctoolkit\-fib\-measurements/fib\-*.hpcrun \-o ${OUTPUT_DIRNAME}

rm \-rf hpctoolkit\-fib\-measurements fib.hpcstruct