ParaToolsInc / taucmdr

Performance engineering for the rest of us.
http://www.taucommander.com
Other
29 stars 11 forks source link

Create a compat "discourage" warning when static serial apps are sampled w/o addtl instrumentation #236

Open zbeekman opened 7 years ago

zbeekman commented 7 years ago

EDIT (Tue Nov 7 22:02:06 UTC 2017): See John's comment below. This is intentional tau behavior. The best case scenario, at least for now, is to warn users about it. Leaving this issue open as a reminder to implement the warning.


I'm trying with the examples/pi directory. With stable tau (2.26.3) at compile time I get: incompatible redefinition of macro "TAU_ENABLED" (here is some debug output) BUT, at least nm reports tau symbols (nm serialPi | grep -i tau)

When using tau-nightly, as of this morning, the error goes away, but no profile data is produced, AND nm serialPi | grep -i tau produces NO output, so there are no tau symbols.

Here is the output when running the example using tau nightly, but neither stable tau nor nightly . produce profiles:

zbeekman@onyx10:~/Sandbox/taucmdr/examples/pi> tau -v ./serialPi
[DEBUG] Arguments: Namespace(command='./serialPi', options=[], verbose='DEBUG')
[DEBUG] Verbosity level: DEBUG
[DEBUG] ['./serialPi'] not recognized as a TAU command
[DEBUG] Unknown command ['./serialPi'] has no parent module: giving up.
[DEBUG] which(./serialPi) = '/p/home/zbeekman/Sandbox/taucmdr/examples/pi/serialPi'
[DEBUG] Trying shortcut: ['trial', 'create']
[DEBUG] tau trial create args: Namespace(cmd='./serialPi', cmd_args=[])
[DEBUG] Launcher: []
[DEBUG] Remainder: ['./serialPi']
[DEBUG] Launcher command: []
[DEBUG] Application commands: [['./serialPi']]
[DEBUG] Searching upwards from '/p/home/zbeekman/Sandbox/taucmdr/examples/pi' for '.tau'
[DEBUG] Located project storage prefix '/p/home/zbeekman/Sandbox/taucmdr/examples/pi/.tau'
[DEBUG] '/p/home/zbeekman/Sandbox/taucmdr/examples/pi/.tau/project.json' opened read-write
[DEBUG] Initialized project database '/p/home/zbeekman/Sandbox/taucmdr/examples/pi/.tau/project.json'
[DEBUG] Configuring experiment Onyx-serialPi-sample
[DEBUG] _CompilerInfo.find(command='ftn', family='Cray', role='MPI_FC'): ['(ftn, Cray, MPI_FC)']
[DEBUG] _CompilerInfo.find(command='ifort', family='Intel', role='Host_FC'): ['(ifort, Intel, Host_FC)']
[DEBUG] Checking subprocess output: [u'/opt/intel/compilers_and_libraries_2017.1.132/linux/bin/intel64/ifort', '--version', '-E']
[DEBUG] [u'/opt/intel/compilers_and_libraries_2017.1.132/linux/bin/intel64/ifort', '--version', '-E'] returned 0
[DEBUG] compilers[MPI_FC] = '/opt/cray/pe/craype/2.5.12/bin/ftn'
[DEBUG] _CompilerInfo.find(command='cc', family='Cray', role='SHMEM_CC'): ['(cc, Cray, SHMEM_CC)']
[DEBUG] _CompilerInfo.find(command='icc', family='Intel', role='Host_CC'): ['(icc, Intel, Host_CC)']
[DEBUG] Checking subprocess output: [u'/opt/intel/compilers_and_libraries_2017.1.132/linux/bin/intel64/icc', '--version', '-E']
[DEBUG] [u'/opt/intel/compilers_and_libraries_2017.1.132/linux/bin/intel64/icc', '--version', '-E'] returned 0
[DEBUG] compilers[SHMEM_CC] = '/opt/cray/pe/craype/2.5.12/bin/cc'
[DEBUG] _CompilerInfo.find(command='CC', family='Cray', role='SHMEM_CXX'): ['(CC, Cray, SHMEM_CXX)']
[DEBUG] _CompilerInfo.find(command='icpc', family='Intel', role='Host_CXX'): ['(icpc, Intel, Host_CXX)']
[DEBUG] Checking subprocess output: [u'/opt/intel/compilers_and_libraries_2017.1.132/linux/bin/intel64/icpc', '--version', '-E']
[DEBUG] [u'/opt/intel/compilers_and_libraries_2017.1.132/linux/bin/intel64/icpc', '--version', '-E'] returned 0
[DEBUG] compilers[SHMEM_CXX] = '/opt/cray/pe/craype/2.5.12/bin/CC'
[DEBUG] _CompilerInfo.find(command='ftn', family='Cray', role='SHMEM_FC'): ['(ftn, Cray, SHMEM_FC)']
[DEBUG] _CompilerInfo.find(command='ifort', family='Intel', role='Host_FC'): ['(ifort, Intel, Host_FC)']
[DEBUG] compilers[SHMEM_FC] = '/opt/cray/pe/craype/2.5.12/bin/ftn'
[DEBUG] _CompilerInfo.find(command='cc', family='Cray', role='MPI_CC'): ['(cc, Cray, MPI_CC)']
[DEBUG] _CompilerInfo.find(command='icc', family='Intel', role='Host_CC'): ['(icc, Intel, Host_CC)']
[DEBUG] compilers[MPI_CC] = '/opt/cray/pe/craype/2.5.12/bin/cc'
[DEBUG] _CompilerInfo.find(command='CC', family='Cray', role='MPI_CXX'): ['(CC, Cray, MPI_CXX)']
[DEBUG] _CompilerInfo.find(command='icpc', family='Intel', role='Host_CXX'): ['(icpc, Intel, Host_CXX)']
[DEBUG] compilers[MPI_CXX] = '/opt/cray/pe/craype/2.5.12/bin/CC'
[DEBUG] _CompilerInfo.find(command='ftn', family='Cray', role='Host_FC'): ['(ftn, Cray, Host_FC)']
[DEBUG] _CompilerInfo.find(command='ifort', family='Intel', role='Host_FC'): ['(ifort, Intel, Host_FC)']
[DEBUG] compilers[Host_FC] = '/opt/cray/pe/craype/2.5.12/bin/ftn'
[DEBUG] _CompilerInfo.find(command='cc', family='Cray', role='Host_CC'): ['(cc, Cray, Host_CC)']
[DEBUG] _CompilerInfo.find(command='icc', family='Intel', role='Host_CC'): ['(icc, Intel, Host_CC)']
[DEBUG] compilers[Host_CC] = '/opt/cray/pe/craype/2.5.12/bin/cc'
[DEBUG] _CompilerInfo.find(command='CC', family='Cray', role='Host_CXX'): ['(CC, Cray, Host_CXX)']
[DEBUG] _CompilerInfo.find(command='icpc', family='Intel', role='Host_CXX'): ['(icpc, Intel, Host_CXX)']
[DEBUG] compilers[Host_CXX] = '/opt/cray/pe/craype/2.5.12/bin/CC'
[DEBUG] Top-level directory in '/p/home/zbeekman/taucmdr/system/src/tau-nightly.tgz' is 'tau-nightly'
[DEBUG] Top-level directory in '/p/home/zbeekman/taucmdr/system/src/tau-nightly.tgz' is 'tau-nightly'
[DEBUG] Verifying TAU Performance System installation at '/p/home/zbeekman/taucmdr/system/tau/tau-nightly'
[DEBUG] tau installation at '/p/home/zbeekman/taucmdr/system/tau/tau-nightly' is valid
[DEBUG] UID: (b4aab9cf1aac42cb829e373878968111f99d0c1d): ['http://ftp.gnu.org/gnu/binutils/binutils-2.27.tar.gz', 'x86_64', 'CNL', u'8f116086', u'0a05a2f6']
[DEBUG] UID: (c0ba1d250d1553a850b9e7450631c446e70d42ef): ['http://www.cs.uoregon.edu/research/paracomp/tau/tauprofile/dist/libunwind-1.1.tar.gz', 'x86_64', 'CNL', u'8f116086', u'0a05a2f6']
[DEBUG] UID: (912bfd4db13e5d632bf9e55114d8a834fdff215a): ['x86_64', 'CNL', u'0a05a2f6', u'20c4bdcf', u'2977f11e', u'68bcfa58', u'745c5a4e', u'8f116086', u'b15e7edd', u'f0eeb88c', u'fab3e243', 'b4aab9cf', 'c0ba1d25', '64', '32']
[DEBUG] TAU tags: set(['912bfd4d', 'intel', 'mpi'])
[DEBUG] Searching for makefile with tags: set(['912bfd4d', 'intel', 'mpi'])
[DEBUG] Found makefiles: '['/p/home/zbeekman/taucmdr/system/tau/tau-nightly/craycnl/lib/Makefile.tau-intel-912bfd4d-mpi']'
[DEBUG] Incompatible tags: set(['ompt', 'scorep', 'shmem', 'openmp', 'opari', 'gomp'])
[DEBUG] Will not use makefiles containing tags: set(['ompt', 'scorep', 'shmem', 'openmp', 'opari', 'gomp'])
[DEBUG] /p/home/zbeekman/taucmdr/system/tau/tau-nightly/craycnl/lib/Makefile.tau-intel-912bfd4d-mpi has tags: set(['912bfd4d', 'intel', 'mpi'])
[DEBUG] /p/home/zbeekman/taucmdr/system/tau/tau-nightly/craycnl/lib/Makefile.tau-intel-912bfd4d-mpi contains desired tags: set(['912bfd4d', 'intel', 'mpi'])
[DEBUG] Found TAU makefile /p/home/zbeekman/taucmdr/system/tau/tau-nightly/craycnl/lib/Makefile.tau-intel-912bfd4d-mpi
[DEBUG] Found TAU makefile /p/home/zbeekman/taucmdr/system/tau/tau-nightly/craycnl/lib/Makefile.tau-intel-912bfd4d-mpi
[DEBUG] Checking dependency paths in '/p/home/zbeekman/taucmdr/system/tau/tau-nightly/craycnl/lib/Makefile.tau-intel-912bfd4d-mpi'
[DEBUG] Verifying libunwind installation at '/p/home/zbeekman/taucmdr/system/libunwind/c0ba1d25'
[DEBUG] libunwind installation at '/p/home/zbeekman/taucmdr/system/libunwind/c0ba1d25' is valid
[DEBUG] libunwind installation prefix is /p/home/zbeekman/taucmdr/system/libunwind/c0ba1d25
[DEBUG] Verifying GNU Binutils installation at '/p/home/zbeekman/taucmdr/system/binutils/b4aab9cf'
[DEBUG] binutils installation at '/p/home/zbeekman/taucmdr/system/binutils/b4aab9cf' is valid
[DEBUG] binutils installation prefix is /p/home/zbeekman/taucmdr/system/binutils/b4aab9cf
[DEBUG] TAU installation at '/p/home/zbeekman/taucmdr/system/tau/tau-nightly' is valid
[DEBUG] tau installation prefix is /p/home/zbeekman/taucmdr/system/tau/tau-nightly
[DEBUG] Verifying TAU Performance System installation at '/p/home/zbeekman/taucmdr/system/tau/tau-nightly'
[DEBUG] tau installation at '/p/home/zbeekman/taucmdr/system/tau/tau-nightly' is valid
[DEBUG] Checking dependency paths in '/p/home/zbeekman/taucmdr/system/tau/tau-nightly/craycnl/lib/Makefile.tau-intel-912bfd4d-mpi'
[DEBUG] TAU installation at '/p/home/zbeekman/taucmdr/system/tau/tau-nightly' is valid
[DEBUG] Verifying TAU Performance System installation at '/p/home/zbeekman/taucmdr/system/tau/tau-nightly'
[DEBUG] tau installation at '/p/home/zbeekman/taucmdr/system/tau/tau-nightly' is valid
[DEBUG] Checking dependency paths in '/p/home/zbeekman/taucmdr/system/tau/tau-nightly/craycnl/lib/Makefile.tau-intel-912bfd4d-mpi'
[DEBUG] TAU installation at '/p/home/zbeekman/taucmdr/system/tau/tau-nightly' is valid
[DEBUG] New trial number is 0
[DEBUG] Created directory '/p/home/zbeekman/Sandbox/taucmdr/examples/pi/.tau/taucmdr/Onyx-serialPi-sample/0'
[TAU]
[TAU] == BEGIN Onyx-serialPi-sample at 2017-11-07 13:53:41.467695 ===================================================================================================================
[TAU]
[TAU] PROFILEDIR=/p/home/zbeekman/Sandbox/taucmdr/examples/pi/.tau/taucmdr/Onyx-serialPi-sample/0
[TAU] SCOREP_ENABLE_TRACING=false
[TAU] TAU_CALLPATH=1
[TAU] TAU_CALLPATH_DEPTH=100
[TAU] TAU_CALLSITE=0
[TAU] TAU_COMM_MATRIX=0
[TAU] TAU_MERGE_METADATA=1
[TAU] TAU_METRICS=TIME,TIME,
[TAU] TAU_PROFILE=1
[TAU] TAU_SAMPLING=1
[TAU] TAU_THROTTLE=1
[TAU] TAU_THROTTLE_NUMCALLS=100000
[TAU] TAU_THROTTLE_PERCALL=10
[TAU] TAU_TRACE=0
[TAU] TAU_TRACK_HEAP=0
[TAU] TAU_TRACK_LOAD=0
[TAU] TAU_VERBOSE=1
[TAU] TRACEDIR=/p/home/zbeekman/Sandbox/taucmdr/examples/pi/.tau/taucmdr/Onyx-serialPi-sample/0
[TAU] ./serialPi
[DEBUG] Creating subprocess: cmd=['./serialPi'], cwd='/p/home/zbeekman/Sandbox/taucmdr/examples/pi'

