GPUOpen-Tools / radeon_compute_profiler

The Radeon Compute Profiler (RCP) is a performance analysis tool that gathers data from the API run-time and GPU for OpenCLâ„¢ and ROCm/HSA applications. This information can be used by developers to discover bottlenecks in the application and to find ways to optimize the application's performance.
MIT License
85 stars 19 forks source link

Unable to profile some programs on linux (XXX is not a valid application) #2

Closed axeldavy closed 7 years ago

axeldavy commented 7 years ago

I'd like to profile some python application with rcprof on linux. The python application uses pyopencl.

I don't know exactly how rcprof checks if it can execute the input program, but apparently what it does it too restrictive: /opt/AMDAPP/CodeXL/rcprof -o "/tmp/test.csv" -p -w "/tmp/" /usr/bin/python2.7 test.py /usr/bin/python2.7 is not a valid application

Similarly if I make test.py executable with chmod +x and add the correct prefix in the file, /opt/AMDAPP/CodeXL/rcprof -o "/tmp/test.csv" -p -w "/tmp/" test.py fails similarly.

On linux, it should be sufficient to just check for the execution bit.

Some other programs are successfully profiled with rcprof, thus it's not a faulty installation.

chesik-amd commented 7 years ago

Currently, the profiler only supports valid ELF executables. I've logged a feature request so we can investigate adding support for scripts as well.

Also, I tried profiling /usr/bin/python2.7 and on my system (an Ubuntu 16.04 system), rcprof is able to profile it. I don't see the same "/usr/bin/python2.7 is not a valid application" error you reported.

axeldavy commented 7 years ago

I use archlinux.

Some applications get the "is not a valid application" error, some others don't. I figured out when I recompile applications I compiled a few months ago, they now get the "is not a valid application". I fail to find an explanation.

EDIT: with readelf It looks like the executable that get the error have the flag 'DYN' instead of 'EXEC'.

EDIT2: It looks like recent compilers have -pie default (which gives DYN). Enforcing -no-pie gives EXEC and rcprof runs. The correct fix should be have rcprof accept DYN too.

chesik-amd commented 7 years ago

There was a change included in v5.2 which relaxes the check for a valid ELF executable. Could you try the 5.2 release to see if it works better for you?

axeldavy commented 7 years ago

I confirm the issue is fixed with the last version of CodeXL (2.5).

I close the issue.