Repository: NCIC-PARALLEL/Graphine-SDK
Branch: master
Commit: 89a5a562228d
Files: 40
Total size: 91.9 KB
Directory structure:
gitextract_44_kfi19/
├── .gitignore
├── PAK.Rproj
├── README.md
├── analysis_module/
│ ├── appinfo/
│ │ ├── analysis.sh
│ │ ├── appinfo.R
│ │ └── featureinfo.xml
│ ├── envinfo/
│ │ ├── EnvGather.R
│ │ ├── analysis.sh
│ │ └── featureinfo.xml
│ ├── paktimer/
│ │ ├── Makefile
│ │ ├── analysis.sh
│ │ ├── featureinfo.xml
│ │ ├── paktimer
│ │ └── paktimer.c
│ └── tau/
│ ├── analysis.sh
│ ├── featureinfo.xml
│ ├── featureofPAPI.r
│ └── outputformat.R
├── applications/
│ ├── multiplyexample.c
│ ├── optimized.cpp
│ └── result.xml
├── framework/
│ ├── DBModule/
│ │ └── functions.R
│ ├── EvaluatorModule/
│ │ └── Evaluator.R
│ ├── ExtractorModule/
│ │ ├── Analyze.old
│ │ └── Extractor.R
│ ├── Interface/
│ │ ├── Analyser.R
│ │ └── Generator.R
│ ├── LearnerModule/
│ │ └── Learner.R
│ ├── OptimizerModule/
│ │ └── Optimizer.R
│ ├── ProducerModule/
│ │ ├── .RData
│ │ └── Producer.R
│ ├── Tuning/
│ │ └── Tuner.R
│ ├── dependencies.R
│ └── lib/
│ ├── OptimizationSpace.R
│ ├── learners.R
│ └── producers.R
├── generator_module/
│ └── optimizeCompilerFlag/
│ ├── transform.sh
│ └── variantinfo.xml
├── pak.R
└── tutorial/
└── autotuning_compilerflag.R
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitignore
================================================
*.svn*
.Rproj.user
.Rhistory
================================================
FILE: PAK.Rproj
================================================
Version: 1.0
RestoreWorkspace: Default
SaveWorkspace: Default
AlwaysSaveHistory: Default
EnableCodeIndexing: Yes
UseSpacesForTab: Yes
NumSpacesForTab: 2
Encoding: UTF-8
RnwWeave: Sweave
LaTeX: pdfLaTeX
================================================
FILE: README.md
================================================
# PAK
A performance tuning and knowledge management suit
#Introduction
PAK is a general scientific application autotuning framework which can significantly decrease the work of the programmer
and improve the speed of optimising code.
We believe optimising code must be an enjoyable, creative experience. PAK attempts to take the pain out of programmers by
taking different models used in processes of optimising projects, such as extracter feature model, optimiser model.
PAK is accessible, yet powerful, providing powerful tools needed for large, robust applications.
#PAK models

