Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 356745

Summary: MPI Barrier Analysis fails for C++
Product: [Tools] PTP Reporter: Steven R. Brandt <sbrandt>
Component: PLDTAssignee: Beth Tibbitts <beth>
Status: RESOLVED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: beth
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Steven R. Brandt CLA 2011-09-05 13:24:57 EDT
MPI Barrier Analysis fails for C++, but this fact is not well documented and the error message is not particularly friendly (EmptyStackException in the log file).
Comment 1 Beth Tibbitts CLA 2011-09-06 17:09:41 EDT
What was happening was that only .c files were being fed thru resource collecting
RunAnalyseMPIAnalysiscommandHandler.resourceCollector (which builds some structures e.g. call graph that the rest of the analysis relies upon).
But the same gate (.c files only) wasn't used for the rest of the analysis,
so a stack was empty -- 
java.util.EmptyStackException    at java.util.Stack.peek(Stack.java:102)
   at org.eclipse.ptp.pldt.mpi.analysis.cdt.graphs.impl.CallGraph.RV_DFS(CallGraph.java:261)

While barrier analysis won't handle all the C++ apis it does appear to find some barriers and
barrier errors correctly; I'm trying to see if i can  reinstate some of the analysis on C++ files.
At least files with filetypes of .cpp as well as .c
Comment 2 Beth Tibbitts CLA 2011-09-06 18:19:57 EDT
I've checked in a change that at least will catch the stack exception so the analysis can continue.
Still doesn't communicate, except in the error in the console, what has happened.
So this way, it will continue processing in case there are some .c files;  non-.c file (.cpp, fortran, etc) files cause this error.  Need to investigate more later.
Comment 3 Beth Tibbitts CLA 2011-10-06 07:20:09 EDT
I found documentation to confirm that the barrier analysis was only designed to work with C (not C++).  Sorry.  If anyone else is interested in investigating this, I'm happy to discuss.
Comment 4 Beth Tibbitts CLA 2011-11-01 15:35:31 EDT
Should try to make it warn the user WHY it fails when it tries to process C++ files.   
Fix to catch EmptyStackException so that the analysis continues was fixed in HEAD.

Complicated to tell WHY the stack exception occurs (e.g. because one C++ file was found), but hopefully can look at it again later.  Question: what do to for a project that is mostly C files, but has say, a single C++ file?  Keep analysis going and ignore C++ files? Is that useful?
Comment 5 Beth Tibbitts CLA 2011-11-01 15:36:00 EDT
Reopening to hopefully look at this again for 6.0
Comment 6 Beth Tibbitts CLA 2012-06-07 12:09:31 EDT
Closing this bug as WONTFIX; if anyone has a preference or ideas on what to do if C++ files and C files are mixed, especially if they want to tackle this problem, let's revisit.