Tau clang plugin: Difference between revisions
No edit summary |
mNo edit summary |
||
| Line 5: | Line 5: | ||
= Compilation and installation = | = Compilation and installation = | ||
As TAU relies on LLVM's Intermediate Representation, the TAU plugin is built upon an LLVM installation. If no installation is currently accessible LLVM's installation can be done by following these commands: | As TAU relies on LLVM's Intermediate Representation, the TAU plugin is built upon an LLVM installation. If no installation is currently accessible, LLVM's installation can be done by following these commands: | ||
<code> | <code> | ||
| Line 11: | Line 11: | ||
cd llvm-project/llvm | cd llvm-project/llvm | ||
mkdir build; cd build | mkdir build; cd build | ||
| Line 34: | Line 35: | ||
= Running it = | = Running it = | ||
The TAU plugin is a function pass, meaning it takes effect during the compilation of the executable to be instrumented. To do so, the compiling command resembles | The TAU plugin is a function pass, meaning it takes effect during the compilation of the executable to be instrumented. To do so, the compiling command resembles this: | ||
<code> | <code> | ||
Revision as of 19:28, 7 January 2021
Use
The aim of this plugin is to facilitate the use of TAU. Parsing a function-listing file, the TAU plugin runs a function pass on each function from the original source, adding them to be instrumented if the function-listing file specifies it.
Compilation and installation
As TAU relies on LLVM's Intermediate Representation, the TAU plugin is built upon an LLVM installation. If no installation is currently accessible, LLVM's installation can be done by following these commands:
git clone https://github.com/llvm/llvm-project.git
cd llvm-project/llvm
mkdir build; cd build
cmake ../../llvm -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$PWD/../install -DLLVM_ENABLE_PROJECTS="clang;mlir;polly;flang;libcxx;libcxxabi"
make -j install
That being done the plugin can be built upon LLVM:
git clone https://github.com/coti/tau-llvm-plugin.git
cd tau-llvm-plugin
mkdir build; cd build
cmake .. -DCMAKE_INSTALL_PREFIX=$PWD/../install -DLLVM_ROOT=/PATH/TO/LLVM/INSTALLATION/install
make -j install
Running it
The TAU plugin is a function pass, meaning it takes effect during the compilation of the executable to be instrumented. To do so, the compiling command resembles this:
/PATH/TO/LLVM/INSTALLATION/install/bin/clang -fplugin=/PATH/TO/PLUGIN/INSTALLATION/install/lib/TAU_Profiling.so -mllvm -tau-input-file=/PATH/TO/FUNCTION/LISTING/FILE/select.tau -ldl -L/PATH/TO/TAU/lib/SPECIFIC_TAU_INSTALLATION -lTAU -Wl,-rpath,/PATH/TO/TAU/lib/SPECIFIC_TAU_INSTALLATION -lm [project files]
That being done, execute the code by calling:
tau_exec -T clang,serial ./a.out
Then, to access the instrumentation results, call:
pprof
Packaging
Linux
Mac OS
brew install --build-from-source llvm