libhugetlbfs [onyx10:78145]: WARNING: Hugepage size 2097152 unavailablePi is 3.14226
[DEBUG] ['./serialPi'] returned 0
[TAU]
[TAU] == END Onyx-serialPi-sample at 2017-11-07 13:53:41.754968 =====================================================================================================================
[TAU]
[DEBUG] Traceback (most recent call last):
  File "/p/home/zbeekman/taucmdr/bin/tau", line 70, in <module>
    sys.exit(cli_main_cmd.main(sys.argv[1:]))
  File "/p/home/zbeekman/taucmdr/bin/../packages/taucmdr/cli/commands/__main__.py", line 153, in main
    return cli.execute_command(shortcut, cmd_args)
  File "/p/home/zbeekman/taucmdr/bin/../packages/taucmdr/cli/__init__.py", line 310, in execute_command
    return main(cmd_args or [])
  File "/p/home/zbeekman/taucmdr/bin/../packages/taucmdr/cli/commands/trial/create.py", line 72, in main
    return Project.selected().experiment().managed_run(launcher_cmd, application_cmds, description)
  File "/p/home/zbeekman/taucmdr/bin/../packages/taucmdr/model/experiment.py", line 403, in managed_run
    return Trial.controller(self.storage).perform(proj, cmd, os.getcwd(), env, description)
  File "/p/home/zbeekman/taucmdr/bin/../packages/taucmdr/model/trial.py", line 242, in perform
    raise err