##Analyser
###functional description of analyser
Analyse the feature of application instance and the index of performance.
###Customizing
First define the configuration file which including featureinfo.xml and analysis.sh.
####featureinfo.xml
#####feature defination
including static/dynamic, feature name, feature description, enable environment variable(when the variable is true meaning
that the relative feature needs to be analysed), data type
feature data type including numerical, category, boolen, combination(supporting nesting)
#####examples
```
<features>
<feature>
<type>static</type>
<name>arrayshape</name>
<description>the shape of array in target program</description>
<enable_variable>Enable_arrayshape</enable_variable>
<datatype>
<datatype>numerical</datatype>
<datatype>numerical</datatype>
<datatype>numerical</datatype>
</datatype>
</feature>
</features>
```
####analysis.sh
- imput: target application, environment variable.
- output: result file, the name of result file
- example of output format:
```
<features>
<feature>
<name>arrayshape</name>
<value>
<value>128</value>
<value>128</value>
<value>256</value>
</value>
</feature>
</features>
```
###Initializing object
`C.Analyser(Name,Path,Features)`
- Name: the name of analysis(the file name of the configuration file)
- Path: the path of configuration file
- Feature: the features during the analysis
##Generator
###functional description of generator
based on the input parameters,optimise and change the application instance.
###Customizing
First define the configuration file which including variantinfo.xml and atransform.sh.
####variantinfo.xml
#####variable parameter defination
including the name of variant parameter, the description of features, enable environment variable(transferring
the parameter of variant), data type(the same with the data type of feature).
#####examples
```
<variants>
<variant>
<name>Unrolling</name>
<description>the unrolling factor</description>
<enable_variable>ENABLE_Unrolling</enable_variable>
<datatype>numerical</datatype>
</variant>
</variants>
```
####transform.sh
- input: the name of target application, the name of output file, environment variable.
- output: the instance of having optimised, the name of output file
###Initializing object
`C.Generator(Name,Path,Parameters)`
- Name: the name of analysis(the file name of the configuration file)
- Path: the path of configuration file
- Feature: the received parameters
##Extractor
###functional description of extractor
instance analyzer, in charge of static analyzing, environment analyzing and input analyzing of instance. Every
extractor analyze the instance in the general through including one or multiple analyser objects. The result of
analyzing could produce the parameters, predict and knoledge mining.
###Customizing
leveraging the input parameters, instantiate the customized objects.
###Initializing object
`C.Extractor$new(analysers)`
- analysers: the table object appointing the extractor of feature.
###example
```
# create a list that contains hpsFrontend-flop_intensity
analyser.hpsFrontend<-list(hpsFrontend=c("flop_intensity"))
#init an extractor object using previous list
myextractor<-C.Extractor$new(list(hpsFrontend=analyser.hpsFrontend))
```
##Producer
###functional description of producer
the base class of producer, defining the interface method of instantiating producer. producer optimise the
process of producing parameters, and by using the result of analyzing instance and the evaluation of last time
implement various complex algorithm including heuristic seaching method, exhaustive searching method and model
predicting method.
###Customizing
customise complex producer by implementing interface method--getParameter.
###base class: `C. Producer()` :
`getParameter(step,extractor.result,score)`:
- step: current interation step
- extractor.result: running instance anf analyzing features
- score: the score of parameter in the last time
###example:
```
# an exhaustion search producer
C.Producer.Exhaustion<-setRefClass(
"C.Producer.Exhaustion",
contains="C.Producer",
fields = list(parameter.space="data.frame"),
methods = list(
#Init function
initialize=function(parameter.space){
parameter.space<<-parameter.space
},
#Implemente the interface method
getParameter=function(step,extractor.result,score)
{
if(step<nrow(parameter.space))
return(parameter.space[step,])
}
)
)
# a greedy search producer
C.Producer.Greedy<-setRefClass(
"C.Producer.Greedy",
contains="C.Producer",
fields = list(parameter.range="list",#list(p1=c(1,2,3..),p2=c(1,2,3..)..)
v.idx ="numeric",
v.score ="numeric",
v.pos ="numeric",
local.optimal= "data.frame"),
methods = list(
#init function
initialize=function(parameter.range=list()){
parameter.range<<-parameter.range
},
#Implemente the interface method
getParameter=function(step,extractor.result,last.score)
{
if(step==1)
{
local.optimal<-default.parameters
v.idx<<-1
v.score<<-c()
v.pos<<-0
}
else if(v.pos<v.length)
{
v.pos<<-v.pos+1
v.score[v.pos]<<-last.score
}else{#finish local optimal search for a parameter
optimal.pos<-which.max(v.score)
local.optimal[[v.idx]]<<-parameter.range[[v.idx]][optimal.pos]
v.idx<<-v.idx+1
if(v.idx>parameter.number)
return (data.frame())
v.score<<-c()
v.pos<<-0
}
new.parameter<-local.optimal
new.parameter[[v.idx]]<-parameter.range[[v.idx]][v.pos+1]
return (new.parameter)
}
)
)
```
##Optimizer
###functional description of optimiser
optimise the instance including code change, generating optimising variant, environment set. Every optimiser only
contain a generator for optimising variant currently.
###Customizing
instantiating customised object by using the input parameter.
###Initializing object
`C.Optimizer(generator.name,output.name)`
- generator.name: optimising variant generator
- output.name: the output of optimising variant, default: "optimized.cpp"
###example
```
#init an optimizer use hpsGen which is a code generator for stencil
myoptimizer<-C.Optimizer$new(generator.name="hpsGen")
```
##Evaluator
###functional description of evaluator
evaluate the running instance during the process of autotuning, including obtaining the performance index,
score index and so on. Every evaluator include one or mutiple analyser objects for evaluating the optimising
variant index. Every evaluating index need to associate one evaluation function. When the index is enough,
return 0, otherwise return a negative number. Absolute number mean the distance to requirement. The evalutor
finally return a tatal score--sum of all evaluation index. When then total score is 0, autotuning is convergent.
###Customizing
instantiating customised object by using the input parameter.
###Initializing object
`C.Evaluator(sub.evaluators)`
- sub.evaluators: include multiple evaluators. the index is the name of evaluator. the value is the table of evaluator
function.
###example
```
# create a sub.evaluaor, which is list of feautres to evluate functions
sub.evaluator.tau<-list(P_WALL_CLOCK_TIME=function(x){if(x>100) return (100-x) else return(0)})
#init a C.Evaluator object
myevaluator<-C.Evaluator$new(sub.evaluators=list(tau=sub.evaluator.tau))
```
##example: implementing a full tuning
```
# create a tuner
mytuner<-C.Tuner$new(app=app,optimizer=myoptimizer,evaluator=myevaluator,producer =myproducer,need.store=TRUE)
# perform tuning
mytuner$tune()
# output best parameters
print(mytuner$best.parameters)
```
================================================
FILE: analysis_module/appinfo/analysis.sh
================================================
#!/bin/bash
source /home/lyl/.bashrc
Rscript $(cd "$(dirname "$0")"; pwd)/appinfo.R $1
================================================
FILE: analysis_module/appinfo/appinfo.R
================================================
library("XML")
bashrc<-"/home/lyl/.bashrc"
analysername<-"appinfo"
appinfo.list<-list()
args<-commandArgs(T)
appname<-args[1]
appinfo.list$MD5<-gsub(" .*","",system(paste0("md5sum ",appname),intern = TRUE))
doc = newXMLDoc()
fsnode<-newXMLNode(name="features",doc=doc)
for(i in 1:length(appinfo.list))
{
fnode<-newXMLNode(name = "feature",parent = fsnode)
addChildren(fnode,
newXMLNode(name="name",names(appinfo.list[i])),
newXMLNode(name="value",appinfo.list[[i]])
)
}
rfilename<-paste0(Sys.time(),analysername,"anaylsisresult.xml")
rfilename<-sub(":","",rfilename)
rfilename<-sub("-","",rfilename)
rfilename<-sub(" ","",rfilename)
output<-saveXML(doc,file=rfilename,prefix = sprintf("<!--this is a file contain the analysis result for %s features--> ",analysername))
cat(output)
================================================
FILE: analysis_module/appinfo/featureinfo.xml
================================================
<!--this is a file contain the analysis result for EnvGather features-->
<features>
<feature>
<name>MD5</name>
<datatype>category</datatype>
<type>static</type>
<description>calculates and verifies 128-bit MD5 hashes, as described in RFC 1321</description>
<avail>TRUE</avail>
<enable_variable>ENABLE_MD5</enable_variable>
</feature>
</features>
================================================
FILE: analysis_module/envinfo/EnvGather.R
================================================
library("XML")
bashrc<-"/home/lyl/.bashrc"
analysername<-"EnvGather"
envlist<-list()
cpuinfo<-system("lscpu",intern = TRUE)
meminfo<-system("cat /proc/meminfo",intern = TRUE)
info<-c(cpuinfo,meminfo)
for(i in info)
{
tmp<-unlist(strsplit(i,": *"))
if(tmp[1]=="Architecture")
envlist[tmp[1]]<-as.character(tmp[2])
if(tmp[1]=="CPUs")
envlist[tmp[1]]<-as.numeric(tmp[2])
if(tmp[1]=="CPU MHz")
envlist[sub(" ","_",tmp[1])]<-as.numeric(tmp[2])
if(tmp[1]=="Threads per core")
envlist[sub(" ","_",tmp[1])]<-as.numeric(tmp[2])
if(tmp[1]=="Cores per socket")
envlist[sub(" ","_",tmp[1])]<-as.numeric(tmp[2])
if(tmp[1]=="Byte Order")
envlist[sub(" ","_",tmp[1])]<-as.character(tmp[2])
if(tmp[1]=="Sockets")
envlist[sub(" ","_",tmp[1])]<-as.numeric(tmp[2])
if(tmp[1]=="NUMA nodes")
envlist[sub(" ","_",tmp[1])]<-as.numeric(tmp[2])
if(tmp[1]=="L1d cache")
envlist["L1d_cache_K"]<-as.numeric(sub("K","",tmp[2]))
if(tmp[1]=="L1i cache")
envlist["L1i_cache_K"]<-as.numeric(sub("K","",tmp[2]))
if(tmp[1]=="L2 cache")
envlist["L2_cache_K"]<-as.numeric(sub("K","",tmp[2]))
if(tmp[1]=="L3 cache")
envlist["L3_cache_K"]<-as.numeric(sub("K","",tmp[2]))
if(tmp[1]=="MemTotal")
envlist["MemTotal_K"]<-as.numeric(sub("kB","",tmp[2]))
}
envlist["OS_version"]<-system("head -n 1 /etc/issue",intern = TRUE)
envlist["gcc_version"]<-system(sprintf("source %s; gcc -dumpversion;",bashrc),intern = TRUE)
envlist["icc_version"]<-system(sprintf("source %s; icc -dumpversion;",bashrc),intern = TRUE)
envlist["nvcc_version"]<-gsub(".*release *|,.*","",system(sprintf("source %s; nvcc --version | grep release",bashrc),intern = TRUE))
doc = newXMLDoc()
fsnode<-newXMLNode(name="features",doc=doc)
for(i in 1:length(envlist))
{
fnode<-newXMLNode(name = "feature",parent = fsnode)
addChildren(fnode,
newXMLNode(name="name",names(envlist[i])),
newXMLNode(name="value",envlist[[i]])
)
}
rfilename<-paste0(Sys.time(),analysername,"anaylsisresult.xml")
rfilename<-sub(":","",rfilename)
rfilename<-sub("-","",rfilename)
rfilename<-sub(" ","",rfilename)
output<-saveXML(doc,file=rfilename,prefix = sprintf("<!--this is a file contain the analysis result for %s features--> ",analysername))
cat(output)
#
# featureinfo_doc = newXMLDoc()
# fsnode<-newXMLNode(name="features",doc=featureinfo_doc)
# for(i in 1:length(envlist))
# {
# fnode<-newXMLNode(name = "feature",parent = fsnode)
# if(is.numeric(envlist[[i]]))
# type<-"numerical"
# else
# type<-"category"
#
# addChildren(fnode,
# newXMLNode(name="name",names(envlist[i])),
# newXMLNode(name="datatype",type),
# newXMLNode(name="type","static"),
# newXMLNode(name="description","As name shows"),
# newXMLNode(name="avail","TRUE"),
# newXMLNode(name="enable_variable",paste0("ENABLE_",names(envlist[i])))
# )
#
#
# }
#
# output<-saveXML(featureinfo_doc,file="featureinfo.xml",prefix = sprintf("<!--this is a file contain the analysis result for %s features--> ",analysername))
================================================
FILE: analysis_module/envinfo/analysis.sh
================================================
#!/bin/bash
source /home/lyl/.bashrc
Rscript $(cd "$(dirname "$0")"; pwd)/EnvGather.R
================================================
FILE: analysis_module/envinfo/featureinfo.xml
================================================
<!--this is a file contain the analysis result for EnvGather features--> <features> <feature> <name>Architecture</name> <datatype>category</datatype> <type>static</type> <description>As name shows</description> <avail>TRUE</avail> <enable_variable>ENABLE_Architecture</enable_variable> </feature> <feature> <name>Byte_Order</name> <datatype>category</datatype> <type>static</type> <description>As name shows</description> <avail>TRUE</avail> <enable_variable>ENABLE_Byte_Order</enable_variable> </feature> <feature> <name>CPU_MHz</name> <datatype>numerical</datatype> <type>static</type> <description>As name shows</description> <avail>TRUE</avail> <enable_variable>ENABLE_CPU_MHz</enable_variable> </feature> <feature> <name>L1d_cache_K</name> <datatype>numerical</datatype> <type>static</type> <description>As name shows</description> <avail>TRUE</avail> <enable_variable>ENABLE_L1d_cache_K</enable_variable> </feature> <feature> <name>L1i_cache_K</name> <datatype>numerical</datatype> <type>static</type> <description>As name shows</description> <avail>TRUE</avail> <enable_variable>ENABLE_L1i_cache_K</enable_variable> </feature> <feature> <name>L2_cache_K</name> <datatype>numerical</datatype> <type>static</type> <description>As name shows</description> <avail>TRUE</avail> <enable_variable>ENABLE_L2_cache_K</enable_variable> </feature> <feature> <name>L3_cache_K</name> <datatype>numerical</datatype> <type>static</type> <description>As name shows</description> <avail>TRUE</avail> <enable_variable>ENABLE_L3_cache_K</enable_variable> </feature> <feature> <name>MemTotal_K</name> <datatype>numerical</datatype> <type>static</type> <description>As name shows</description> <avail>TRUE</avail> <enable_variable>ENABLE_MemTotal_K</enable_variable> </feature> <feature> <name>OS_version</name> <datatype>category</datatype> <type>static</type> <description>As name shows</description> <avail>TRUE</avail> <enable_variable>ENABLE_OS_version</enable_variable> </feature> <feature> <name>gcc_version</name> <datatype>category</datatype> <type>static</type> <description>As name shows</description> <avail>TRUE</avail> <enable_variable>ENABLE_gcc_version</enable_variable> </feature> <feature> <name>icc_version</name> <datatype>category</datatype> <type>static</type> <description>As name shows</description> <avail>TRUE</avail> <enable_variable>ENABLE_icc_version</enable_variable> </feature> <feature> <name>nvcc_version</name> <datatype>category</datatype> <type>static</type> <description>As name shows</description> <avail>TRUE</avail> <enable_variable>ENABLE_nvcc_version</enable_variable> </feature> </features>
================================================
FILE: analysis_module/paktimer/Makefile
================================================
CXX=gcc
INCLUDES=-I.
CXXFLAGS=$(INCLUDES)
default:
$(CXX) paktimer.c -o paktimer
clean::
-rm -f paktimer
================================================
FILE: analysis_module/paktimer/analysis.sh
================================================
#!/bin/bash
#export ENABLE_PAKTIME=TRUE
TIMEENABLE=`env |grep ENABLE_PAKTIME | grep TRUE`
if [ $TIMEENABLE = "ENABLE_PAKTIME=TRUE" ];then
$(cd "$(dirname "$0")"; pwd)/paktimer $1 1>/dev/null 2>/dev/null
time=`cat temp.time`
rm temp.time result.xml
echo "<features>
<feature>
<name>time</name>
<value>"$time"</value>
</feature>
</features>">>result.xml
echo "result.xml"
fi
================================================
FILE: analysis_module/paktimer/featureinfo.xml
================================================
<features>
<feature>
<type>dynamic</type>
<name>time</name>
<description>the execution time of a given application</description>
<enable_variable>ENABLE_PAKTIME</enable_variable>
<datatype>numerical</datatype>
</feature>
</features>
================================================
FILE: analysis_module/paktimer/paktimer.c
================================================
#include <stdio.h>
#include <sys/time.h>
struct timeval t1;
struct timeval t2;
int main(int argc,char** argv)
{
FILE *fp;
double time;
//printf("the target file is %s \n", argv[1]);
gettimeofday(&t1,0);
system(argv[1]);
gettimeofday(&t2,0);
time = ((((1000000.0 * (t2.tv_sec - t1.tv_sec)) + t2.tv_usec) - t1.tv_usec) / 1000000.0);
if(fp=fopen("temp.time","wb"))
fprintf(fp,"%.4f",time);
return 0;
}
================================================
FILE: analysis_module/tau/analysis.sh
================================================
#!/bin/bash
source /home/lyl/.bashrc
export PATH=/home/lyl/tools/tau2.23_icpc_pdt_papi/x86_64/bin:$PATH
export TAU_MAKEFILE=/home/lyl/tools/tau2.23_icpc_pdt_papi/x86_64/lib/Makefile.tau-icpc-papi-pdt
export TAU_THROTTLE=0
i=1
for f in `env |grep ENABLE_ | grep TRUE`
do
FNAME=${f#ENABLE_}
FNAME=${FNAME%%=*}
export COUNTER${i}=$FNAME
let i+=1
done
icpc_flag=$icpc_flag
icpc_flag=$icpc_flag
icpc_flag=$icpc_flag
icpc_flag=$icpc_flag
icpc_flag=$icpc_flag
#CC=icc
CC=tau_cxx.sh
rm MULTI__P* -rf
$CC $icpc_flag -c -vec-report2 $1 -o mid.o 2>/dev/null 1>/dev/null
$CC $icpc_flag mid.o main.cpp -o myexe 2>/dev/null 1>/dev/null
./myexe 2>/dev/null 1>/dev/null
Rscript $(cd "$(dirname "$0")"; pwd)/outputformat.R
rm *.o
rm myexe
================================================
FILE: analysis_module/tau/featureinfo.xml
================================================
<!--this is a file describe feature extracted by XXX-->
<features>
<feature> <name>P_WALL_CLOCK_TIME </name> <description>Time cost of target application</description>
<type>dynamic</type> <avail>TRUE</avail> <enable_variable>ENABLE_P_WALL_CLOCK_TIME </enable_variable> <datatype>numerical</datatype>
</feature>
<feature> <name>PAPI_REF_CYC </name> <description>Reference clock cycles</description>
<type>dynamic</type> <avail>TRUE</avail> <enable_variable>ENABLE_PAPI_REF_CYC </enable_variable> <datatype>numerical</datatype>
</feature>
<feature> <name>PAPI_VEC_DP </name> <description>Double precision vector/SIMD instructions</description>
<type>dynamic</type> <avail>TRUE</avail> <enable_variable>ENABLE_PAPI_VEC_DP </enable_variable> <datatype>numerical</datatype>
</feature>
<feature> <name>PAPI_VEC_SP </name> <description>Single precision vector/SIMD instructions</description> <type>dynamic</type> <avail>TRUE</avail> <enable_variable>ENABLE_PAPI_VEC_SP </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_DP_OPS </name> <description>Floating point operations; optimized to count scaled double precision vector operations</description> <type>dynamic</type> <avail>TRUE</avail> <enable_variable>ENABLE_PAPI_DP_OPS </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_SP_OPS </name> <description>Floating point operations; optimized to count scaled single precision vector operations</description> <type>dynamic</type> <avail>TRUE</avail> <enable_variable>ENABLE_PAPI_SP_OPS </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_FP_OPS </name> <description>Floating point operations</description> <type>dynamic</type> <avail>TRUE</avail> <enable_variable>ENABLE_PAPI_FP_OPS </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_FNV_INS </name> <description>Floating point inverse instructions</description> <type>dynamic</type> <avail>FALSE</avail> <enable_variable>ENABLE_PAPI_FNV_INS </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_FSQ_INS </name> <description>Floating point square root instructions</description> <type>dynamic</type> <avail>FALSE</avail> <enable_variable>ENABLE_PAPI_FSQ_INS </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_FDV_INS </name> <description>Floating point divide instructions</description> <type>dynamic</type> <avail>TRUE</avail> <enable_variable>ENABLE_PAPI_FDV_INS </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_FAD_INS </name> <description>Floating point add instructions</description> <type>dynamic</type> <avail>FALSE</avail> <enable_variable>ENABLE_PAPI_FAD_INS </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_FML_INS </name> <description>Floating point multiply instructions</description> <type>dynamic</type> <avail>FALSE</avail> <enable_variable>ENABLE_PAPI_FML_INS </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_L3_TCW </name> <description>Level 3 total cache writes</description> <type>dynamic</type> <avail>TRUE</avail> <enable_variable>ENABLE_PAPI_L3_TCW </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_L2_TCW </name> <description>Level 2 total cache writes</description> <type>dynamic</type> <avail>TRUE</avail> <enable_variable>ENABLE_PAPI_L2_TCW </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_L1_TCW </name> <description>Level 1 total cache writes</description> <type>dynamic</type> <avail>FALSE</avail> <enable_variable>ENABLE_PAPI_L1_TCW </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_L3_TCR </name> <description>Level 3 total cache reads</description> <type>dynamic</type> <avail>TRUE</avail> <enable_variable>ENABLE_PAPI_L3_TCR </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_L2_TCR </name> <description>Level 2 total cache reads</description> <type>dynamic</type> <avail>TRUE</avail> <enable_variable>ENABLE_PAPI_L2_TCR </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_L1_TCR </name> <description>Level 1 total cache reads</description> <type>dynamic</type> <avail>FALSE</avail> <enable_variable>ENABLE_PAPI_L1_TCR </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_L3_TCA </name> <description>Level 3 total cache accesses</description> <type>dynamic</type> <avail>TRUE</avail> <enable_variable>ENABLE_PAPI_L3_TCA </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_L2_TCA </name> <description>Level 2 total cache accesses</description> <type>dynamic</type> <avail>TRUE</avail> <enable_variable>ENABLE_PAPI_L2_TCA </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_L1_TCA </name> <description>Level 1 total cache accesses</description> <type>dynamic</type> <avail>FALSE</avail> <enable_variable>ENABLE_PAPI_L1_TCA </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_L3_TCH </name> <description>Level 3 total cache hits</description> <type>dynamic</type> <avail>FALSE</avail> <enable_variable>ENABLE_PAPI_L3_TCH </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_L2_TCH </name> <description>Level 2 total cache hits</description> <type>dynamic</type> <avail>FALSE</avail> <enable_variable>ENABLE_PAPI_L2_TCH </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_L1_TCH </name> <description>Level 1 total cache hits</description> <type>dynamic</type> <avail>FALSE</avail> <enable_variable>ENABLE_PAPI_L1_TCH </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_L3_ICW </name> <description>Level 3 instruction cache writes</description> <type>dynamic</type> <avail>FALSE</avail> <enable_variable>ENABLE_PAPI_L3_ICW </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_L2_ICW </name> <description>Level 2 instruction cache writes</description> <type>dynamic</type> <avail>FALSE</avail> <enable_variable>ENABLE_PAPI_L2_ICW </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_L1_ICW </name> <description>Level 1 instruction cache writes</description> <type>dynamic</type> <avail>FALSE</avail> <enable_variable>ENABLE_PAPI_L1_ICW </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_L3_ICR </name> <description>Level 3 instruction cache reads</description> <type>dynamic</type> <avail>TRUE</avail> <enable_variable>ENABLE_PAPI_L3_ICR </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_L2_ICR </name> <description>Level 2 instruction cache reads</description> <type>dynamic</type> <avail>TRUE</avail> <enable_variable>ENABLE_PAPI_L2_ICR </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_L1_ICR </name> <description>Level 1 instruction cache reads</description> <type>dynamic</type> <avail>FALSE</avail> <enable_variable>ENABLE_PAPI_L1_ICR </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_L3_ICA </name> <description>Level 3 instruction cache accesses</description> <type>dynamic</type> <avail>TRUE</avail> <enable_variable>ENABLE_PAPI_L3_ICA </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_L2_ICA </name> <description>Level 2 instruction cache accesses</description> <type>dynamic</type> <avail>TRUE</avail> <enable_variable>ENABLE_PAPI_L2_ICA </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_L1_ICA </name> <description>Level 1 instruction cache accesses</description> <type>dynamic</type> <avail>FALSE</avail> <enable_variable>ENABLE_PAPI_L1_ICA </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_L3_ICH </name> <description>Level 3 instruction cache hits</description> <type>dynamic</type> <avail>FALSE</avail> <enable_variable>ENABLE_PAPI_L3_ICH </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_L2_ICH </name> <description>Level 2 instruction cache hits</description> <type>dynamic</type> <avail>TRUE</avail> <enable_variable>ENABLE_PAPI_L2_ICH </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_L1_ICH </name> <description>Level 1 instruction cache hits</description> <type>dynamic</type> <avail>FALSE</avail> <enable_variable>ENABLE_PAPI_L1_ICH </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_L3_DCW </name> <description>Level 3 data cache writes</description> <type>dynamic</type> <avail>TRUE</avail> <enable_variable>ENABLE_PAPI_L3_DCW </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_L2_DCW </name> <description>Level 2 data cache writes</description> <type>dynamic</type> <avail>TRUE</avail> <enable_variable>ENABLE_PAPI_L2_DCW </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_L1_DCW </name> <description>Level 1 data cache writes</description> <type>dynamic</type> <avail>FALSE</avail> <enable_variable>ENABLE_PAPI_L1_DCW </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_L3_DCR </name> <description>Level 3 data cache reads</description> <type>dynamic</type> <avail>TRUE</avail> <enable_variable>ENABLE_PAPI_L3_DCR </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_L2_DCR </name> <description>Level 2 data cache reads</description> <type>dynamic</type> <avail>TRUE</avail> <enable_variable>ENABLE_PAPI_L2_DCR </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_L1_DCR </name> <description>Level 1 data cache reads</description> <type>dynamic</type> <avail>FALSE</avail> <enable_variable>ENABLE_PAPI_L1_DCR </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_L3_DCA </name> <description>Level 3 data cache accesses</description> <type>dynamic</type> <avail>TRUE</avail> <enable_variable>ENABLE_PAPI_L3_DCA </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_L2_DCA </name> <description>Level 2 data cache accesses</description> <type>dynamic</type> <avail>TRUE</avail> <enable_variable>ENABLE_PAPI_L2_DCA </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_L1_DCA </name> <description>Level 1 data cache accesses</description> <type>dynamic</type> <avail>FALSE</avail> <enable_variable>ENABLE_PAPI_L1_DCA </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_L2_DCH </name> <description>Level 2 data cache hits</description> <type>dynamic</type> <avail>TRUE</avail> <enable_variable>ENABLE_PAPI_L2_DCH </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_L1_DCH </name> <description>Level 1 data cache hits</description> <type>dynamic</type> <avail>FALSE</avail> <enable_variable>ENABLE_PAPI_L1_DCH </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_SYC_INS </name> <description>Synchronization instructions completed</description> <type>dynamic</type> <avail>FALSE</avail> <enable_variable>ENABLE_PAPI_SYC_INS </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_LST_INS </name> <description>Load/store instructions completed</description> <type>dynamic</type> <avail>FALSE</avail> <enable_variable>ENABLE_PAPI_LST_INS </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_TOT_CYC </name> <description>Total cycles</description> <type>dynamic</type> <avail>TRUE</avail> <enable_variable>ENABLE_PAPI_TOT_CYC </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_FP_STAL </name> <description>Cycles the FP unit(s) are stalled</description> <type>dynamic</type> <avail>FALSE</avail> <enable_variable>ENABLE_PAPI_FP_STAL </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_RES_STL </name> <description>Cycles stalled on any resource</description> <type>dynamic</type> <avail>FALSE</avail> <enable_variable>ENABLE_PAPI_RES_STL </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_VEC_INS </name> <description>Vector/SIMD instructions (could include integer)</description> <type>dynamic</type> <avail>FALSE</avail> <enable_variable>ENABLE_PAPI_VEC_INS </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_BR_INS </name> <description>Branch instructions</description> <type>dynamic</type> <avail>TRUE</avail> <enable_variable>ENABLE_PAPI_BR_INS </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_SR_INS </name> <description>Store instructions</description> <type>dynamic</type> <avail>TRUE</avail> <enable_variable>ENABLE_PAPI_SR_INS </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_LD_INS </name> <description>Load instructions</description> <type>dynamic</type> <avail>TRUE</avail> <enable_variable>ENABLE_PAPI_LD_INS </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_FP_INS </name> <description>Floating point instructions</description> <type>dynamic</type> <avail>TRUE</avail> <enable_variable>ENABLE_PAPI_FP_INS </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_INT_INS </name> <description>Integer instructions</description> <type>dynamic</type> <avail>FALSE</avail> <enable_variable>ENABLE_PAPI_INT_INS </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_TOT_INS </name> <description>Instructions completed</description> <type>dynamic</type> <avail>TRUE</avail> <enable_variable>ENABLE_PAPI_TOT_INS </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_TOT_IIS </name> <description>Instructions issued</description> <type>dynamic</type> <avail>FALSE</avail> <enable_variable>ENABLE_PAPI_TOT_IIS </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_FMA_INS </name> <description>FMA instructions completed</description> <type>dynamic</type> <avail>FALSE</avail> <enable_variable>ENABLE_PAPI_FMA_INS </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_BR_PRC </name> <description>Conditional branch instructions correctly predicted</description> <type>dynamic</type> <avail>TRUE</avail> <enable_variable>ENABLE_PAPI_BR_PRC </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_BR_MSP </name> <description>Conditional branch instructions mispredicted</description> <type>dynamic</type> <avail>TRUE</avail> <enable_variable>ENABLE_PAPI_BR_MSP </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_BR_NTK </name> <description>Conditional branch instructions not taken</description> <type>dynamic</type> <avail>TRUE</avail> <enable_variable>ENABLE_PAPI_BR_NTK </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_BR_TKN </name> <description>Conditional branch instructions taken</description> <type>dynamic</type> <avail>TRUE</avail> <enable_variable>ENABLE_PAPI_BR_TKN </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_BR_CN </name> <description>Conditional branch instructions</description> <type>dynamic</type> <avail>TRUE</avail> <enable_variable>ENABLE_PAPI_BR_CN </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_BR_UCN </name> <description>Unconditional branch instructions</description> <type>dynamic</type> <avail>TRUE</avail> <enable_variable>ENABLE_PAPI_BR_UCN </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_HW_INT </name> <description>Hardware interrupts</description> <type>dynamic</type> <avail>FALSE</avail> <enable_variable>ENABLE_PAPI_HW_INT </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_FUL_CCY </name> <description>Cycles with maximum instructions completed</description> <type>dynamic</type> <avail>FALSE</avail> <enable_variable>ENABLE_PAPI_FUL_CCY </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_STL_CCY </name> <description>Cycles with no instructions completed</description> <type>dynamic</type> <avail>FALSE</avail> <enable_variable>ENABLE_PAPI_STL_CCY </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_FUL_ICY </name> <description>Cycles with maximum instruction issue</description> <type>dynamic</type> <avail>FALSE</avail> <enable_variable>ENABLE_PAPI_FUL_ICY </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_STL_ICY </name> <description>Cycles with no instruction issue</description> <type>dynamic</type> <avail>TRUE</avail> <enable_variable>ENABLE_PAPI_STL_ICY </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_MEM_WCY </name> <description>Cycles Stalled Waiting for memory writes</description> <type>dynamic</type> <avail>FALSE</avail> <enable_variable>ENABLE_PAPI_MEM_WCY </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_MEM_RCY </name> <description>Cycles Stalled Waiting for memory Reads</description> <type>dynamic</type> <avail>FALSE</avail> <enable_variable>ENABLE_PAPI_MEM_RCY </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_MEM_SCY </name> <description>Cycles Stalled Waiting for memory accesses</description> <type>dynamic</type> <avail>FALSE</avail> <enable_variable>ENABLE_PAPI_MEM_SCY </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_CSR_TOT </name> <description>Total store conditional instructions</description> <type>dynamic</type> <avail>FALSE</avail> <enable_variable>ENABLE_PAPI_CSR_TOT </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_CSR_SUC </name> <description>Successful store conditional instructions</description> <type>dynamic</type> <avail>FALSE</avail> <enable_variable>ENABLE_PAPI_CSR_SUC </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_CSR_FAL </name> <description>Failed store conditional instructions</description> <type>dynamic</type> <avail>FALSE</avail> <enable_variable>ENABLE_PAPI_CSR_FAL </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_TLB_SD </name> <description>Translation lookaside buffer shootdowns</description> <type>dynamic</type> <avail>FALSE</avail> <enable_variable>ENABLE_PAPI_TLB_SD </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_L3_DCH </name> <description>Level 3 data cache hits</description> <type>dynamic</type> <avail>FALSE</avail> <enable_variable>ENABLE_PAPI_L3_DCH </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_PRF_DM </name> <description>Data prefetch cache misses</description> <type>dynamic</type> <avail>FALSE</avail> <enable_variable>ENABLE_PAPI_PRF_DM </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_BTAC_M </name> <description>Branch target address cache misses</description> <type>dynamic</type> <avail>FALSE</avail> <enable_variable>ENABLE_PAPI_BTAC_M </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_L2_STM </name> <description>Level 2 store misses</description> <type>dynamic</type> <avail>TRUE</avail> <enable_variable>ENABLE_PAPI_L2_STM </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_L2_LDM </name> <description>Level 2 load misses</description> <type>dynamic</type> <avail>FALSE</avail> <enable_variable>ENABLE_PAPI_L2_LDM </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_L1_STM </name> <description>Level 1 store misses</description> <type>dynamic</type> <avail>TRUE</avail> <enable_variable>ENABLE_PAPI_L1_STM </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_L1_LDM </name> <description>Level 1 load misses</description> <type>dynamic</type> <avail>TRUE</avail> <enable_variable>ENABLE_PAPI_L1_LDM </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_TLB_TL </name> <description>Total translation lookaside buffer misses</description> <type>dynamic</type> <avail>FALSE</avail> <enable_variable>ENABLE_PAPI_TLB_TL </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_TLB_IM </name> <description>Instruction translation lookaside buffer misses</description> <type>dynamic</type> <avail>TRUE</avail> <enable_variable>ENABLE_PAPI_TLB_IM </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_TLB_DM </name> <description>Data translation lookaside buffer misses</description> <type>dynamic</type> <avail>TRUE</avail> <enable_variable>ENABLE_PAPI_TLB_DM </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_LSU_IDL </name> <description>Cycles load/store units are idle</description> <type>dynamic</type> <avail>FALSE</avail> <enable_variable>ENABLE_PAPI_LSU_IDL </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_FPU_IDL </name> <description>Cycles floating point units are idle</description> <type>dynamic</type> <avail>FALSE</avail> <enable_variable>ENABLE_PAPI_FPU_IDL </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_FXU_IDL </name> <description>Cycles integer units are idle</description> <type>dynamic</type> <avail>FALSE</avail> <enable_variable>ENABLE_PAPI_FXU_IDL </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_BRU_IDL </name> <description>Cycles branch units are idle</description> <type>dynamic</type> <avail>FALSE</avail> <enable_variable>ENABLE_PAPI_BRU_IDL </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_L3_STM </name> <description>Level 3 store misses</description> <type>dynamic</type> <avail>FALSE</avail> <enable_variable>ENABLE_PAPI_L3_STM </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_L3_LDM </name> <description>Level 3 load misses</description> <type>dynamic</type> <avail>FALSE</avail> <enable_variable>ENABLE_PAPI_L3_LDM </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_CA_ITV </name> <description>Requests for cache line intervention</description> <type>dynamic</type> <avail>FALSE</avail> <enable_variable>ENABLE_PAPI_CA_ITV </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_CA_INV </name> <description>Requests for cache line invalidation</description> <type>dynamic</type> <avail>FALSE</avail> <enable_variable>ENABLE_PAPI_CA_INV </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_CA_CLN </name> <description>Requests for exclusive access to clean cache line</description> <type>dynamic</type> <avail>FALSE</avail> <enable_variable>ENABLE_PAPI_CA_CLN </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_CA_SHR </name> <description>Requests for exclusive access to shared cache line</description> <type>dynamic</type> <avail>FALSE</avail> <enable_variable>ENABLE_PAPI_CA_SHR </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_CA_SNP </name> <description>Requests for a snoop</description> <type>dynamic</type> <avail>FALSE</avail> <enable_variable>ENABLE_PAPI_CA_SNP </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_L3_TCM </name> <description>Level 3 cache misses</description> <type>dynamic</type> <avail>TRUE</avail> <enable_variable>ENABLE_PAPI_L3_TCM </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_L2_TCM </name> <description>Level 2 cache misses</description> <type>dynamic</type> <avail>TRUE</avail> <enable_variable>ENABLE_PAPI_L2_TCM </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_L1_TCM </name> <description>Level 1 cache misses</description> <type>dynamic</type> <avail>TRUE</avail> <enable_variable>ENABLE_PAPI_L1_TCM </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_L3_ICM </name> <description>Level 3 instruction cache misses</description> <type>dynamic</type> <avail>FALSE</avail> <enable_variable>ENABLE_PAPI_L3_ICM </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_L3_DCM </name> <description>Level 3 data cache misses</description> <type>dynamic</type> <avail>FALSE</avail> <enable_variable>ENABLE_PAPI_L3_DCM </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_L2_ICM </name> <description>Level 2 instruction cache misses</description> <type>dynamic</type> <avail>TRUE</avail> <enable_variable>ENABLE_PAPI_L2_ICM </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_L2_DCM </name> <description>Level 2 data cache misses</description> <type>dynamic</type> <avail>TRUE</avail> <enable_variable>ENABLE_PAPI_L2_DCM </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_L1_ICM </name> <description>Level 1 instruction cache misses</description> <type>dynamic</type> <avail>TRUE</avail> <enable_variable>ENABLE_PAPI_L1_ICM </enable_variable> <datatype>numerical</datatype> </feature> <feature> <name>PAPI_L1_DCM </name> <description>Level 1 data cache misses</description> <type>dynamic</type> <avail>TRUE</avail> <enable_variable>ENABLE_PAPI_L1_DCM </enable_variable> <datatype>numerical</datatype> </feature> </features>
================================================
FILE: analysis_module/tau/featureofPAPI.r
================================================
library(XML)
papi_str<-system("source ~/.bashrc; papi_avail",intern=TRUE)
str(papi_str)
bg<-FALSE
for(oneline in papi_str)
{
tmp<-unlist(strsplit(oneline,"[ ][ ][ ]*"))
if(length(tmp)>2 && tmp[2]=="Name")
{
featuredata<<-data.frame(name=character(),avail=logical(),description=character(),enable_variable=character(),stringsAsFactors=FALSE)
bg<-TRUE
}else if(bg){
if(length(tmp)<2)
break;
part1<-unlist(strsplit(oneline,"0x"))
namestr<-part1[1]
part2<-unlist(strsplit(part1[2],"[ ][ ][ ]*"))
Avail<-part2[2]
if(Avail=="Yes")
Avail<- TRUE
else
Avail<-FALSE
featuredata<<-rbind(data.frame(name=namestr,description=part2[4],avail=Avail,enable_variable=sprintf("ENABLE_%s",namestr),stringsAsFactors=FALSE),featuredata)
}
}
featuredata$type<-"dynamic"
featuredata$datatype<-"numerical"
doc = newXMLDoc()
fsnode<-newXMLNode(name="features",doc=doc)
for(i in 1:nrow(featuredata))
{
feature<-featuredata[i,]
fnode<-newXMLNode(name = "feature",parent = fsnode)
addChildren(fnode,
newXMLNode(name="name",feature$name),
newXMLNode(name="description",feature$description),
newXMLNode(name="type",feature$type),
newXMLNode(name="avail",feature$avail),
newXMLNode(name="enable_variable",feature$enable_variable),
newXMLNode(name="datatype",feature$datatype)
)
}
saveXML(doc,file="./featureinfo.xml",prefix = "<!--this is a file describe feature extracted by XXX--> ")
================================================
FILE: analysis_module/tau/outputformat.R
================================================
library("XML")
analysername<-"tau"
metrics.vec<- system("env |grep ENABLE",intern = TRUE)
metrics.list<-list()
for(m in metrics.vec)
{
m.name<-gsub("ENABLE_||=TRUE","",m)
if(length(metrics.vec)>1)
r<-system(paste0("tail MULTI__",m.name,"/profile.0.0.0 |grep main;"),intern = TRUE)
else
r<-system(paste0("tail profile.0.0.0 |grep main;"),intern = TRUE)
r<-unlist(strsplit(r,'"'))[3]
r<-unlist(strsplit(r,' '))[5]
metrics.list[m.name]<-r
}
doc = newXMLDoc()
fsnode<-newXMLNode(name="features",doc=doc)
for(i in 1:length(metrics.list))
{
fnode<-newXMLNode(name = "feature",parent = fsnode)
addChildren(fnode,
newXMLNode(name="name",names(metrics.list[i])),
newXMLNode(name="value",metrics.list[[i]])
)
}
rfilename<-paste0(Sys.time(),analysername,"anaylsisresult.xml")
rfilename<-sub(":","",rfilename)
rfilename<-sub("-","",rfilename)
rfilename<-sub(" ","",rfilename)
output<-saveXML(doc,file=rfilename,prefix = sprintf("<!--this is a file contain the analysis result for %s features--> \n",analysername))
cat(output)
================================================
FILE: applications/multiplyexample.c
================================================
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define DATATYPE float
#define NX 3000
#define NY 3000
#define ITER 30
DATATYPE a[NX][NY];
DATATYPE b[NX][NY];
DATATYPE c[NX][NY];
int main()
{
int i,j,t;
for(i=0;i<NX;i++)
for(j=0;j<NY;j++)
{
a[i][j]=rand();
b[i][j]=rand();
c[i][j]=rand();
}
for(t=0;t<ITER;t++)
for(i=0;i<NX;i++)
for(j=0;j<NY;j++)
c[i][j]=a[i][j]*b[i][j]/c[j][i];
//printf("result is %.2f\n",c[100][100]);
return 0;
}
================================================
FILE: applications/result.xml
================================================
<features>
<feature>
<name>time</name>
<value>1.7945</value>
</feature>
</features>
================================================
FILE: framework/DBModule/functions.R
================================================
OpenDB <- function() {
# Open a SQL conn if the global.conn has not been initialized,
# and save the conn to global.conn, or just return global.conn
#
# Returns:
# The conn opened or geted from the global
if(!exists("global.conn"))
global.conn <<- odbcConnect(datasource,database.user,database.pwd)
conn <- global.conn
return(conn)
}
CloseDB <- function() {
# Close the connection
#
# Args:
# conn: The conn opened by performanceDB.SQL.dbopen
if(exists("global.conn")) {
close(global.conn)
rm(global.conn)
}
}
CheckTableExistence<-function(dbname,tbname){
# check if a table 'tbname' exist in database 'dbname'
# is specificed by format
#
# Returns:
# TRUE if exist, or FALSE if not exist
cmd.str <- sprintf('show tables in %s like "%s";',
dbname, tbname)
conn <- OpenDB()
result <- sqlQuery(conn,cmd.str)
if(!is.data.frame(result))
stop(paste0("error when execute sql command in CreateTable: ",result))
if(nrow(result)==0)
return (FALSE)
else
return (TRUE)
}
CreateTable<-function(format,dbname,tbname){
# create a table 'dbname' in datable 'dbname'. The structure of table
# is specificed by dataframe 'format'
#
# Returns:
# TRUE if success, or FALSE if fail
cmd.str <- sprintf('show tables in %s like "%s";',
dbname, tbname)
conn <- OpenDB()
result <- sqlQuery(conn,cmd.str)
if(!is.data.frame(result))
stop(paste0("error when execute sql command in CreateTable: ",result))
if(nrow(result)==1)
{
print("there has existed table %s in database %s ",tbname,dbname)
return (FALSE)
}
FormatTable<-function(format)
{
fmt.str<-"id int(10) primary key not null auto_increment,"
for(i in 1:nrow(format))
{
name<-format[i,]$name
datatype<-format[i,]$datatype
if(datatype=="numerical")
fmt.str<-paste0(fmt.str,name," DOUBLE")
if(datatype=="category")
fmt.str<-paste0(fmt.str,name," VARCHAR(255)")
if(datatype=="boolen")
fmt.str<-paste0(fmt.str,name," TINYINT")
if(i!=nrow(format))
fmt.str<-paste0(fmt.str,",")
}
return (fmt.str)
}
cmd.str<-sprintf("create table %s.%s (%s);",dbname,tbname,FormatTable(format))
result <- sqlQuery(conn,cmd.str)
return(TRUE)
}
CheckAndUpdateMainTableCol<-function(subtable.names,dbname="hpts"){
# check if the main table contains colmun that connects to subtable.
# If not, alter the main table.
# Args:
# subtable.names: the names of subtable that will connecte to main table
# dbname: the name of database
#
cmd.str<-sprintf("select COLUMN_NAME from information_schema.COLUMNS where table_name = 'main' and table_schema = '%s';",dbname)
conn<-OpenDB()
result<-sqlQuery(conn,cmd.str)
maintable.names<-as.character(result[[1]])
notin.names<-subtable.names[!(subtable.names %in% maintable.names)]
if(length(notin.names)>0)
for(i in 1:length(notin.names))
{
result<-sqlQuery(conn,sprintf("alter table %s.main add %s int(10);",dbname,notin.names[i]))
}
}
CheckAndUpdateTableStructure<-function(data.names,dbname="hpts",tbname="main"){
# check if the table 'tbname' contains column that named as data.names.
# If not, alter the table.
# Args:
# data.names: the names of data that will be inserted to the table
# dbname: the name of database
# tbname: the name of table
cmd.str<-sprintf("select COLUMN_NAME from information_schema.COLUMNS where table_name = '%s' and table_schema = '%s';",tbname,dbname)
conn<-OpenDB()
result<-sqlQuery(conn,cmd.str)
table.names<-as.character(result[[1]])
not.in.names<-data.names[!(data.names %in% table.names)]
if(length(not.in.names)>0)
for(i in 1:length(not.in.names))
{
result<-sqlQuery(conn,sprintf("alter table %s.%s add %s int(10);",dbname,tbname,not.in.names[i]))
}
}
StoreAnalysis<-function(analysis.results,override=TRUE,
analysis_module.path=path.generator_tools)
{
# store the analysis result to DB.
# Args:
# analysis.results: a list that contain analysis result of mutiple analyzers
# analysis_module.path: the directory path of analyzers
#
# Returns:
# the id in main table if success, or 0 if fail
key.analyser.names<-c("appinfo","envinfo")
for(ka in key.analyser.names)
{
if(length(analysis.results[[ka]])==0)
stop(sprintf("%s module can not be NULL!",ka))
}
analyser.names<-names(analysis.results)
nonkey.analyser.names<-analyser.names[!analyser.names %in% key.analyser.names]
keytable.id<-data.frame(name=character(),value=integer(),stringsAsFactors = FALSE)
keytable.id.format<-data.frame(name=character(),datatype=character(),stringsAsFactors = FALSE)
nonkeytable.id<-data.frame(name=character(),value=integer(),stringsAsFactors = FALSE)
nonkeytable.id.format<-data.frame(name=character(),datatype=character(),stringsAsFactors = FALSE)
# key
for(analyser in key.analyser.names)
{
result<-analysis.results[[analyser]]
format<-SerializeXmlDoc(paste0(analysis_module.path,analyser,"/featureinfo.xml"),"datatype")
if(CheckTableExistence("hpts",analyser)==FALSE)
CreateTable(format,"hpts",analyser)
if(override)
{
df<-SelectFromDB(result,format,"hpts",analyser)
if(nrow(df)>0)
sub.id<-df[1,]$id
else
sub.id<-InsertToDB(result,format,"hpts",analyser)
}
else
sub.id<-InsertToDB(result,format,"hpts",analyser)
subtable.id<-data.frame(name=analyser,value=sub.id,stringsAsFactors = FALSE)
subtable.id.format<-data.frame(name=analyser,datatype="numerical",stringsAsFactors = FALSE)
keytable.id<-rbind(keytable.id,subtable.id)
keytable.id.format<-rbind(keytable.id.format,subtable.id.format)
}
# non key
for(analyser in nonkey.analyser.names)
{
result<-analysis.results[[analyser]]
format<-SerializeXmlDoc(paste0(analysis_module.path,analyser,"/featureinfo.xml"),"datatype")
if(CheckTableExistence("hpts",analyser)==FALSE)
CreateTable(format,"hpts",analyser)
sub.id<-InsertToDB(result,format,"hpts",analyser)
subtable.id<-data.frame(name=analyser,value=sub.id,stringsAsFactors = FALSE)
subtable.id.format<-data.frame(name=analyser,datatype="numerical",stringsAsFactors = FALSE)
nonkeytable.id<-rbind(nonkeytable.id,subtable.id)
nonkeytable.id.format<-rbind(nonkeytable.id.format,subtable.id.format)
}
if(CheckTableExistence("hpts","main")==FALSE)
{
print("<h1>main table does not exist, please create a main table!<h1>")
return(0)
}else{
subtable<-rbind(keytable.id,nonkeytable.id)
subtable.format<-rbind(keytable.id.format,nonkeytable.id.format)
#check if the table structure is same to subtable.format. if not, alter table structure in database
CheckAndUpdateMainTableCol(subtable.format$name,"hpts")
if(override)
{
target.row<-SelectFromDB(keytable.id,keytable.id.format,"hpts","main")
if(nrow(target.row)>0)
UpdateForDB(keytable.id,keytable.id.format,nonkeytable.id,nonkeytable.id.format,"hpts","main")
else
InsertToDB(subtable,subtable.format,"hpts","main")
newdata<-SelectFromDB(keytable.id,keytable.id.format,"hpts","main")
mid<-newdata[1,]$id
}
else
{
mid<-InsertToDB(subtable,subtable.format,"hpts","main")
}
return (mid)
}
}
StoreTransformation<-function(main.id, generator.results,analysis.results,override=TRUE,
generator_module.path=path.generator_tools,
analysis_module.path=path.analysis_tools)
{
# store the main table id, generator parameters, analysis result to DB.
# Args:
# generator.results: a list that contain data of a generator. The size of list is 1
# generator_module.path: the directory path of generators
# override: if override record that have same generator parameter and main.id
# analysis.results: a list that contain analysis result of mutiple analyzers
# analysis_module.path: the directory path of analyzers
#
# Returns:
# the id in main table if success, or 0 if fail
#check if the generator.result size =1
if(length(generator.results)!=1)
stop(sprintf("Error length of generator.results in StoreResultForGeneratorToDB,should be 1 but actual be %d",length(generator.results)))
# format analysis.results to subtable
subtable<-data.frame(name=character(),value=character(),stringsAsFactors = FALSE)
subtable.format<-data.frame(name=character(),value=character(),stringsAsFactors = FALSE)
for(i in 1:length(analysis.results))
{
analyser<-names(analysis.results[i])
result<-analysis.results[[i]]
format<-SerializeXmlDoc(paste0(analysis_module.path,analyser,"/featureinfo.xml"),"datatype")
if(CheckTableExistence("hpts",analyser)==FALSE)
CreateTable(format,"hpts",analyser)
sub.id<-InsertToDB(result,format,"hpts",analyser)
subtable<-rbind(subtable,data.frame(name=analyser,value=as.character(sub.id),stringsAsFactors = FALSE))
subtable.format<-rbind(subtable.format,data.frame(name=analyser,datatype="numerical",stringsAsFactors = FALSE))
}
#combine generator.parameter and subtable
generator.name<-names(generator.results[1])
generator.parameters<-generator.results[[1]]
generator.format<-SerializeXmlDoc(paste0(generator_module.path,generator.name,"/variantinfo.xml"),"datatype")
generator.parameters<-rbind(generator.parameters,data.frame(name="instanceId",value=as.character(main.id),stringsAsFactors = FALSE))
generator.format<-rbind(generator.format,data.frame(name="instanceId",datatype="numerical",stringsAsFactors = FALSE))
cond.parameters<-generator.parameters
cond.format<-generator.format
generator.parameters<-rbind(generator.parameters,subtable)
generator.format<-rbind(generator.format,subtable.format)
if(CheckTableExistence("hpts",generator.name)==FALSE)
CreateTable(generator.format,"hpts",generator.name)
else
CheckAndUpdateTableStructure(generator.format$name,"hpts",generator.name)
if(override)
{
target.row<-SelectFromDB(cond.parameters,cond.format,"hpts",generator.name)
if(nrow(target.row)>0)
{
UpdateForDB(cond.parameters,cond.format,subtable,subtable.format,"hpts",generator.name)
newdata<-SelectFromDB(generator.parameters,generator.format,"hpts",generator.name)
generator.table.id<-newdata[1,]$id
}
else
generator.table.id<-InsertToDB(generator.parameters,generator.format,"hpts",generator.name)
}
else
generator.table.id<-InsertToDB(generator.parameters,generator.format,"hpts",generator.name)
return(generator.table.id)
}
parseCombinedData<-function(name,data,datastr){
name<-sub(" ","",name)
r<-eval(parse(text=paste0("data.frame(name=character(),",datastr,"=character(),stringsAsFactors = FALSE)")))
if(length(data)==0)
stop("data is NULL in function parseCombinedData")
if(is.list(data))
{
for(i in 1:length(data))
{
subname<-paste0(name,"_",i)
r<-rbind(r,parseCombinedData(subname,data[i][[datastr]],datastr))
}
}else{
#filter blank for features defination in xml
name<-gsub(" ","",name)
data<-gsub(" ","",data)
r<-eval(parse(text=paste0("data.frame(name=name,",datastr,"=data,stringsAsFactors = FALSE)")))
}
return (r)
}
# serialize xml feature/variant file to a dataframe
SerializeXmlDoc<-function(doc.xml,datastr)
{
doc.list<-xmlToList(doc.xml)
doc.seril<-eval(parse(text=paste0("data.frame(name=character(),",datastr,"=character())")))
for(i in 1:length(doc.list))
{
f<-doc.list[i]
if(names(f)!="feature"&&names(f)!="variant")
stop(sprintf("error format in xml with %s!\n",datastr))
doc.seril<-eval(parse(text=paste0('rbind(doc.seril,parseCombinedData(f$',names(f),'$name,f$',names(f),'$',
datastr,',"',datastr,'"))')))
}
return(doc.seril)
}
GetEnableList<-function(doc.xml,Nameaskey=TRUE)
{
doc.list<-xmlToList(doc.xml)
doc.seril<-data.frame(name=character(),datatype=character())
for(i in 1:length(doc.list))
{
f<-doc.list[i]
if(names(f)!="feature"&&names(f)!="variant")
stop("error format in xml with datatype!\n")
tmp<-eval(parse(text=paste0('parseCombinedData(f$',names(f),
'$name,f$',names(f),'$datatype,"datatype")')))
tmp$enable_variable<-eval(parse(text=paste0('f$',names(f),'$enable_variable')))
tmp$oldname<-gsub(" ","",eval(parse(text=paste0('f$',names(f),'$name'))))
doc.seril<-rbind(doc.seril,tmp)
}
enable.list<-list()
for(i in 1:nrow(doc.seril))
{
tmp<-doc.seril[i,]
enable_str<-sub(tmp$oldname,tmp$name,tmp$enable_variable)
if(Nameaskey)
enable.list[[tmp$name]]<-enable_str
else
enable.list[[enable_str]]<-tmp$name
}
return(enable.list)
}
GetDatatypeList<-function(doc.xml)
{
doc.seril<-SerializeXmlDoc(doc.xml,"datatype")
datatype.list<-list()
for(i in 1:nrow(doc.seril))
{
tmp<-doc.seril[i,]
datatype.list[[tmp$name]]<-tmp$datatype
}
return(datatype.list)
}
# unserialize a dataframe to a xml format file, which need a xmlformat file
UnSerializeXmlDoc<-function(doc.seril,xmlformat)
{
# subformat
FillXMLNode<-function(subformat,data,name)
{
if(is.list(subformat))
{
fnode<-newXMLNode(name = "value",parent = fsnode);
for(i in 1:length(str))
{
subname<-paste0(name,"_",i);
addChildren(fnode,
FillXMLNode(subformat[i],data,name)
);
}
}else{
value<-data[which(data$name==name),];
if(nrow(value)==0)
return (NA);
if(nrow(value)==1)
{
return (newXMLNode(name="value",value));
}else{
stop("stop in Fill FillXMLNode, because there are two atrribute have same name");
}
}
}
doc.xml = newXMLDoc();
fsnode<-newXMLNode(name="features",doc=doc.xml);
xmlformat.list<-xmlToList(xmlformat);
for(i in 1:nrow(xmlformat.list))
{
feature<-xmlformat.list[i,]$feature;
subformat<-feature$value;
xmlnode<-FillXMLNode(subformat,doc.seril,feature$name);
if(is.na(xmlnode))
{
next;
} else{
fnode<-newXMLNode(name = "feature",parent = fsnode);
addChildren(fnode,
newXMLNode(name="name",feature$name),
xmlnode
);
}
}
return (doc.xml);
}
InsertToDB<-function(data,format,
dbname = "hpts", tbname = "ttable"){
# Perform a insert operation using 'data' in 'format' to table 'tbname' of database 'dbname'
#
# Args:
# data: The data need to insert to database, need be a dataframe
# format: The format that specifics data structure and type
# dbname: The database name
# tbname: The table name
#
# Returns:
# The last insert it
stopifnot(is.data.frame(data)==TRUE)
stopifnot(is.vector(data$name)==TRUE)
stopifnot(is.vector(data$value)==TRUE)
formatvalue<-function(data,format)
{
values_str<-""
for(i in 1:nrow(data))
{
fname<-data[i,]$name
value<-data[i,]$value
if(i!=1)
values_str<-paste0(values_str,",")
for(j in 1:nrow(format))
{
if(fname==format[j,]$name)
{
datatype<-format[j,]$datatype
if(datatype=="numerical")
values_str<-paste0(values_str,value)
if(datatype=="category")
values_str<-paste0(values_str,'"',value,'"')
if(datatype=="boolen")
values_str<-paste0(values_str,value)
break
}
}
}
return (values_str)
}
s1 <- paste(data$name, collapse = ",")
s2 <- formatvalue(data,format)
cmd.str <- sprintf('insert into %s.%s(%s) values(%s);', dbname, tbname, s1, s2)
conn <- OpenDB()
result<-sqlQuery(conn, cmd.str)
if(length(result)!=0)
stop(result)
tableid <- sqlQuery(conn, "select last_insert_id()")
return(tableid[[1]])
}
SelectFromDB<-function(condition,format,
dbname = "hpts", tbname = "ttable"){
# Perform a select operation using 'condition' in 'format' to table 'tbname' of database 'dbname'
#
# Args:
# condition: The condition of select, need be a dataframe
# format: The format that specifics condition structure and type
# dbname: The database name
# tbname: The table name
#
# Returns:
# The last insert it
stopifnot(is.data.frame(condition)==TRUE)
stopifnot(is.vector(condition$name)==TRUE)
stopifnot(is.vector(condition$value)==TRUE)
FormatCondition<-function(condition,format)
{
condition.str<-""
for(i in 1:nrow(condition))
{
fname<-condition[i,]$name
value<-condition[i,]$value
for(j in 1:nrow(format))
{
if(fname==format[j,]$name)
{
datatype<-format[j,]$datatype
if(datatype=="numerical")
condition.str<-sprintf(" %s and %s=%s",condition.str,fname,value)
if(datatype=="category")
condition.str<-sprintf(" %s and %s='%s'",condition.str,fname,value)
if(datatype=="boolen")
condition.str<-sprintf(" %s and %s=%s",condition.str,fname,value)
break
}
}
}
return (condition.str)
}
condition.str <- FormatCondition(condition,format)
cmd.str <- sprintf('select * from %s.%s where TRUE %s ;', dbname, tbname, condition.str)
conn <- OpenDB()
result<-sqlQuery(conn, cmd.str)
return (result)
}
RemoveFromDB<-function(condition,format,
dbname = "hpts", tbname = "ttable"){
# Perform a rm operation using 'condition' in 'format' to table 'tbname' of database 'dbname'
#
# Args:
# condition: The condition of select, need be a dataframe
# format: The format that specifics condition structure and type
# dbname: The database name
# tbname: The table name
#
# Returns:
#
stopifnot(is.data.frame(condition)==TRUE)
stopifnot(is.vector(condition$name)==TRUE)
stopifnot(is.vector(condition$value)==TRUE)
FormatCondition<-function(condition,format)
{
condition.str<-""
for(i in 1:nrow(condition))
{
fname<-condition[i,]$name
value<-condition[i,]$value
for(j in 1:nrow(format))
{
if(fname==format[j,]$name)
{
datatype<-format[j,]$datatype
if(datatype=="numerical")
condition.str<-sprintf(" %s and %s=%s",condition.str,fname,value)
if(datatype=="category")
condition.str<-sprintf(" %s and %s='%s'",condition.str,fname,value)
if(datatype=="boolen")
condition.str<-sprintf(" %s and %s=%s",condition.str,fname,value)
break
}
}
}
return (condition.str)
}
condition.str <- FormatCondition(condition,format)
if(condition.str=="")
stop("error ! you will clean up the table")
cmd.str <- sprintf('rm from %s.%s where TRUE %s ;', dbname, tbname, condition.str)
print(cmd.str)
conn <- OpenDB()
result<-sqlQuery(conn, cmd.str)
return (result)
}
UpdateForDB<-function(condition,condition.format,
newdata,newdata.format,
dbname = "hpts", tbname = "ttable"){
# Perform a rm operation using 'condition' in 'format' to table 'tbname' of database 'dbname'
#
# Args:
# condition: The condition of select, need be a dataframe
# format: The format that specifics condition structure and type
# dbname: The database name
# tbname: The table name
#
# Returns:
# 0: there is no need to updata
#
stopifnot(is.data.frame(condition)==TRUE)
stopifnot(is.vector(condition$name)==TRUE)
stopifnot(is.vector(condition$value)==TRUE)
stopifnot(is.data.frame(newdata)==TRUE)
stopifnot(is.vector(newdata$name)==TRUE)
stopifnot(is.vector(newdata$value)==TRUE)
if(nrow(newdata)==0)
return(0)
Format<-function(data,format,linker=",")
{
data.str<-""
for(i in 1:nrow(data))
{
fname<-data[i,]$name
value<-data[i,]$value
for(j in 1:nrow(format))
{
if(fname==format[j,]$name)
{
if(i>1)
data.str<-paste(data.str,linker)
datatype<-format[j,]$datatype
if(datatype=="numerical")
data.str<-sprintf(" %s %s=%s",data.str,fname,value)
if(datatype=="category")
data.str<-sprintf(" %s %s='%s'",data.str,fname,value)
if(datatype=="boolen")
data.str<-sprintf(" %s %s=%s",data.str,fname,value)
break
}
}
}
return (data.str)
}
update.str<- Format(newdata,newdata.format)
condition.str <- Format(condition,condition.format,"and")
if(condition.str=="")
stop("error ! you will update the whole table")
cmd.str <- sprintf('update %s.%s set %s where TRUE and %s ;', dbname, tbname, update.str,condition.str)
conn <- OpenDB()
result<-sqlQuery(conn, cmd.str)
return (result)
}
================================================
FILE: framework/EvaluatorModule/Evaluator.R
================================================
PAK.Evaluator<-setRefClass(
"PAK.Evaluator",
fields = list(sub.evaluators = "list",
analysers.results.store ="list",
analysers.results.evaluate="list"),
methods = list(
#init function
initialize=function(sub.evaluators=list()){
sub.evaluators<<-sub.evaluators
},
# the max score is 0
getScore=function(analysers.results){
score<-0
for(analyser in names(sub.evaluators))
{
analyser.evaluator<-sub.evaluators[[analyser]]
analyser.results<-analysers.results[[analyser]]
#for each measurement
for(m.name in names(analyser.results))
{
m.result<-analyser.results[[m.name]]
score<-score+analyser.evaluator[[m.name]](m.result)
}
}
return (score)
},
evaluate=function(app){
for(aly in names(sub.evaluators))
{
one.analyser<-PAK.Analyser$new(name=aly,features=names(sub.evaluators[[aly]]),app=app)
one.analyser$anaylze()
analysers.results.store[[aly]]<<-one.analyser$getResultForDB()
analysers.results.evaluate[[aly]]<<-one.analyser$getResult()
}
score<-getScore(analysers.results.evaluate)
return (score)
},
getResults2store=function(){
return (analysers.results.store)
}
)
)
================================================
FILE: framework/ExtractorModule/Analyze.old
================================================
library(XML)
InstanceAnaylze<-function(analyser,analyser.features,app,
analysis_module.path="/home/lyl/program/hpts/web/script/ExtractorModule/anaylsis_module/"){
# perform analysis on target running instance
#
# Args:
# analyzer:a string give generator name
# analyser.feature: a string vector that contain enable variable for feauture to analysis
# app:a string give target program name(with path)
envstr<-""
for(i in 1:length(analyser.features))
{
envvar<-gsub(" ","",analyser.features[i])
envstr<-paste(envstr,sprintf("export %s=TRUE;",envvar))
}
app.name<-basename(app)
app.path<-dirname(app)
#go applications directions
envstr<-paste0(envstr,'cd ',app.path,';')
envstr<-paste0(envstr,'sh ',analysis_module.path,analyser,"/analysis.sh ",app.name)
r<-system(envstr,intern = TRUE)
resultfile<-paste0(app.path,"/",r)
anaylsis.result<-xmlToDataFrame(paste0(app.path,"/",r),stringsAsFactors=FALSE)
return(anaylsis.result)
}
#anaylsis.result<-InstanceAnaylze("tau",c("ENABLE_P_WALL_CLOCK_TIME"),"/home/lyl/program/hpts/applications/optimized_1.cpp")
================================================
FILE: framework/ExtractorModule/Extractor.R
================================================
PAK.Extractor<-setRefClass(
"PAK.Extractor",
fields = list(analysers = "list",
analysers.results.store="list",
analysers.results.produce="list"
),
methods = list(
#init function
initialize=function(analysers=list()){
analysers<<-analysers
},
# the max score is 0
extractFeatures=function(app){
for(aly in names(analysers))
{
one.analyser<-PAK.Analyser$new(name=aly,features=analysers[[aly]],app=app)
one.analyser$anaylze()
analysers.results.store[[aly]]<<-one.analyser$getResultForDB()
analysers.results.produce[[aly]]<<-one.analyser$getResult()
}
return (analysers.results.produce)
},
getFeatures2produce=function(){
return (analysers.results.produce)
},
getFeatures2store=function(){
return (analysers.results.store)
}
)
)
================================================
FILE: framework/Interface/Analyser.R
================================================
PAK.Analyser<-setRefClass(
"PAK.Analyser",
fields = list(app = "character",
name = "character",
features = "character",
result = "data.frame",
path = "character",
enable.list ="list",
datatype.list="list"),
methods = list(
#init function
initialize=function(name="",app="",features=character()){
name<<-name
app<<-app
features<<-features
path<<-path.analysis_tools
enable.list<<-GetEnableList(paste0(path,"/",name,"/featureinfo.xml"),Nameaskey = TRUE)
datatype.list<<-GetDatatypeList(paste0(path,"/",name,"/featureinfo.xml"))
},
enableAllfeatures=function(){
features<<-names(enable.list)
},
anaylze=function(){
# perform analysis on target running instance
#
# Args:
# analyzer:a string give generator name
# analyser.feature: a string vector that contain enable variable for feauture to analysis
# app:a string give target program name(with path)
envstr<-""
if(length(features)==0)
stop(sprintf("error! features of analyser %s is NULL!",name))
for(i in 1:length(features))
{
envvar<-gsub(" ","",enable.list[[features[i]]])
envstr<-paste(envstr,sprintf("export %s=TRUE;",envvar))
}
app.name<-basename(app)
app.path<-dirname(app)
#go applications directions
envstr<-paste0(envstr,'cd ',app.path,';')
envstr<-paste0(envstr,'sh ',path,name,"/analysis.sh ","./",app.name)
r<-system(envstr,intern = TRUE)
resultfile<-paste0(app.path,"/",r)
result<<-xmlToDataFrame(paste0(app.path,"/",r),stringsAsFactors=FALSE)
},
getResultForDB=function()
{
return (result)
},
getResult=function()
{
result.evaluate<-list()
for(i in 1:nrow(result))
{
tmp<-result[i,]
if(datatype.list[[tmp$name]]!="category")
result.evaluate[[tmp$name]]<-as.numeric(tmp$value)
else
result.evaluate[[tmp$name]]<-tmp$value
}
return (result.evaluate)
}
)
)
================================================
FILE: framework/Interface/Generator.R
================================================
library("methods")
PAK.Generator<-setRefClass(
"PAK.Generator",
fields = list(app = "character",
name = "character",
parameters = "data.frame",
output = "character",
result = "character",
path="character"),
methods = list(
#init function
initialize=function(name="",app="",output="",p.os=NA){
name<<-name
app<<-app
output<<-output
path<<-path.generator_tools
if(is.data.frame(p.os))
setPUsingSpace(p.os)
},
transform=function(){
# perform code transforming on target program
envstr<-""
for(i in 1:nrow(parameters))
{
envvar.name<-gsub(" ","",parameters[i,]$enable_variable)
envvar.value<-gsub(" ","",parameters[i,]$parameter)
envstr<-paste(
envstr,sprintf("export %s='%s';",
envvar.name,
envvar.value))
}
#go applications directions
app.name<-basename(app)
app.path<-dirname(app)
envstr<-paste0(envstr,'cd ',app.path,';')
envstr<-paste0(envstr,'sh ',path,name,
"/transform.sh ",app.name," ",output)
variant.file<-system(envstr,intern = TRUE)
result<<-paste0(app.path,"/",variant.file)
},
setPUsingSpace=function(p.in.space){
enable.list<-GetEnableList(paste0(path,"/",name,"/variantinfo.xml"))
parameters<<-data.frame(enable_variable=character(),
parameter=character())
for(p in names(p.in.space) )
parameters<<-
rbind(parameters,data.frame(enable_variable=enable.list[[p]],
parameter=p.in.space[[p]]))
},
getParameterForDB=function(){
enable.list<-GetEnableList(paste0(path,"/",name,"/variantinfo.xml"),FALSE)
df<-as.data.frame(do.call(rbind,mapply(SIMPLIFY = FALSE,function(e,p)
{data.frame(name=enable.list[[e]],value=p,stringsAsFactors = FALSE)},
parameters$enable_variable,parameters$parameter)))
return(df)
}
)
)
================================================
FILE: framework/LearnerModule/Learner.R
================================================
# the Learner module
PAK.Learner<-setRefClass(
"PAK.Learner",
fields = list(model="list",dv.name="character",
idv.name="character"),
methods = list(
#init function
initialize=function(){
},
learnModel=function(training.data,idv,dv){
}
)
)
================================================
FILE: framework/OptimizerModule/Optimizer.R
================================================
PAK.Optimizer<-setRefClass(
"PAK.Optimizer",
fields = list(generator.name ="character",
generator= "PAK.Generator",
output.name="character"),
methods = list(
#init function
initialize=function(generator.name=NA,output.name="optimized.cpp"){
output.name<<-output.name
if(is.character(generator.name))
{
generator.name<<-generator.name
generator<<-PAK.Generator$new(name=generator.name,output=output.name)
}
},
optimize=function(app,parameters){
generator$setPUsingSpace(parameters)
generator$app<<-app
r<-generator$transform()
return(r)
},
getParameters2store=function(){
parameters.list<-list()
print(generator$getParameterForDB())
print(generator.name)
parameters.list[[generator.name]]<-generator$getParameterForDB()
return(parameters.list)
}
)
)
================================================
FILE: framework/ProducerModule/Producer.R
================================================
# a class to producer parameter
PAK.Producer<-setRefClass(
"PAK.Producer",
fields = list(),
methods = list(
# init function
initialize=function(){
},
getParameter=function(step,extractor.result,last.score)
{
}
)
)
================================================
FILE: framework/Tuning/Tuner.R
================================================
library("methods")
PAK.Tuner<-setRefClass(
"PAK.Tuner",
fields = list(app = "character",
extractor ="PAK.Extractor",
evaluator = "PAK.Evaluator",# list(analyser=list(name=eval.fun)): name is measurement name, and eval.fun is its evaluate function
producer ="PAK.Producer",#parameter producer
optimizer ="PAK.Optimizer",#optimizer
need.store ="logical",
best.score="numeric",
best.parameters="data.frame",
best.results="list"),
methods = list(
#init function
initialize=function(app,extractor=PAK.Extractor$new(),evaluator,producer,optimizer,need.store=FALSE){
app<<-app
extractor<<-extractor
evaluator<<-evaluator
producer<<-producer
optimizer<<-optimizer
need.store<<-need.store
},
checkpoint=function(step,score,r.producer,r.best.score,r.best.parameters,r.best.result){
if(length(dir(pattern="stoptuning"))!=0)
{
print("stop tuning!")
save(step,score,r.producer,r.best.score,r.best.parameters,r.best.result,file="tuningRecord")
return (TRUE)
}
return (FALSE)
},
tune=function(resume.file=NA){
step<-0
score<-numeric()
extractor$extractFeatures(app)
if(!is.na(resume.file))
{
print("load file")
load(resume.file)
producer<<-r.producer
best.score<<-r.best.score
best.parameters<<-r.best.parameters
best.results<<-r.best.result
}
while(TRUE)
{
step<-step+1
cat(sprintf("step : %d",step))
#produce parameters
parameters<-producer$getParameter(step=step,
extractor.result=extractor$getFeatures2produce(),
last.score=score)
#search is end
if(length(parameters)==0)
break
optimized.instance<-optimizer$optimize(app,parameters)
print(parameters)
score<-evaluator$evaluate(optimized.instance)
if(need.store)
store2DB()
if(step==1||score>best.score)
{
best.score<<-score
best.parameters<<-parameters
best.results<<-evaluator$analysers.results.evaluate
}
print(score)
if(score==0||checkpoint(step,score,producer,best.score,best.parameters,best.results))
break
cat("end a step \n")
}
},
store2DB=function(){
keyAnalyser.result<-PerformKeyAnalysis(app)
unkeyAnalyser.result<-extractor$getFeatures2store()
Analyser.result<-rbind(keyAnalyser.result,unkeyAnalyser.result)
main.id<-StoreAnalysis(keyAnalyser.result,override = TRUE)
StoreTransformation(main.id,optimizer$getParameters2store(),evaluator$getResults2store())
}
)
)
================================================
FILE: framework/dependencies.R
================================================
library("XML")
library("jsonlite")
library("RODBC")
library("methods")
print("load dependencies")
================================================
FILE: framework/lib/OptimizationSpace.R
================================================
GenerationParameterSpace<-function(parameter.list)
{
loop.str<-""
df.str<-""
for(i in 1:length(parameter.list))
{
range<-unlist(strsplit(parameter.list[[i]],";"))[1]
condition<-unlist(strsplit(parameter.list[[i]],";"))[2]
parameter.name<-names(parameter.list[i])
if(is.na(condition))
tmp.str<-sprintf("for(%s in c(%s) )\n",names(parameter.list[i]),range)
else
tmp.str<-sprintf("for(%s in c(%s) )\n if(%s)\n",names(parameter.list[i]),range,condition)
loop.str<-paste0(loop.str,tmp.str)
df.str<-paste0(df.str,sprintf("%s=%s",
parameter.name,parameter.name))
if(i!=length(parameter.list))
df.str<-paste0(df.str,",")
}
df.str<-paste0("combinations.tmp<-data.frame(",df.str,",stringsAsFactors = FALSE)")
body.str<-paste0(df.str,"\nif(nrow(combinations.parameter)==0)\n",
"combinations.parameter<-combinations.tmp\n",
"else\ncombinations.parameter<-rbind(",
"combinations.parameter,combinations.tmp)")
space.str<-paste0(loop.str,"{\n",body.str,"\n}")
combinations.parameter<-data.frame()
eval(parse(text=space.str))
return(combinations.parameter)
}
#combinations.parameter<-GenerationSpace(parameter.list)
================================================
FILE: framework/lib/learners.R
================================================
# an decision tree learner
PAK.Learner.DecisionTree<-setRefClass(
"PAK.Learner.DecisionTree",
contains="PAK.Learner",
fields = list(model="list",dv.name="character",
idv.name="character"),
methods = list(
#init function
initialize=function(){
},
learnModel=function(training.data,idv,dv){
buildstr<-sprintf("rpart(%s~.,training.data)",dv)
model[["rp"]]<<-eval(parse(text=buildstr) )
model[["dv.name"]]<<-dv
model[["idv.name"]]<<-idv
return (model)
}
)
)
================================================
FILE: framework/lib/producers.R
================================================
library(rpart)
PAK.Producer.Exhaustion<-setRefClass(
"PAK.Producer.Exhaustion",
contains="PAK.Producer",
fields = list(parameter.space="data.frame"),
methods = list(
#init function
initialize=function(parameter.list){
parameter.space<<-GenerationParameterSpace(parameter.list)
},
getParameter=function(step,extractor.result,last.score)
{
if(step<=nrow(parameter.space))
{
if(ncol(parameter.space)==1)
return (eval(parse(text=sprintf("data.frame(%s=parameter.space[step,])",names(parameter.space)))))
else
return(parameter.space[step,])
}
}
)
)
PAK.Producer.Greedy<-setRefClass(
"PAK.Producer.Greedy",
contains="PAK.Producer",
fields = list(parameter.range="list",#list(p1=c(1,2,3..),p2=c(1,2,3..)..)
v.idx ="numeric",
v.score ="numeric",
v.pos ="numeric",
local.optimal= "data.frame"),
methods = list(
#init function
initialize=function(parameter.range=list()){
parameter.range<<-parameter.range
},
getParameter=function(step,extractor.result,last.score)
{
if(step==1)
{
local.optimal<<-defulat.parameters
v.idx<<-1
v.score<<-c()
v.pos<<-0
}
else if(v.pos<v.length)
{
v.pos<<-v.pos+1
v.score[v.pos]<<-last.score
}else{#finish local optimal search for a parameter
optimal.pos<-which.max(v.score)
local.optimal[[v.idx]]<<-parameter.range[[v.idx]][optimal.pos]
v.idx<<-v.idx+1
if(v.idx>parameter.number)
return (data.frame())
v.score<<-c()
v.pos<<-0
}
new.parameter<-local.optimal
new.parameter[[v.idx]]<-parameter.range[[v.idx]][v.pos+1]
return (new.parameter)
}
)
)
PAK.Producer.OptimalSpace<-setRefClass(
"PAK.Producer.OptimalSpace",
contains="PAK.Producer",
fields = list(parameter.space="data.frame"),
methods = list(
#init function
initialize=function(tid){
os<-PredictOptimalSpace(tid,combine.os=c(1,3,5,8,10),os.size=25,model=os.models[[1]],cond.str=cond.str,omp.number = 16)
convertOS2parameterspace(os)
cat("length of os: ",nrow(parameter.space),"\n")
print(parameter.space)
},
getParameter=function(step,extractor.result,last.score)
{
if(step<nrow(parameter.space))
{
parameter<-parameter.space[step,]
for(p.name in names(parameter))
{
if(is.na(parameter[[p.name]]))
parameter[[p.name]]<-NULL
}
return(parameter)
}
},
convertOS2parameterspace=function(os)
{
parameter.space<<-data.frame()
for(config in os)
{
if(config=="")
parameter.space<<-rbind(
parameter.space,data.frame(
Tiling_1=NA,Tiling_2=NA,Tiling_3=NA,
Tiling_4=NA,Tiling_5=NA,Tiling_6=NA,
Tiling_7=NA,Tiling_8=NA,Tiling_9=NA,
DoSIMD=1,Unrolling=NA))
else{
pars.strs<-unlist(strsplit(config,","))
if(length(pars.strs)==1)
parameter.space<<-rbind(
parameter.space,data.frame(
Tiling_1=NA,Tiling_2=NA,Tiling_3=NA,
Tiling_4=NA,Tiling_5=NA,Tiling_6=NA,
Tiling_7=NA,Tiling_8=NA,Tiling_9=NA,
DoSIMD=1,Unrolling=pars.strs[1]))
else if(length(pars.strs==10))
parameter.space<<-rbind(
parameter.space,data.frame(
Tiling_1=pars.strs[2],Tiling_2=pars.strs[3],Tiling_3=pars.strs[4],
Tiling_4=pars.strs[5],Tiling_5=pars.strs[6],Tiling_6=pars.strs[7],
Tiling_7=pars.strs[8],Tiling_8=pars.strs[9],Tiling_9=pars.strs[10],
DoSIMD=1,Unrolling=NA))
}
}
}
)
)
PAK.Producer.DecisionTree<-setRefClass(
"PAK.Producer.DecisionTree",
contains="PAK.Producer",
fields = list(model="list",
dv.name="character"),
methods = list(
#init function
initialize=function(){
},
loadModel=function(new.model){
model[["rp"]]<<-new.model
},
trainModel=function(training.data,ivs,dv){
model[["rp"]]<<-eval(parse(text=sprintf("rpart(%s~.,training.data)",dv)) )
dv.name<<-dv
},
getParameter=function(step,extractor.result,last.score)
{
inv.str<-""
for(e in names(extractor.result))
{
one.ext<-extractor.result[[e]]
for(f in names(one.ext))
{
if(inv.str=="")
inv.str<-sprintf("%s=%s",f,as.character(one.ext[[f]]))
else
inv.str<-sprintf("%s,%s=%s",inv.str,f,as.character(one.ext[[f]]))
}
}
inv<-eval(parse(text=sprintf("data.frame(%s)",inv.str)) )
dv.prs<-predict(model[["rp"]],inv,method="prob")
dv.prs<-as.data.frame(t(dv.prs))
dv.prs$type<-row.names(dv.prs)
dv.prs<-dv.prs[order(dv.prs[[names(dv.prs)[1]]],decreasing=T),]
if(step>nrow(dv.prs))
parameter<-eval(parse(text=sprintf("data.frame(%s=NULL)",dv.name)))
else
parameter<-eval(parse(text=sprintf("data.frame(%s='%s')",dv.name,dv.prs$type[step])))
return (parameter)
}
)
)
================================================
FILE: generator_module/optimizeCompilerFlag/transform.sh
================================================
#!/bin/bash
CC=gcc
#export ENABLE_COMPILERFLAG="-O3"
CFLAGENABLE=`env |grep ENABLE_COMPILERFLAG`
FNAME=${CFLAGENABLE#ENABLE_}
FNAME=${FNAME%%=*}
SUFFIX=${FNAME##*_}
FNAME=${FNAME%%_*}
if [ $FNAME = "COMPILERFLAG" ] ; then
CFLAG=${CFLAGENABLE#*=}
$CC $CFLAG $1 -o $2
fi
echo $2
================================================
FILE: generator_module/optimizeCompilerFlag/variantinfo.xml
================================================
<variants>
<variant>
<name>compilerflag</name>
<description>the compiler flag</description>
<enable_variable>ENABLE_COMPILERFLAG</enable_variable>
<datatype>string</datatype>
</variant>
</variants>
================================================
FILE: pak.R
================================================
path.analysis_tools<-"/home/liujh/PAK-master/analysis_module/"
path.generator_tools<-"/home/liujh/PAK-master/generator_module/"
odbc.source<-"kdb"
database.user<-"user"
database.pwd<-"pwd"
GetSourceFileDir<-function()
{
frame_files <- lapply(sys.frames(), function(x) x$ofile)
frame_files <- Filter(Negate(is.null), frame_files)
path.sourcefile <- dirname(frame_files[[length(frame_files)]])
return(path.sourcefile)
}
SourceDir <- function(path, trace = FALSE)
{
#if(missing(path)) path <- getwd()
for(i in 1:length(path))
{
for (nm in list.files(path, pattern = ".[Rr]",recursive=TRUE))
{
if(trace) cat(nm,":")
source(file.path(path, nm))
if(trace) cat("\n")
}
}
}
sfdir<-GetSourceFileDir()
source(file.path(sfdir,"framework/dependencies.R"))
SourceDir(file.path(sfdir,"framework/Interface"))
SourceDir(file.path(sfdir,"framework/ExtractorModule"))
SourceDir(file.path(sfdir,"framework/ProducerModule"))
SourceDir(file.path(sfdir,"framework/OptimizerModule"))
SourceDir(file.path(sfdir,"framework/EvaluatorModule"))
SourceDir(file.path(sfdir,"framework/LearnerModule"))
SourceDir(file.path(sfdir,"framework/DBModule"))
SourceDir(file.path(sfdir,"framework/Tuning"))
SourceDir(file.path(sfdir,"framework/lib"))
#PerformKeyAnalysis<-function(app){
# key.analyser.names<-c("appinfo","envinfo")
#result<-list()
#for(ka in key.analyser.names)
#{
# analyser<-PAK.Analyser$new(name=ka,app)
#analyser$enableAllfeatures()
#analyser$anaylze()
#result[[ka]]<-analyser$getResultForDB()
# }
# return (result)
#}
================================================
FILE: tutorial/autotuning_compilerflag.R
================================================
GetSourceFileDir<-function()
{
frame_files <- lapply(sys.frames(), function(x) x$ofile)
frame_files <- Filter(Negate(is.null), frame_files)
path.sourcefile <- dirname(frame_files[[length(frame_files)]])
return(path.sourcefile)
}
sfdir<-GetSourceFileDir()
source(file.path(sfdir,"../pak.R"))
# Exhaustion algorithm autotuner
if(TRUE || FALSE)
{
app<-"/home/liujh/PAK-master/applications/multiplyexample.c"
parameter.list<-list()
parameter.list["compilerflag"]<-'" -O0" ," -O1"," -O2"," -O3";'
myproducer<-PAK.Producer.Exhaustion$new(parameter.list)
myoptimizer<-PAK.Optimizer$new(generator.name="optimizeCompilerFlag")
myevaluator<-PAK.Evaluator$new(sub.evaluators=list(paktimer=list(time=function(x){if(x>0) return (0-x) else return(0)})))
tuning<-PAK.Tuner$new(app=app,optimizer=myoptimizer,evaluator=myevaluator,producer =myproducer,need.store=FALSE)
tuning$tune()
}
gitextract_44_kfi19/
├── .gitignore
├── PAK.Rproj
├── README.md
├── analysis_module/
│ ├── appinfo/
│ │ ├── analysis.sh
│ │ ├── appinfo.R
│ │ └── featureinfo.xml
│ ├── envinfo/
│ │ ├── EnvGather.R
│ │ ├── analysis.sh
│ │ └── featureinfo.xml
│ ├── paktimer/
│ │ ├── Makefile
│ │ ├── analysis.sh
│ │ ├── featureinfo.xml
│ │ ├── paktimer
│ │ └── paktimer.c
│ └── tau/
│ ├── analysis.sh
│ ├── featureinfo.xml
│ ├── featureofPAPI.r
│ └── outputformat.R
├── applications/
│ ├── multiplyexample.c
│ ├── optimized.cpp
│ └── result.xml
├── framework/
│ ├── DBModule/
│ │ └── functions.R
│ ├── EvaluatorModule/
│ │ └── Evaluator.R
│ ├── ExtractorModule/
│ │ ├── Analyze.old
│ │ └── Extractor.R
│ ├── Interface/
│ │ ├── Analyser.R
│ │ └── Generator.R
│ ├── LearnerModule/
│ │ └── Learner.R
│ ├── OptimizerModule/
│ │ └── Optimizer.R
│ ├── ProducerModule/
│ │ ├── .RData
│ │ └── Producer.R
│ ├── Tuning/
│ │ └── Tuner.R
│ ├── dependencies.R
│ └── lib/
│ ├── OptimizationSpace.R
│ ├── learners.R
│ └── producers.R
├── generator_module/
│ └── optimizeCompilerFlag/
│ ├── transform.sh
│ └── variantinfo.xml
├── pak.R
└── tutorial/
└── autotuning_compilerflag.R
SYMBOL INDEX (4 symbols across 2 files) FILE: analysis_module/paktimer/paktimer.c type timeval (line 3) | struct timeval type timeval (line 4) | struct timeval function main (line 6) | int main(int argc,char** argv) FILE: applications/multiplyexample.c function main (line 11) | int main()
Condensed preview — 40 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (100K chars).
[
{
"path": ".gitignore",
"chars": 28,
"preview": "*.svn*\n.Rproj.user\n.Rhistory"
},
{
"path": "PAK.Rproj",
"chars": 205,
"preview": "Version: 1.0\n\nRestoreWorkspace: Default\nSaveWorkspace: Default\nAlwaysSaveHistory: Default\n\nEnableCodeIndexing: Yes\nUseSp"
},
{
"path": "README.md",
"chars": 8648,
"preview": "# PAK\nA performance tuning and knowledge management suit\n#Introduction\nPAK is a general scientific application autotunin"
},
{
"path": "analysis_module/appinfo/analysis.sh",
"chars": 93,
"preview": "#!/bin/bash\n \nsource /home/lyl/.bashrc\nRscript $(cd \"$(dirname \"$0\")\"; pwd)/appinfo.R $1 \n\n\n\n"
},
{
"path": "analysis_module/appinfo/appinfo.R",
"chars": 831,
"preview": "library(\"XML\")\n\nbashrc<-\"/home/lyl/.bashrc\"\nanalysername<-\"appinfo\"\nappinfo.list<-list() \n\nargs<-commandArgs(T)\nappname<"
},
{
"path": "analysis_module/appinfo/featureinfo.xml",
"chars": 418,
"preview": "<!--this is a file contain the analysis result for EnvGather features-->\n<features> \n <feature> \n <name>MD"
},
{
"path": "analysis_module/envinfo/EnvGather.R",
"chars": 3180,
"preview": "library(\"XML\")\n\nbashrc<-\"/home/lyl/.bashrc\"\n\nanalysername<-\"EnvGather\"\nenvlist<-list()\n\ncpuinfo<-system(\"lscpu\",intern ="
},
{
"path": "analysis_module/envinfo/analysis.sh",
"chars": 91,
"preview": "#!/bin/bash\n \nsource /home/lyl/.bashrc\nRscript $(cd \"$(dirname \"$0\")\"; pwd)/EnvGather.R\n\n\n\n"
},
{
"path": "analysis_module/envinfo/featureinfo.xml",
"chars": 2956,
"preview": "<!--this is a file contain the analysis result for EnvGather features--> <features> <feature> <name>Architecture<"
},
{
"path": "analysis_module/paktimer/Makefile",
"chars": 111,
"preview": "CXX=gcc\nINCLUDES=-I.\nCXXFLAGS=$(INCLUDES)\n\ndefault: \n\t$(CXX) paktimer.c -o paktimer \nclean::\n\t-rm -f paktimer\n"
},
{
"path": "analysis_module/paktimer/analysis.sh",
"chars": 424,
"preview": "#!/bin/bash\n#export ENABLE_PAKTIME=TRUE\nTIMEENABLE=`env |grep ENABLE_PAKTIME | grep TRUE`\nif [ $TIMEENABLE = \"ENABLE_PAK"
},
{
"path": "analysis_module/paktimer/featureinfo.xml",
"chars": 281,
"preview": "<features>\n <feature>\n <type>dynamic</type>\n <name>time</name>\n <description>the execution time "
},
{
"path": "analysis_module/paktimer/paktimer.c",
"chars": 450,
"preview": "#include <stdio.h>\n#include <sys/time.h>\nstruct timeval t1;\nstruct timeval t2;\n\nint main(int argc,char** argv)\n{\n FIL"
},
{
"path": "analysis_module/tau/analysis.sh",
"chars": 759,
"preview": "#!/bin/bash\nsource /home/lyl/.bashrc\nexport PATH=/home/lyl/tools/tau2.23_icpc_pdt_papi/x86_64/bin:$PATH\n\n\nexport TAU_MAK"
},
{
"path": "analysis_module/tau/featureinfo.xml",
"chars": 28851,
"preview": "<!--this is a file describe feature extracted by XXX--> \n<features> \n <feature> <name>P_WALL_CLOCK_TIME </name> "
},
{
"path": "analysis_module/tau/featureofPAPI.r",
"chars": 1546,
"preview": "library(XML)\n\npapi_str<-system(\"source ~/.bashrc; papi_avail\",intern=TRUE)\nstr(papi_str)\nbg<-FALSE\nfor(oneline in papi_s"
},
{
"path": "analysis_module/tau/outputformat.R",
"chars": 1078,
"preview": "library(\"XML\")\nanalysername<-\"tau\"\nmetrics.vec<- system(\"env |grep ENABLE\",intern = TRUE)\n\nmetrics.list<-list()\nfor(m in"
},
{
"path": "applications/multiplyexample.c",
"chars": 561,
"preview": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n#define DATATYPE float\n#define NX 3000\n#define NY 3000\n#define "
},
{
"path": "applications/result.xml",
"chars": 107,
"preview": "<features> \n <feature>\n <name>time</name>\n <value>1.7945</value>\n </feature> \n </features>\n"
},
{
"path": "framework/DBModule/functions.R",
"chars": 21263,
"preview": "OpenDB <- function() {\n # Open a SQL conn if the global.conn has not been initialized,\n # and save the conn to global."
},
{
"path": "framework/EvaluatorModule/Evaluator.R",
"chars": 1327,
"preview": "PAK.Evaluator<-setRefClass(\n \"PAK.Evaluator\",\n fields = list(sub.evaluators = \"list\",\n analysers.result"
},
{
"path": "framework/ExtractorModule/Analyze.old",
"chars": 1150,
"preview": "library(XML)\nInstanceAnaylze<-function(analyser,analyser.features,app,\n analysis_module.path=\"/"
},
{
"path": "framework/ExtractorModule/Extractor.R",
"chars": 885,
"preview": "PAK.Extractor<-setRefClass(\n \"PAK.Extractor\",\n fields = list(analysers = \"list\",\n analysers.results.sto"
},
{
"path": "framework/Interface/Analyser.R",
"chars": 2166,
"preview": "PAK.Analyser<-setRefClass(\n \"PAK.Analyser\",\n fields = list(app = \"character\",\n name = \"character\",\n "
},
{
"path": "framework/Interface/Generator.R",
"chars": 2095,
"preview": "library(\"methods\")\nPAK.Generator<-setRefClass(\n \"PAK.Generator\",\n fields = list(app = \"character\",\n nam"
},
{
"path": "framework/LearnerModule/Learner.R",
"chars": 295,
"preview": "# the Learner module\nPAK.Learner<-setRefClass(\n \"PAK.Learner\",\n fields = list(model=\"list\",dv.name=\"character\",\n "
},
{
"path": "framework/OptimizerModule/Optimizer.R",
"chars": 918,
"preview": "\nPAK.Optimizer<-setRefClass(\n \"PAK.Optimizer\",\n fields = list(generator.name =\"character\",\n generator= "
},
{
"path": "framework/ProducerModule/Producer.R",
"chars": 258,
"preview": "# a class to producer parameter\nPAK.Producer<-setRefClass(\n \"PAK.Producer\",\n fields = list(),\n methods = list(\n # "
},
{
"path": "framework/Tuning/Tuner.R",
"chars": 2926,
"preview": "library(\"methods\")\nPAK.Tuner<-setRefClass(\n \"PAK.Tuner\",\n fields = list(app = \"character\",\n extractor ="
},
{
"path": "framework/dependencies.R",
"chars": 98,
"preview": "library(\"XML\")\nlibrary(\"jsonlite\") \nlibrary(\"RODBC\")\nlibrary(\"methods\")\nprint(\"load dependencies\")"
},
{
"path": "framework/lib/OptimizationSpace.R",
"chars": 1266,
"preview": "GenerationParameterSpace<-function(parameter.list)\n{\n loop.str<-\"\"\n df.str<-\"\"\n for(i in 1:length(parameter.list))\n "
},
{
"path": "framework/lib/learners.R",
"chars": 534,
"preview": "# an decision tree learner\nPAK.Learner.DecisionTree<-setRefClass(\n \"PAK.Learner.DecisionTree\",\n contains=\"PAK.Learner\""
},
{
"path": "framework/lib/producers.R",
"chars": 5317,
"preview": " library(rpart)\n\nPAK.Producer.Exhaustion<-setRefClass(\n \"PAK.Producer.Exhaustion\",\n contains=\"PAK.Producer\",\n fields "
},
{
"path": "generator_module/optimizeCompilerFlag/transform.sh",
"chars": 314,
"preview": "#!/bin/bash\nCC=gcc\n#export ENABLE_COMPILERFLAG=\"-O3\"\nCFLAGENABLE=`env |grep ENABLE_COMPILERFLAG`\n FNAME=${CFLAGENABLE"
},
{
"path": "generator_module/optimizeCompilerFlag/variantinfo.xml",
"chars": 238,
"preview": "<variants>\n <variant>\n <name>compilerflag</name>\n <description>the compiler flag</description>\n "
},
{
"path": "pak.R",
"chars": 1578,
"preview": "path.analysis_tools<-\"/home/liujh/PAK-master/analysis_module/\"\npath.generator_tools<-\"/home/liujh/PAK-master/generator_m"
},
{
"path": "tutorial/autotuning_compilerflag.R",
"chars": 907,
"preview": "GetSourceFileDir<-function()\n{\n frame_files <- lapply(sys.frames(), function(x) x$ofile)\n frame_files <- Filter(Negate"
}
]
// ... and 3 more files (download for full content)
About this extraction
This page contains the full source code of the NCIC-PARALLEL/Graphine-SDK GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 40 files (91.9 KB), approximately 26.4k tokens, and a symbol index with 4 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.