-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OMPT-annotations #45
Comments
Interesting. One way is to check if the TSan runtime is linked in. |
With clang, the tsan runtime is linked statically. So, I don't know how this might work at runtime. |
The problem is that we could have a program that only has some parts/sources/modules/libraries built with the instrumentation, and some that are not. With tsan we could even have the Tsan runtime running and zero instrumented files and Tsan would still catch problems using the interceptors, but I guess that's not the case for OpenMP programs so one of the previous solution should work. |
dlsym only works if the application is built with -rdynamic (see the earlier mail to Alex). |
Even if you are looking for symbols from other libraries? I thought it was just a problem with the OMPT symbols |
You can use A better solution would be for TSan itself leave a mark to program header somewhere for the programming model add-on like ours to check. I think PT_NOTE section seems promising. https://linux.die.net/man/5/elf One could prototype this in clang or direct ask Sanitizer folks whether they already have something like this? |
@dongahn why nm or BFD would be heavyweight? It's just a one time check at the OMPT initialization, it shouldn't add that much overhead. I don't think TSan leave any mark in the program header, but I could ask. |
True. But I'm just concerned about having to deal with a large executable. Instead if this is encoded in the program header of the main executable, perhaps we can write a code to only get to the small memory segment... |
The TSan annotation interface has a RunningOnValgrind function. I couldn't find documentation on the semantics of the function. But I think, a similar function RunningOnTSan that returns true would be helpful. By implementing this function weak in the tool returning false, it would be easy to decide whether TSan is there or not. |
@jprotze: yes this would be another good - even a more reliable way to check the presence of TSan. |
we can create such Annotation if missing and if it works we can try to propose it to the LLVM folks |
I think, I found a side-effect solution for this: we use a weak implementation of RunningOnValgrind, that changes a static variable in our tool. If TSan is there, the provided RunningOnValgrind function would not change this variable. |
@jprotze yes that would totally work. |
@jprotze I tried RunningOnValgrind and it does not get called by Tsan. |
@simoatze I just pushed my idea of the workflow to the RunningOnValgrind branch. |
@jprotze Looks good. Maybe add |
Can we detect in the initialization of the OMPT-tool, whether the application is built with TSan or not?
If that would be possible, we could avoid to register the callbacks and remove the potential overhead. This would be a good step for pushing Archer upstream in the long run.
The text was updated successfully, but these errors were encountered: