Skip to content

Rust binding for the Intel FFI SEAPI for profiling. WIP

Notifications You must be signed in to change notification settings

mfournial/rvtune

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple Intel SEAPI bindings for Rust

The goal of this library is to have a minimalistic control wrapper for using vtune with rust code to be able to:

  • Create domains
  • Pause or resume control
  • Create tasks
    • Name
    • Begin / End

⚠️ This is a WIP. Documentation will likely be wrong / not work for you.

Usage

Shared library

To remember but delete later: how to make a shared library. See gcc help for more infos.

Have separate header and .c files (here test.h and test.c). Compile the .c file with position independent addresses

gcc -c -fPIC test.c -o test.o

Create shared library

gcc -shared test.o -o libtest.so

Move the library to somewhere the linker can see it by default (or use LD_LIBRARY_PATH)

sudo mv libtest.so /usr/lib/

And link the code properly in rust (no shared, dynamic, etc.)

println!("cargo:rustc-link-lib=test");

Static library

To create the static library:

gcc -c test.c -o test.o
ar rcs libtest.a test.o

As show in the code, can add flags in build.rs

println!("cargo:rustc-flags= -L intel_headers/test_headers");
println!("cargo:rustc-link-lib=static=test"); // with static

➡️ Can include for now the compiled libittnotify.a file and later on we can imagine submoduling the official intel repo and building the library in the build.rs stage automatically.

Limitations

This is the output of nm libittnotify.so | grep "pause". Not very promising if we want to use the pause function (lowercase indicates hidden functions).

0000000000002870 t __itt_pause_init_3_0
0000000000000120 D __itt_pause_ptr__3_0
0000000000000006 T ittnotify_mp_itt_pause_
                 U __itt_pause_ptr__3_0

I built manually the official IntelSEAPI and after installing it I got the same problems, in detail:

nm /opt/intel/lib/libittnotify64.a | grep "pause"
00000000000036d0 t __itt_pause_init_3_0
0000000000000440 D __itt_pause_ptr__3_0

About

Rust binding for the Intel FFI SEAPI for profiling. WIP

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages