1© 2017 Rogue Wave Software, Inc. All Rights Reserved. 1
Approaches to
debugging mixed-
language HPC apps
Exhibitor Forum
SC17
2© 2017 Rogue Wave Software, Inc. All Rights Reserved. 2
Data modeling is critical for machine learning
• Data scientists iterate over huge datasets
• Legacy algorithms are critical
• Most popular languages
– R in scientific communities
– Python in engineering
• Focusing on Python
• Developers use it because
– Ease of use
– Clean syntax
– Extension libraries (many in C/C++)
3© 2017 Rogue Wave Software, Inc. All Rights Reserved. 3
Calling C/C++ from Python
• High performance libraries are written in C/C++ and Fortran
– Run faster
– Rewriting doesn’t make sense
– Advanced multi-threaded capabilities
• Fortunately there are many ways to call between the languages
4© 2017 Rogue Wave Software, Inc. All Rights Reserved. 4
Debugging multiple languages
• Debugging one language is difficult enough
– Especially with many threads/processes
• The language intersection is tougher
– Data comparison
– Glue code
• Issues are:
– Viewing data across language barriers
– Combined call stack
– Extraneous stack frames
5© 2017 Rogue Wave Software, Inc. All Rights Reserved. 5
Python Session Editor
Glue
code
Debugging Python Interpreter
6© 2017 Rogue Wave Software, Inc. All Rights Reserved. 6
Stopped in C/C++ Python Extension
Shows Python & C++
7© 2017 Rogue Wave Software, Inc. All Rights Reserved. 7
Stopped in C/C++ Python Extension
Shows Python & C++
8© 2017 Rogue Wave Software, Inc. All Rights Reserved. 8
Selected Python frame
C++
data
Python
Data
9© 2017 Rogue Wave Software, Inc. All Rights Reserved. 9
Data View
C++
data
Python
Data
10© 2017 Rogue Wave Software, Inc. All Rights Reserved. 10
Numpy
11© 2017 Rogue Wave Software, Inc. All Rights Reserved. 11
Python without filtering
Glue
code
No viewing of Python data and code
12© 2017 Rogue Wave Software, Inc. All Rights Reserved. 12
Python support in TotalView
• Designed for where Python calls C/C++ or vice versa
• Glue frames hidden from view
– Supported for SWIG
– User customizable
• Python information shown
– Code
– Data
13© 2017 Rogue Wave Software, Inc. All Rights Reserved. 13
Stack transformation facility
• Hides stack frames
• Transforms stack frames
• Backbone for:
– Python support
• Useful for any stack frames you want to hide
– Language differences
– Wrapper code
14© 2017 Rogue Wave Software, Inc. All Rights Reserved. 14
Demo
15© 2017 Rogue Wave Software, Inc. All Rights Reserved. 15
Few use cases
• Currently used with large scientific application at Lawrence
Livermore National Laboratory
• Helpful while learning or extending packages such as TensorFlow.
16© 2017 Rogue Wave Software, Inc. All Rights Reserved. 16
TensorFlow basics
• Open source
• Numerical computation
• Usage in machine learning
• Written in C++
– Called from Python
17© 2017 Rogue Wave Software, Inc. All Rights Reserved. 17
TensorFlow
Multithreaded application
Glue code removed
Added a rule for some wrappers
18© 2017 Rogue Wave Software, Inc. All Rights Reserved. 18
How does Rogue Wave help HPC?
TotalView debugger
• Troubleshooting and analysis tool
• Visibility into applications
• Control over applications
• Integrated Reverse Debugging
MemoryScape debugger
• Malloc API misuse
• Memory leaks
• Buffer overflows
• Invalid Read/Write
19© 2017 Rogue Wave Software, Inc. All Rights Reserved. 19
TotalView for HPC
• Comprehensive multi-core and multi-threaded analysis and debug environment
– Thread specific breakpoints
– Control individual thread execution
– View thread specific stack and data
– View complex data types easily
• Integrated Reverse debugging
• Mixed Language - Python C/C++
• Track memory leaks in running applications
• Supports C/C++ on Linux
• Active development for 30+ years
• Allowing the business to have
– Predictable development schedules
– Less time spent debugging
20© 2017 Rogue Wave Software, Inc. All Rights Reserved. 20
Summary
• Comments and questions
• Come see a live demo and learn more at our SC17 booth 1715
• For more information
– https://www.roguewave.com
– White Paper - https://www.roguewave.com/resources/white-
papers/mixed-language-debugging-python-c-cplusplus
– Videos - https://www.youtube.com/watch?v=LXSSstUdKnc
– Evaluation - https://www.roguewave.com/products-services/request-
evaluation
21© 2017 Rogue Wave Software, Inc. All Rights Reserved. 21

