Tau clang plugin: Difference between revisions

From OACISS Systems Wiki
Jump to navigation Jump to search
mNo edit summary
(Added misc issue solution for building LLVM 8 on x86 machines)
Line 37: Line 37:


make -j install
make -j install
</code>
*Miscellaneous issues and solutions*
On x86 architectures, LLVM 8 needs the following lines to be added to <code> llvm-project/llvm/include/llvm/Demangle/MicrosoftDemangleNodes.h </code> :
<code>
&#x23;include <cstdint>
&#x23;include <string>
</code>
</code>



Revision as of 22:09, 10 February 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. That means an LLVM install is needed, as well as a TAU install.

Note: LLVM and the TAU plugin must be compiled using the same compilers.

TAU installation

TAU installation is done by following these commands:

git clone https://github.com/UO-OACISS/tau2.git

cd tau2

./installtau -cc=clang -c++=clang++ -dwarf=download -bfd=download -iowrapper -iowrapper -otf=download

TAU records all configurations used to install it in the .allconfigs file. The last used configuration is stored in the .lastconfig file.

LLVM installation

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

  • Miscellaneous issues and solutions*

On x86 architectures, LLVM 8 needs the following lines to be added to llvm-project/llvm/include/llvm/Demangle/MicrosoftDemangleNodes.h  :


#include <cstdint>

#include <string>

Plugin installation

With LLVM installed, the plugin can be built upon it:

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