TrialError: Trial did not produce any profiles.

[TAU] XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
[TAU]
[TAU] CRITICAL
[TAU]
[TAU] Trial did not produce any profiles.
[TAU]
[TAU] Hint: Try `tau --help`
[TAU]
[TAU]
[TAU] Please check the selected configuration for errors or send '/p/home/zbeekman/.local/taucmdr/debug_log' to  <support@paratools.com> for assistance.
[TAU]
[TAU] XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Here are my loaded modules:

zbeekman@onyx10:~/Sandbox/taucmdr/examples/pi> module list
Currently Loaded Modulefiles:
  1) modules/3.2.10.6
  2) cray-mpich/7.6.2
  3) java/jdk1.8.0_51
  4) eproxy/2.0.14-4.3
  5) pbs
  6) ccm/2.4.1-357.125
  7) intel/17.0.1.132
  8) craype-broadwell
  9) craype-network-aries
 10) craype/2.5.12
 11) cray-libsci/17.09.1
 12) udreg/2.3.2-7.54
 13) ugni/6.0.15-2.2
 14) pmi/5.0.12
 15) dmapp/7.1.1-39.37
 16) gni-headers/5.0.11-2.2
 17) xpmem/2.1.1_gf9c9084-2.38
 18) job/2.1.1_gc1ad964-2.175
 19) dvs/2.7_2.1.71_g4f61690-1.0000.4f61690.4.9
 20) alps/6.3.4-2.21
 21) rca/2.1.6_g2c60fbf-2.265
 22) atp/2.1.1
 23) perftools-base/6.5.2
 24) PrgEnv-intel/6.0.4
 25) craype-hugepages2M
