ãã¹ããšãã©ãã«ã·ã¥ãŒãã£ã³ã°ã¯äžå¯æ¬ ã§ããããœãããŠã§ã¢éçºããã»ã¹ã®æãèå³æ·±ãéšåã§ã¯ãããŸããã ã«ãŒãã³ããèªåèªèº«ãåãé€ãããã«ã誰ãããã®ããã»ã¹ãèªååããããšããŠããŸãã ãŸããã¢ããªã±ãŒã·ã§ã³ã®æ©èœããã¹ãããããã«ç¹å¥ãªèªå®¶è£œãã¹ããäœæãããå Žåãäžè¬çãªã¿ã€ãã®ãšã©ãŒã®æ€çŽ¢ã¯ããããã«ãã£ãŠåžžã«ã«ããŒããããã®ããã¯ã»ã©é ãã§ãã ããšãã°ãã¡ã¢ãªãªãŒã¯ãããŒã¿ã®ç«¶åãªã©ãã¢ããªã±ãŒã·ã§ã³ããã§ãã¯ãããŠããŸããïŒ ãã®èšäºã§ã¯ãæŽæ°ãããInspector XE 2013ã2ã€ã®æ¹æ³ã§äœ¿çšããæ¹æ³ã説æããŸãã
- å®æçãªèªåãã¹ãïŒååž°ãã¹ãïŒã®å Žå
- ãããã¬ãŒãšãã¢ã«ãªã£ãŠããåé¡ã®åå ãæåã§æ€çŽ¢ããã«ã¯
Inspector XEãå¿ èŠãªã®ã¯ãªãã§ããïŒ
Inspector XEã¯ãIntel Parallel Studio XEã®ã³ãŒãæ£åœæ§åæããŒã«ã§ãããå¥ã®è£œåãšããŠãæäŸãããŸãã ãã®ç®çã¯ãã¡ã¢ãªãšã©ãŒïŒãªãŒã¯ãåæåãããŠããªãã¡ã¢ãªãžã®ã¢ã¯ã»ã¹ãªã©ïŒããã³ã¹ããªãŒã ã®çžäºäœçšïŒããŒã¿ã®ç«¶åããããããã¯ãªã©ïŒã«ãã£ãŠåŒãèµ·ããããåé¡ãæ€çŽ¢ããããšã§ãã ãã®å Žåãåé¡ã¯ããèªäœã蚌æããå¿ èŠã¯ãããŸãã-æœåšçãªãããããã¯ïŒãããããã¯ïŒãããå ŽåãInspector XEã¯ãããã°ã©ã ãããã³ã°ãããŠããªããŠããããèŠã€ããŸãïŒãã ããçºçããå¯èœæ§ã®ããã³ãŒããã©ã³ãã¯å®è¡ãããŠããŸãïŒã
ã€ã³ã¹ãã¯ã¿ãŒã¯åçåæã䜿çšããŸãã ãœãŒã¹ã³ãŒãã§ã¯ãªããå®è¡å¯èœãªããã»ã¹ãåæãããŸãã å®è¡äžãã€ã³ã¹ãã¯ã¿ãŒã¯ã¢ããªã±ãŒã·ã§ã³ã§çºçããŠããããšãã¡ã¢ãªã®å²ãåœãŠãšè§£æŸãã¹ã¬ããã®äœæãåæãªããžã§ã¯ãã®äœ¿çšãªã©ãåæãããã®åŸãèŠã€ãã£ãåé¡ã®ãªã¹ããããã°ã©ããŒã«æäŸããŸãã
å¥ã®åé¡ã«ã€ããŠã¯ããœãŒã¹ãã¥ãŒã§ããã«è©³ãã調ã¹ãããšãã§ããŸãã
ãœãŒã¹ã®éçåæããããŸãããIntelã³ã³ãã€ã©ãŒã«ãã£ãŠå®è¡ãããŸãã ãŸããInspector XEã¯ãåæçµæã衚瀺ãèŠèŠåããã£ã«ã¿ãªã³ã°ãåé¡ã®ã¹ããŒã¿ã¹ç®¡çãªã©ãå¯èœã«ããŸãã ãã®æçš¿ã§ã¯ããã®ãããã¯ã«ã€ããŠã¯è§ŠããŸããã
ãšããã§ãInspector XEã¯C / C ++ãCïŒãããã³Fortranã³ãŒãã§åäœããŸãã 2ã€ã®ãªãã¬ãŒãã£ã³ã°ã·ã¹ãã ã§äœ¿çšå¯èœïŒWindows *ããã³Linux *ã ã©ã¡ãã«ããGUIãšã³ãã³ãã©ã€ã³ã®2ã€ã®ã€ã³ã¿ãŒãã§ã€ã¹ããããŸãã ããã«ãWindowsã§ã¯Microsoft Visual Studio *ã«ãçµ±åãããŸãã
ååãšããŠãå®è¡å¯èœãã¡ã€ã«ã¯ãã¹ãŠæ€æ»ã§ããŸãã ãã ããåé¡ãæ€åºããå¯èœæ§ãé«ãããœãŒã¹ã³ãŒãã§ãããã確èªããããŸãæéããããªãããã«ãããã€ãã®æšå¥šäºé ããããŸãã
- / MDdã/ ZIã/ Odã¹ã€ããã§ã³ã³ãã€ã«ãã/ DEBUGããã³/ FIXEDïŒNOã§ãªã³ã¯ããŸãïŒMicrosoftã³ã³ãã€ã©ãŒãšãªã³ã«ãŒãäŸãšããŠäœ¿çšïŒã å€æ°ã®ãã€ããªãšãœãŒã¹ã³ãŒãã«ã¯ã·ã³ããªãã¯æ å ±ãå¿ èŠã§ãããInspector XEãã³ã³ãã€ã©ã«ãã£ãŠæ··ä¹±ããªãããã«æé©åããªãã«ããå¿ èŠããããŸãã
- ãã«ãã¹ã¬ãããšã©ãŒãèŠã€ããã«ã¯ãå¯èœã§ããã°ã¢ããªã±ãŒã·ã§ã³ã®è² è·ãæžãããŸãã ããšãã°ãå ¥åã®ãµã€ãºãæå°åããŸãã ããã¯æéãç¯çŽããŸã Inspector XEã¯ãããã°ã©ã ã®é床ãäœäžãããŸã-åçåæãšãã€ããªèšæž¬ã®ã³ã¹ãã æ€æ»å®ã¯ãããŒã®çžäºäœçšã§æœåšçãªåé¡ãæ¢ããŠãããããè² è·ãæžãããŠãçµæã«ã¯åœ±é¿ããŸããã
- ããã©ããããã¡ã¢ãªãšã©ãŒãæ€çŽ¢ããã«ã¯ãå®å šãªããŒã¿ã»ããã䜿çšããããšããå§ãããŸãã ãã®ã¿ã€ãã®ãšã©ãŒã§ã¯ãå®éã®åé¡ãæ€åºãããŸãã
- ã³ãŒãã®ããŸããŸãªãã©ã³ããã¢ã¯ãã£ãã«ãããã¹ããéžæããŸãã ã³ãŒããã©ã³ããå®è¡ãããªãå Žåã解æãããŸããã
èªåãã¹ã
Inspector XE-æ€èšŒããŒã«ã ãŸãããœãããŠã§ã¢ã®å質ãšå®å®æ§ãé«ãã¬ãã«ã§ç¶æããããã«ãæ€èšŒãå®æçã«å®è¡ããå¿ èŠããããŸãã ããšãã°ãå€éã®ååž°ãã¹ãäžã«ã€ã³ã¹ãã¯ã¿ãŒãå®è¡ã§ããŸãã ãããè¡ãã«ã¯ãããŒã«ã®ã³ãã³ãã€ã³ã¿ãŒãã§ã€ã¹ã䜿çšããŸãã Linux *ãšWindows *ã®Inspector XEã³ãã³ãã®æ§æã¯åãã§ãã Windowsã§ãã¹ãã¢ããªã±ãŒã·ã§ã³åæãéå§ããäŸïŒ
inspxe-cl -collect mi3 -knob resources=true -knob still-allocated-memory=true -knob stack-depth=16 -knob analyze-stack=true -- D:\tests\testapps\mem_error.exe
ã³ãã³ãã©ã€ã³ã¯åžžã«ã€ã³ã¹ãã¯ã¿ãŒèªäœã§å§ãŸããŸã-ãinspxe-clãã ã-collectãããŒã¯ãåæãå®è¡ããå¿ èŠãããããšã瀺ããã-mi3ã-åæã®ã¿ã€ãïŒã¡ã¢ãªãšã©ãŒã®æ€çŽ¢ããŸãã¯ãã¡ã¢ãªã®åé¡ã®ç¹å®ãïŒã ããã«ãåæã®ä»ã®ãã©ã¡ãŒã¿ãŒãšåæãããã¢ããªã±ãŒã·ã§ã³ãžã®ãã¹ããããŸãã ã³ãã³ããinspxe-cl -helpãã䜿çšããŠãå®å šãªæ§æãšãã©ã¡ãŒã¿ãŒã®ãã«ããå°å·ã§ããŸãã ããã«ãGUIã§æ¢ã«äœæ¥ããŠãããã³ãã³ãã©ã€ã³ã§åãåæãå®è¡ããå Žåã¯ãGUIã§æ§æãããåæã®æ¢è£œã®ã³ãã³ãã©ã€ã³ã圢æãããã³ãã³ãã©ã€ã³ããã¿ã³ããããŸãã
åæãå®äºãããšãInspector XEã¯çµæãã¡ã€ã«ãå«ããã©ã«ããŒãäœæããŸãã ãããã¯GUIã§è¡šç€ºã§ããLinuxã§åéãããçµæã¯å¥ã®Windowsãã·ã³ã§è¡šç€ºã§ããŸãïŒéãåæ§ã§ãïŒã ãã ããåçŽã«ã¹ã¯ãªããããåæãéå§ããçµæãæåã§è¡šç€ºããããšã¯å®å šãªèªååã§ã¯ãããŸããã ãããã£ãŠãã€ã³ã¹ãã¯ã¿ãŒã«ã¯ãæ€åºãããåé¡ã«é¢ããæ å ±ãšCLIã®æ å ±ãåºåããæ©èœããããŸãã
inspxe-cl -report problems -r D:\tests\testapps\r002mi3
P1: Error: Mismatched allocation/deallocation New Problem P1.1: Mismatched allocation/deallocation D:\tests\testapps\mem_error.cpp(48): Error X10: Allocation site: Function start: Module D:\tests\testapps\mem_error.exe D:\tests\testapps\mem_error.cpp(49): Error X9: Mismatched deallocation site: Function start: Module D:\tests\testapps\mem_error.exe P3: Error: Invalid memory access New Problem P3.1: Invalid memory access D:\tests\testapps\mem_error.cpp (40): Error X4: Allocation site: Function start: Module D:\tests\testapps\mem_error.exe D:\tests\testapps\mem_error.cpp (42): Error X5: Deallocation site: Function start: Module D:\tests\testapps\mem_error.exe D:\tests\testapps\mem_error.cpp (44): Error X3: Read: Function start: Module D:\tests\testapps\mem_error.exe
ãã¬ãŒã³ããã¹ããé©åã§ãªãå Žåã¯ãcsvã«ãšã¯ã¹ããŒãããããXML圢åŒã§å°å·ããŠãããããçš®é¡ã®Perlããã³Pythonã§è§£æã§ããŸãã
inspxe-cl -report problems âformat=xml -r D:\tests\r002mi3\
<?xml version="1.0" encoding="UTF-8"?> <pset id="P1" type="Mismatched allocation/deallocation" state="New" severity="Error"> <obs id="X1" type="Allocation site" state="New" severity="Error"> <stack id="10"> <frame id="" module=" D:\tests\testapps\mem_error.exe" file="D:\tests\testapps\mem_error.cppâ func="start" line="48"/> <frame id="" module=" D:\tests\testapps\mem_error.exe " file="D:\tests\testapps\mem_error.cppâ func="start1" line="84"/> <frame id="" module="C:\Windows\syswow64\kernel32.dllâ func="BaseThreadInitThunk" line="78792"/> </stack> </obs> <obs id="X2" type="Mismatched deallocation site" state="New" severity="Error"> <stack id="9"> <frame id="" module=" D:\tests\testapps\mem_error.exe " file="D:\tests\testapps\mem_error.cppâ func="start" line="49"/> <frame id="" module=" D:\tests\testapps\mem_error.exe " file="D:\tests\testapps\mem_error.cppâ func="start1" line="84"/> </stack> </obs> </pset>
倧èŠæš¡ãããžã§ã¯ãã§éåžžã«å€ãèŠãããããŸããŸãªåé¡ãããæ°ãã泚ç®ãã¹ãåé¡ãé€å€ããå¿ èŠããããŸãã Inspector XEã«ã¯ãåé¡ã«ã¹ããŒã¿ã¹ãå²ãåœãŠãæ©èœããããŸãïŒæ°èŠã確èªæžã¿ãä¿®æ£æžã¿ãªã©ïŒã ãããžã§ã¯ããå®æçã«æ€æ»ããå Žåããã€ããã¯ã¹ã¯äž»ã«èå³æ·±ããã®ã§ããæè¿ã®å€æŽä»¥æ¥ãäœãæ°ãããã®ã¯ãããŸãããïŒ ãã®å ŽåãInspector XEã¯ãç°ãªãèµ·åããã®åé¡ã«é¢ããæ å ±ãçµã¿åãããŠãå€æŽã®èŠçŽãæäŸã§ããŸãã
inspxe-cl âmerge-states D:\tests\r000mi3\ -r D:\tests\r001mi3\
inspxe-cl -report status -r D:\tests\r001mi3\
9 problem(s) found 3 Investigated 6 Not investigated Breakdown by state: 2 Confirmed 1 Not a problem 4 Not fixed 2 Regression
Inspector XEã¯ãæœåšçãªããã«ãã¹ã¬ãããšã©ãŒããèŠã€ããã®ã«éåžžã«åœ¹ç«ã¡ãŸãã ããŒã¿ã®ç«¶åã䌎ãåçŽãªC ++ã®äŸãèããŠã¿ãŸãããã ã«ãŒãã¯OpenMPã䜿çšããŠäžŠååãããŸãã å埩ã¹ããŒã¹ã¯å°ããªéšåã«åå²ããã䞊è¡ããŠå®è¡ã§ããŸãã
#pragma omp parallel for shared(j) for(i=0; i<MAX; i++) { printf("j=%d ", j++); } if(j != MAX) printf(âerror\nâ);
ãã®ã¬ãŒã¹ãæã çŸããããã«ã¯ãMAX> 100,000,000ã䜿çšããå¿ èŠãããããã¹ãã¯10å以äžããããŸããã Inspector XEã¯ãMAX = 10ããã³10ç§ã§ãã®ãããªåé¡ãæ€åºããŸãã æœåšçãªããŒã¿ç«¶åãæ¢ããŠããŸãã ãã¡ããããã®äŸã¯éåžžã«æŽç·ŽãããŠããŸããã説æã®ããã«äœ¿çšã§ããŸãã ãã®ãããªå Žåãæ€æ»å®ã¯ãã¹ãå®è¡ã®æå¹æ§ãé«ããŸã-åäœæéãããã«ããå€ãã®åé¡ãèŠã€ãããŸãã
æ€çŽ¢ãçµã蟌ãããã«ãããã€ãã®ã¢ããªã±ãŒã·ã§ã³ã¢ãžã¥ãŒã«ã®ã¿ãåæã§ããŸãã
inspxe-cl -collect mi1 -module-filter module1.dll,module2.dll -module-filter-mode exclude -- D:\tests\testapps\mem_error.exe
ã-module-filter-modeããã©ã¡ãŒã¿ãŒã¯ãæå®ãããã¢ãžã¥ãŒã«ãåæããé€å€ããïŒé€å€ïŒãããã®éã®å Žåããããã®ã¿ãåæããïŒå«ããïŒãã決å®ããŸãã
åããã»ã¹ãåæããå¿ èŠãããå Žå-ããšãã°ãã¢ããªã±ãŒã·ã§ã³ãã¹ã¯ãªããããèµ·åãããå Žåãã-executable-of-interestããªãã·ã§ã³ã䜿çšããŸãã
inspxe-cl -collect mi1 -executable-of-interest mem_error.exe -- D:\tests\testapps\startup_script.bat
æ€æ»å®ããåŸãããçµæã¯ãç°ãªãããŒã ã¡ã³ããŒã«ãã£ãŠäœ¿çšãããå ŽåããããŸãã çµæã転éããã«ã¯ãããšã¯ã¹ããŒãããªãã·ã§ã³ã䜿çšããŸãã çµæãããã€ãã®ãœãŒã¹ãšãšãã«1ã€ã®ã¢ãŒã«ã€ãã«ããã¯ãããããå¥ã®ãã·ã³ã§ã¯ãããžã§ã¯ãããã¡ã€ã«ãã¹ãªã©ãæ§æããå¿ èŠã¯ãããŸããã
inspxe-cl -export -archive-name my-new-archived_result.inspxez -include-sources -result-dir myRes
ããŒã ã¯ãŒã¯ã«ã¯ã次ã®å Žåã«ã圹ç«ã¡ãŸãã
- åé¡ã«é¢ããããã¹ãã¬ããŒããšã³ã¡ã³ããäœæããæ©èœ
- ç°ãªããŠãŒã¶ãŒã«ããçµæã®åæç·šéã«å¯Ÿããä¿è·
- äžè¬çãªæå¶ã«ãŒã«ã ããšãã°ãã€ã³ã¹ãã¯ã¿ãŒãå€éšã¢ãžã¥ãŒã«ïŒã·ã¹ãã ã©ã€ãã©ãªïŒã§ä¿®æ£ããäºå®ã®ãªãåé¡ãèŠã€ããå Žåããããæ確ã«ããŒã¯ããããšãã§ããŸã-çµæãè©°ãŸãããªãããã«æå¶ããŸãã æå¶ã«ãŒã«ã¯ãããŒã å šäœã«å ±éã®ç¹å¥ãªãã¡ã€ã«ã«ä¿åãããŸãã
ããã ãã§ã çŸåšãInspector XEã®èµ·åãšè§£æçµæã®è§£æããå€éãã¹ããå®è¡ããã¹ã¯ãªããã«çµ±åããããšã¯æ®ã£ãŠããŸãããããã¯ãã§ã«åå¥ã§ããããã®æçš¿ã§ã¯åãäžããŠããŸããã
ã€ã³ã¹ãã¯ã¿ãŒ+ãããã¬ãŒ= 2ã€ã®ã¹ããŒã ããŒã
Inspector XEã䜿çšãããã1ã€ã®ã¢ãã«ã¯ãåé¡ãæåã§æ€çŽ¢ããŠåé¡ã®æäžéšã«å°éããããšã§ãã ããããããã°ã©ã ã«ã¯äœããã®ãã°ããããŸã-æã ããªãŒãºãŸãã¯ã¯ã©ãã·ã¥ããŸãã ãŸãã¯ãæ€æ»å®ã«ããæ¯æ©ã®ãã¹ãã§ã察åŠããå¿ èŠãããæ°ããåé¡ãçºèŠãããŸããã ãŸãã¯ã座ã£ãŠäœæã®ä¿¡é Œæ§ãããäžåºŠç¢ºèªããããšã«ããŸããã
ãããã®å ŽåãInspector XEããããã¬ãŒãšçµ±åãããšåœ¹ç«ã¡ãŸãã ãã®æ©èœã¯ããã»ã©åã§ã¯ãªããããŒãžã§ã³2013ã§ç»å ŽããŸãããçŸæç¹ã§ã¯ãLinuxäžã®gdbããã³Intel Debuggerãããã¬ãŒãšWindows *äžã®Visual Studio Debuggerãšã®çµ±åããµããŒããããŠããŸãã
äžæãªåé¡ïŒã¢ããªã±ãŒã·ã§ã³ã®äžéšã«ãã°ãããå ŽåïŒãæ¢ããŠããå Žåã¯ãåæèšå®ã§[åé¡ãæ€åºããããšãã«ãããã¬ãŒãæå¹ã«ãã]ãéžæããŠããããã¬ãŒãšå ±ã«ã€ã³ã¹ãã¯ã¿ãŒãèµ·åããŸãã
ããã§ãåæãéå§ããŠåŸ æ©ããŸããåé¡ãæ€åºããããšããã«ãInspector XEã¯å®è¡ãåæ¢ãããããã¬ãŒã§æãäžããããšãã§ããŸãã ããã¯ãèŠã€ãã£ããã¹ãŠã®åé¡ã«å¯ŸããŠå®è¡ãããŸãã
å€éã®ãã¹ãäžã«æããã«ãªã£ãäœããã®ãã°ããã§ã«çã£ãŠããå Žåã¯ãã€ã³ã¹ãã¯ã¿ãŒã§åæçµæãéããåé¡ãå³ã¯ãªãã¯ããŠããã®åé¡ããããã°ããéžæããŸãã Inspector XEã¯åãåæãåã³éå§ããææãããåé¡ãåã³çŸãããšããã«ãçºçããå Žæã§ãããã°ã»ãã·ã§ã³ã«æ²¡é ããŸãã
ãã¬ãŒã¯ãã€ã³ããèšå®ãã3çªç®ã®ãªãã·ã§ã³ãéžæããŠãã€ã³ã¹ãã¯ã¿ãŒåææ§æã§ãããã¬ãŒãéå§ããããšãã§ããŸãã
ãã®å ŽåãInspector XEã¯ããã®ãã¬ãŒã¯ãã€ã³ãã§å®è¡ãåæ¢ãããŸã§äœãåæããŸããã ãŸãã[ãããã°]ã¡ãã¥ãŒïŒVisual StudioïŒã§[Inspector XEã§ç¶è¡]ãéžæãããšãå®è¡ã¯ç¶ç¶ãããŸãããæ€æ»ã¯è¡ãããŸãã ãã®åŸããã¹ãŠãæåã®ã·ããªãªã«åŸã£ãŠé²ã¿ãèŠã€ãã£ãåé¡ããšã«åæ¢ããŸãã ããã¯ãåææéãççž®ãããã®ã³ã³ããã¹ãã§éèŠã§ã¯ãªãã³ãŒãïŒããšãã°ãé·ãåæåïŒãé€å€ããããã«åœ¹ç«ã¡ãŸãã
ãŸãšã
Inspector XEã¯ãã¡ã¢ãªãšã©ãŒãšãã«ãã¹ã¬ããå®è¡ãèŠã€ããããã®æ±çšããŒã«ãšããŠæ©èœããŸãã åçåæã«ãããããªãè€éã§ãæ ¹æ·±ãåé¡ãæ€åºã§ããŸãã ãã®ãããåæäžã®ããã°ã©ã å®è¡æéã¯å€§å¹ ã«å¢å ããå¯èœæ§ããããŸãã Inspector XE 2013ã¯ãGUIã§ã®äœæ¥ãããªãããŒãªåé¡ã®æ ¹æ¬åå ã®çºèŠã«åœ¹ç«ã€ãããã¬ãŒãšã®çµã¿åãããããã³èªåæ€èšŒã®äž¡æ¹ã«äœ¿çšã§ããŸãã ãã ããã©ã¡ãã®å Žåããã³ãŒãã®å®å®æ§ãé«ããã®ã«åœ¹ç«ã¡ãŸããåé¡ãå€ããªãããããæ©ãè¡ãããã»ã©ãå®æããã¢ããªã±ãŒã·ã§ã³ã®ä¿¡é Œæ§ãé«ãŸããŸãã
Intel Inspector XE
Intel Parallel Studio XE 2013
Inspector XE 2013ããã¥ã¡ã³ã