1 / 17

TotalView Debugger

TotalView Debugger. Dr. Fabrizio Gala Dipartimento di Scienze di Base e Applicate Per l’Ingegneria – Sezione di Fisica Via Scarpa 14-16 00141 Rome , Italy. Outline. Starting TotalView on CRESCO Basic Debugging Root Window Stepping Toolbar Action Points Visualizing Arrays

torie
Download Presentation

TotalView Debugger

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. TotalViewDebugger Dr. Fabrizio Gala Dipartimento di Scienze di Base e Applicate Per l’Ingegneria – Sezione di Fisica Via Scarpa 14-16 00141 Rome, Italy

  2. Outline • StartingTotalView on CRESCO • BasicDebugging • RootWindow • Stepping Toolbar • ActionPoints • VisualizingArrays • Visualizing C++ Sturctures • MPI Debugging • MessageQueueGraph • MemoryMenagement • MemoryDebugging • SegmentationFaults • MemoryLeaks • Online Informations

  3. StartingTotalView on CRESCO Open a terminal throughFARO Compile the code todebug Load the TotalViewmodule Submit the job PARALLEL ENVIRONMENT http://www.cresco.enea.it/nx.html mpicc–g –O0 –omyprogram.xmyprogram.c ~/> moduleloadtotalview bsub–n#procs-I –a tv –q#queuetotalview#exe MPI TASK NUMBER

  4. RootWindow The RootWindowcontains a listofall the processes and threadsyou are currentlydebugging. ROOT WINDOW • T = sTopped • B = Breakpoint • E = Error • W = Watchpoint • R = Running • M = Mixed ACTION POINT ID NUMBER STATUS INFO : 4

  5. Stepping Toolbar • Go : run the program • Halt : pause the execution • Kill : ends the process • Restart : equal to Kill plus Go • Next : executes all code on a line (i.e. a subroutine call) • Step : executes the line • Out : run up to return of a subroutine • Run to : runs to a selected line 5

  6. ActionPoints To set anactionpoint, click on the linenumber in the source panel and thenchoosewhatkindofactionyouneed. SOURCE PANEL • The basicactionpoints are: • Breakpoint : stopsexecutionof the processesofthreadsthatreachit, • Evaluationpoint: executes a code fragmentwhenitisreached, • ProcessBarrier Point : holdeachprocesswhenitreaches the barrierpointuntilallprocess in the grouphavereached the barrir point 6

  7. VisualizingArrays STACK FRAME PANEL Afterhaving set a breakpoint, itispossibletohave a look inside a variable, bysimplyselecting the variable in the Stack Frame Panel and thendivingby a double-click. This can beusefulifonewantstoexplore a variableamongdifferentthreads. THREAD INDEX 7

  8. Visualizing C++ Structures Tocalculate the sizeofanyobjecttype, the compiler must take into account anyaddress alignmentthatmaybeneedtomeetefficiency or achitecturalconstraints. The compiler accomplishesthis task byinsertingunusedpaddingbytesbetweenmembersasneededtosatisfy the alignmentrequirements. Theremayalsobepadding at the end of a structuretoensureproperalignment in case the structureiseverusedasanelementofanarray. SelectingView > Paddinggives: CODE 8

  9. MessageQueueGraph (1) Tools > MessageQueueGraphdisplays a windowthatshows a graphicrepresentation of the state ofmessagequeue information. Thisgraphshowsyou the state ofyour program at a particularinstant. WARNING: WORKS only ON CRESCO 1 or 2 MPI MESSAGE TAG • GREENPendingSends • BLUEPendingReceives • REDUnespectedMsgs STATUS INFO : PROC ID 9 PSEUDO CODE

  10. MessageQueueGraph (2) • Pendingmessagesoften indicate that a process can'tkeep up with the amountof work itisexpectedtoperform.Thesemessages indicate placeswhereyoumaybeabletoimproveyourprogram'sefficiency. • Unexpectedmessages can indicate thatsomethingis wrong withyourprogrambecause the receivingprocessdoesn'tknowhowtoprocess the message. • Loops in the graphmay indicate deadlocks.( Cycles can behighlitedbyOptions > Cycle Detection) PSEUDO CODE DEADLOCK EXAMPLE 10

  11. MemoryDebugging (1) Select the Debug > EnableMemoryDebuggingcommandbeforestarting the program. When the programmakes a memoryrequest, MemoryScaperecords the stackframes thatexistedwhen the actionoccurred. MemoryScapestops the programexecutionwhenoneof the followingeventsoccurs: • Freeingmemorythatisalreadyfreed, • Freeing the wrong address • Freeeinganinteriorpointer, • Misaligningblocks WARNING: NOT WORKING correcltywithOpenMPIcompiledwithintel 11

  12. MemoryDebugging (2) MemoryUsage Chart Report displays the memoryoccupiedbyeachprocess: TEXT: The amountofmemoryusedforstoring the program'smachine code instructions. DATA: The amountofmemoryusedforstoring uninitialized and initialized data. HEAP: The amountofmemorycurrentlybeing usedfor data created at runtime (i.e. allocatedpointers). STACK: The amountofmemoryusedby the currentlyexecuting routine and all the routines in itsbacktrace. 12

  13. MemoryDebugging (3) Looking at how the programisusingmemorymay help in understandingwhereparallelization can beimproved. UNBALANCED MEMORY OCCUPANCY AMONG PROCESSES 13

  14. SegmentationFaults When aSegmentation Fault occurs,MemoryScapekeepstrackof the event, you can have a look at it in Debug > MemoryEventDetails) CODE 14

  15. In Leak Detection Reports > Source Report MemoryLeaks (1) A memoryleakoccurswhen the programincorrectlymenagesmemoryallocations. As a consequence, a memoryleak can diminish the performance byreducing the amountofavailablememory. Eventually, in the worst case, toomuchof the availablememorymaybecomeallocated and all or part of the system e stopsworkingcorrectly, the applicationfails, or the system slows down unacceptably. POINTERS ALLOCATION MEMORY PSEUDO CODE The instructionherefreesonly A, nottmp MEMORY LEAK 15

  16. MemoryLeaks (2) In Leak Detection Reports > Source Report in facttellsus : sizeof (double) 16

  17. Online Information TotalViewdocumentation can befoundhere: http://www.roguewave.com/support/product-documentation/totalview.aspx THANKS TO Prof. G. ZOLLO and Dr. A. SCHIAVI & THANK YOU TO EVERYBODY FOR THE ATTENTION 17

More Related