zbeekman commented 7 years ago

also, I tried removing the craype-hugepages2M module because I saw the runtime warning/error but then compilation fails.

nchaimov commented 7 years ago

In the debug output from 2.26.3, you're not using sampling, you're using source instrumentation: [DEBUG] Configuring experiment Onyx-serialPi-profile

Can you confirm that this worked with 2.26.3 with sampling rather than profiling?

zbeekman commented 7 years ago

I could have sworn that that I had selected sampling. I'll confirm again whether or not each work with tau-nightly and 2.26.3, stay tuned...

nchaimov commented 7 years ago

Assuming that it doesn't work in either 2.26.3 or nightly, what I think is wrong is that TAU Commander is linking the executable against TAU by using the TAU compiler wrappers with -optLinkOnly but nothing ever calls TAU. -optLinkOnly would work fine if the application used any libraries that TAU has wrappers for (MPI, pthreads, etc.), but since serialPi.cpp is serial, nothing in the application ever calls anything in TAU, so the symbols are unused and not included (and even if they were, without a use of a wrapper, nothing would ever call TAU_INIT, so sampling would not start.)

At least, that is my understanding of what happens with -optLinkOnly. I could be wrong.

zbeekman commented 7 years ago

Ah, interesting, so if I run mm under MPI then it will likely work, if that hypothesis is true. I could swear I've used sampling on a serial code, but it was a Fortran only code and I think I enable IO profiling too.

