Running Intel® Inspector on Applications Launched from Scripts

ID 660156
Updated 4/16/2019
Version Latest
Public

author-image

By

Problem:

Running Intel® Inspector on a script that launches and provides input to the application of interest produces the message

Error: Cannot find analysis results. Suggestion: Make sure that application launched your executable of interest

 

Example:

The python file a.py is used to start the executable of interest, test_memory:

import os
os.system("./test_memory")

Running Inspector on it produces an error:

> inspxe-cl -collect mi3 -executable-of-interest test_memory -- python a.py
Error: Cannot find analysis results. Suggestion: Make sure that application launched your executable of interest test_memory

 

Root Cause:

When the script uses the system call to launch the target process, it might run in another shell. Inspector cannot profile a target application which runs in a different shell than the launched application (in this case, python a.py).

 

Solution:

Ensure that the application is launched in the same shell as the called script.

  • For a shell script, the problem can be fixed by removing the "#!/bin/sh" line.
  • For a Python script, the issue can be resolved by using a subroutine call:
    import subprocess
    subprocess.call("./test_memory")