Approaches to debugging mixed-language HPC apps

  • 1.
    1© 2017 RogueWave Software, Inc. All Rights Reserved. 1 Approaches to debugging mixed- language HPC apps Exhibitor Forum SC17
  • 2.
    2© 2017 RogueWave Software, Inc. All Rights Reserved. 2 Data modeling is critical for machine learning • Data scientists iterate over huge datasets • Legacy algorithms are critical • Most popular languages – R in scientific communities – Python in engineering • Focusing on Python • Developers use it because – Ease of use – Clean syntax – Extension libraries (many in C/C++)
  • 3.
    3© 2017 RogueWave Software, Inc. All Rights Reserved. 3 Calling C/C++ from Python • High performance libraries are written in C/C++ and Fortran – Run faster – Rewriting doesn’t make sense – Advanced multi-threaded capabilities • Fortunately there are many ways to call between the languages
  • 4.
    4© 2017 RogueWave Software, Inc. All Rights Reserved. 4 Debugging multiple languages • Debugging one language is difficult enough – Especially with many threads/processes • The language intersection is tougher – Data comparison – Glue code • Issues are: – Viewing data across language barriers – Combined call stack – Extraneous stack frames
  • 5.
    5© 2017 RogueWave Software, Inc. All Rights Reserved. 5 Python Session Editor Glue code Debugging Python Interpreter
  • 6.
    6© 2017 RogueWave Software, Inc. All Rights Reserved. 6 Stopped in C/C++ Python Extension Shows Python & C++
  • 7.
    7© 2017 RogueWave Software, Inc. All Rights Reserved. 7 Stopped in C/C++ Python Extension Shows Python & C++
  • 8.
    8© 2017 RogueWave Software, Inc. All Rights Reserved. 8 Selected Python frame C++ data Python Data
  • 9.
    9© 2017 RogueWave Software, Inc. All Rights Reserved. 9 Data View C++ data Python Data
  • 10.
    10© 2017 RogueWave Software, Inc. All Rights Reserved. 10 Numpy
  • 11.
    11© 2017 RogueWave Software, Inc. All Rights Reserved. 11 Python without filtering Glue code No viewing of Python data and code
  • 12.
    12© 2017 RogueWave Software, Inc. All Rights Reserved. 12 Python support in TotalView • Designed for where Python calls C/C++ or vice versa • Glue frames hidden from view – Supported for SWIG – User customizable • Python information shown – Code – Data
  • 13.
    13© 2017 RogueWave Software, Inc. All Rights Reserved. 13 Stack transformation facility • Hides stack frames • Transforms stack frames • Backbone for: – Python support • Useful for any stack frames you want to hide – Language differences – Wrapper code
  • 14.
    14© 2017 RogueWave Software, Inc. All Rights Reserved. 14 Demo
  • 15.
    15© 2017 RogueWave Software, Inc. All Rights Reserved. 15 Few use cases • Currently used with large scientific application at Lawrence Livermore National Laboratory • Helpful while learning or extending packages such as TensorFlow.
  • 16.
    16© 2017 RogueWave Software, Inc. All Rights Reserved. 16 TensorFlow basics • Open source • Numerical computation • Usage in machine learning • Written in C++ – Called from Python
  • 17.
    17© 2017 RogueWave Software, Inc. All Rights Reserved. 17 TensorFlow Multithreaded application Glue code removed Added a rule for some wrappers
  • 18.
    18© 2017 RogueWave Software, Inc. All Rights Reserved. 18 How does Rogue Wave help HPC? TotalView debugger • Troubleshooting and analysis tool • Visibility into applications • Control over applications • Integrated Reverse Debugging MemoryScape debugger • Malloc API misuse • Memory leaks • Buffer overflows • Invalid Read/Write
  • 19.
    19© 2017 RogueWave Software, Inc. All Rights Reserved. 19 TotalView for HPC • Comprehensive multi-core and multi-threaded analysis and debug environment – Thread specific breakpoints – Control individual thread execution – View thread specific stack and data – View complex data types easily • Integrated Reverse debugging • Mixed Language - Python C/C++ • Track memory leaks in running applications • Supports C/C++ on Linux • Active development for 30+ years • Allowing the business to have – Predictable development schedules – Less time spent debugging
  • 20.
    20© 2017 RogueWave Software, Inc. All Rights Reserved. 20 Summary • Comments and questions • Come see a live demo and learn more at our SC17 booth 1715 • For more information – https://www.roguewave.com – White Paper - https://www.roguewave.com/resources/white- papers/mixed-language-debugging-python-c-cplusplus – Videos - https://www.youtube.com/watch?v=LXSSstUdKnc – Evaluation - https://www.roguewave.com/products-services/request- evaluation
  • 21.
    21© 2017 RogueWave Software, Inc. All Rights Reserved. 21