On Tue, Nov 7, 2017 at 3:41 PM Nicholas Chaimov notifications@github.com wrote:

Assuming that it doesn't work in either 2.26.3 or nightly, what I think is wrong is that TAU Commander is linking the executable against TAU by using the TAU compiler wrappers with -optLinkOnly but nothing ever calls TAU. -optLinkOnly would work fine if the application used any libraries that TAU has wrappers for (MPI, pthreads, etc.), but since serialPi.cpp is serial, nothing in the application ever calls anything in TAU, so the symbols are unused and not included (and even if they were, without a use of a wrapper, nothing would ever call TAU_INIT, so sampling would not start.)

At least, that is my understanding of what happens with -optLinkOnly. I could be wrong.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ParaToolsInc/taucmdr/issues/236#issuecomment-342615077, or mute the thread https://github.com/notifications/unsubscribe-auth/AAREPBeZtlSv4mqu3Om24AoSsBMPFm-Pks5s0MAygaJpZM4QU0sY .

jlinford commented 7 years ago

Oooooh this reminds me, I found this issue over a year ago. Sameer told me it's a feature, not a bug:

On 4/21/16:

Hi Sameer,

I discovered that I can force the link by replacing -ltau-intel with -Wl,--whole-archive,-ltau-intel,--no-whole-archive.  No nm -A shows TAU symbols in the executable, but setting TAU environment variables still has no effect:

nm -A ./a.out | grep TAU
./a.out:00000000008e2d54 D TAU_ALARM_TYPE
./a.out:0000000000419b00 T TAU_ALLOC
./a.out:0000000000418ef0 T TAU_CONTEXT_EVENT
./a.out:0000000000419e70 T TAU_DB_DUMP
./a.out:0000000000419e60 T TAU_DB_DUMP_PREFIX
./a.out:0000000000418be0 T TAU_DB_PURGE
./a.out:0000000000419c60 T TAU_DEALLOC
./a.out:0000000000418c60 T TAU_DISABLE_ALL_GROUPS
.......

export TAU_SAMPLING=1
export TAU_VERBOSE=1
./a.out
# No profiles, no TAU messages.

What should I try next?  Thanks,

~John C.

Hi John,
    Yes, we can say that they need to build dynamic if they want to sample uninstrumented serial code. For MPI codes, it is possible to link in the MPI wrapper and so we can instrument and sample. Looks like a bug with -optTrackIO with fwrite wrapper. 
    Thanks,
    - Sameer
zbeekman commented 7 years ago

@nchaimov definitely happens with tau 2.26.3, and judging from John's comment the best we can do is add a compat entry with Measurement.discourage (or exclude maybe?) when linkage is static and no MPI, IO, etc. is turned on. I may leave this open as a reminder to add a Measurement.discourage in the compat. (Actually it will have to be a custom callback checking heaps of things. I'm very tempted to just close this issue and walk quietly away...)

nchaimov commented 7 years ago

@zbeekman, yes it should work with MPI (so long as the application actually calls MPI_Init). Otherwise with a serial code we'd have to dynamically link it and then run it through tau_exec.

Enabling IO wrapping will work too, as that will cause the TAU symbols to be included and the IO wrapper initializes TAU when it intercepts the first call.

As @jlinford points out above, we can force the linker to include the symbols, but something still has to initialize TAU for TAU to do anything. With tau_exec, the LD_PRELOADed libTAU-preload.so initializes TAU when it is loaded by the dynamic linker as it has a constructor function, but I'm not sure if there's a way to do something equivalent with a static executable.