From 44c753661ac5f14de391c361bcc5b40b07c2c1d3 Mon Sep 17 00:00:00 2001
From: wfg <wfg@pc0098504.ornl.gov>
Date: Fri, 14 Oct 2016 15:40:13 -0400
Subject: [PATCH] Tested examples/hello/helloADIOS.cpp using MPI mode Changed
 Monitor function in ADIOS and Group so it can take an ostream Edited Makefile
 to allow nompi and full libraries Edited ./doc/Doxyfile to include more
 graphs

---
 Makefile                      | 40 +++++++++++++++++------------------
 doc/Doxyfile                  |  2 +-
 examples/hello/helloADIOS.cpp | 19 +++++++++++++----
 include/ADIOS.h               |  2 ++
 include/ADIOSFunctions.h      |  3 +++
 include/CGroup.h              |  2 ++
 include/CTransport.h          |  2 ++
 include/CVariable.h           |  3 ++-
 src/ADIOS.cpp                 | 17 ++++++---------
 src/ADIOSFunctions.cpp        |  2 ++
 src/CGroup.cpp                | 14 +++++++++---
 11 files changed, 67 insertions(+), 39 deletions(-)

diff --git a/Makefile b/Makefile
index 000cffe96..97a7a7503 100644
--- a/Makefile
+++ b/Makefile
@@ -5,20 +5,20 @@
      
 TOOL_DIR=/usr/bin
 
-CC=$(TOOL_DIR)/g++ # Compiling with mpicc for now
-#CC=$(TOOL_DIR)/clang # Compiling with mpicc for now
+#COMPILERS
+CC=$(TOOL_DIR)/g++
+ifeq($(CC),"clang")
+    CC=$(TOOL_DIR)/clang
+endif
 
 MPICC=$(TOOL_DIR)/mpic++
-
 AR=$(TOOL_DIR)/ar
 
 #FLAGS
 CFLAGS=-c -Wall -O0 -g -Wpedantic -std=c++11
 
-
 #INCLUDE FILES
 ADIOS_INC=-I./include
-
 INCLUDE=$(ADIOS_INC)
 
 #Build Header Dependencies, if one changes it will rebuild
@@ -36,32 +36,32 @@ NoMPI_ObjFiles=$(patsubst ./src/nompi/transport/%.cpp, ./bin/%.o, $(NoMPI_CPPFil
 
 Common_CPPFiles=$(wildcard ./src/*.cpp)
 Common_ObjFiles=$(patsubst ./src/%.cpp, ./bin/%.o, $(Common_CPPFiles))
- 
+NoMPI_Common_ObjFiles=$(patsubst ./src/%.cpp, ./bin/%_nompi.o, $(Common_CPPFiles)) # use for nompi
 
 ObjFiles=$(MPI_ObjFiles) $(NoMPI_ObjFiles)
 
 
 #Build all MPI and noMPI
 all: $(MPI_ObjFiles) $(NoMPI_ObjFiles) $(Common_ObjFiles) $(HFiles)
-	$(AR) rcs ./lib/libadios.a $(MPI_ObjFiles) $(NoMPI_ObjFiles) ./bin/ADIOS.o ./bin/ADIOSFunctions.o ./bin/CGroup.o
-
-#MPI build    
-mpi: $(MPI_ObjFiles) $(Common_ObjFiles) $(MPI_HFiles) $(Local_HFiles)
-	$(AR) rcs ./lib/libadios.a $(MPI_ObjFiles) ./bin/ADIOS.o ./bin/ADIOSFunctions.o ./bin/CGroup.o
-	
-./bin/%.o: ./src/mpi/transport/%.cpp
-	$(MPICC) $(CFLAGS) -DHAVE_MPI $(INCLUDE) -o $@ $< 
-	
-./bin/%.o: ./src/%.cpp
-	$(MPICC) $(CFLAGS) -DHAVE_MPI $(INCLUDE) -o $@ $<
+	$(AR) rcs ./lib/libadios.a $(MPI_ObjFiles) $(NoMPI_ObjFiles) $(Common_ObjFiles)
     
 #NoMPI build    
-nompi: $(NoMPI_ObjFiles) $(Common_ObjFiles) $(NoMPI_HFiles) $(Local_HFiles)
-	$(AR) rcs ./lib/libadios_nompi.a $(NoMPI_ObjFiles) $(Common_ObjFiles)
+nompi: $(NoMPI_ObjFiles) $(NoMPI_Common_ObjFiles) $(NoMPI_HFiles) $(Local_HFiles)
+	$(AR) rcs ./lib/libadios_nompi.a $(NoMPI_ObjFiles) $(NoMPI_Common_ObjFiles)
 	
 ./bin/%.o: ./src/nompi/transport/%.cpp $(NoMPI_HFiles) $(Local_HFiles)
 	$(CC) $(CFLAGS) $(INCLUDE) -o $@ $<
-	    
+	
+./bin/%_nompi.o: ./src/%.cpp $(NoMPI_HFiles) $(Local_HFiles)
+	$(CC) $(CFLAGS) $(INCLUDE) -o $@ $<
+	
+	
+clean_nompi:
+	rm ./bin/*_nompi.o ./lib/libadios_nompi.a
+
+clean_mpi:
+	rm ./bin/*.o ./lib/libadios.a
+
 clean:
 	rm ./bin/*.o ./lib/libadios.a ./lib/libadios_nompi.a
 	
diff --git a/doc/Doxyfile b/doc/Doxyfile
index f4d1ec3b4..a6c11c1bd 100644
--- a/doc/Doxyfile
+++ b/doc/Doxyfile
@@ -2424,4 +2424,4 @@ GENERATE_LEGEND = YES
 # The default value is: YES.
 # This tag requires that the tag HAVE_DOT is set to YES.
 
-DOT_CLEANUP = YES
+DOT_CLEANUP = NO
diff --git a/examples/hello/helloADIOS.cpp b/examples/hello/helloADIOS.cpp
index 56acfe785..547a2e18f 100644
--- a/examples/hello/helloADIOS.cpp
+++ b/examples/hello/helloADIOS.cpp
@@ -10,25 +10,36 @@
 #include <stdexcept>
 #include <mpi.h>
 #include <iostream>
+#include <fstream>
+#include <string>
 
 #include "ADIOS.h"
 
 
 int main( int argc, char* argv [] )
 {
+    MPI_Init( &argc, &argv );
+    int rank;
+    MPI_Comm_rank( MPI_COMM_WORLD, &rank );
+
     try
     {
-        MPI_Init( &argc, &argv );
-
         //testing with CPOSIXMPI
         adios::ADIOS adiosFile( "writer.xml", MPI_COMM_WORLD );
         adiosFile.Init( );
-        MPI_Barrier( MPI_COMM_WORLD );
 
+        //Get Monitor info
+        std::ofstream logStream( "info_" + std::to_string(rank) + ".log" );
+        adiosFile.MonitorGroups( logStream );
+
+        MPI_Barrier( MPI_COMM_WORLD );
     }
     catch( std::exception& e ) //need to think carefully how to handle C++ exceptions with MPI to avoid deadlocking
     {
-        std::cout << e.what() << "\n";
+        if( rank == 0 )
+        {
+            std::cout << e.what() << "\n";
+        }
     }
 
     MPI_Finalize( );
diff --git a/include/ADIOS.h b/include/ADIOS.h
index 825bb0dbe..f60bea7f4 100644
--- a/include/ADIOS.h
+++ b/include/ADIOS.h
@@ -8,9 +8,11 @@
 #ifndef ADIOS_H_
 #define ADIOS_H_
 
+/// \cond
 #include <string>
 #include <memory>
 #include <ostream>
+/// \endcond ///
 
 #ifdef HAVE_MPI
   #include <mpi.h>
diff --git a/include/ADIOSFunctions.h b/include/ADIOSFunctions.h
index 5b57869fa..58eb9949c 100644
--- a/include/ADIOSFunctions.h
+++ b/include/ADIOSFunctions.h
@@ -8,9 +8,12 @@
 #ifndef ADIOSFUNCTIONS_H_
 #define ADIOSFUNCTIONS_H_
 
+/// \cond
 #include <string>
 #include <vector>
 #include <map>
+/// \endcond
+
 
 #ifdef HAVE_MPI
 #include <mpi.h> //Just for MPI_Comm argument in SetMembersMPI
diff --git a/include/CGroup.h b/include/CGroup.h
index 018a021df..8d194e30f 100644
--- a/include/CGroup.h
+++ b/include/CGroup.h
@@ -8,11 +8,13 @@
 #ifndef CGROUP_H_
 #define CGROUP_H_
 
+/// \cond
 #include <map>
 #include <string>
 #include <memory> //for shared_pointer
 #include <vector>
 #include <ostream>
+/// \endcond
 
 #ifdef HAVE_MPI
 #include <mpi.h> //for MPI_Comm in overloaded SetTransform
diff --git a/include/CTransport.h b/include/CTransport.h
index 63de67c57..b29f2a1d8 100644
--- a/include/CTransport.h
+++ b/include/CTransport.h
@@ -8,7 +8,9 @@
 #ifndef CTRANSPORT_H_
 #define CTRANSPORT_H_
 
+///cond
 #include <string>
+///endcond
 
 #include "CVariable.h"
 
diff --git a/include/CVariable.h b/include/CVariable.h
index 5344f3833..f15192840 100644
--- a/include/CVariable.h
+++ b/include/CVariable.h
@@ -8,11 +8,12 @@
 #ifndef CVARIABLE_H_
 #define CVARIABLE_H_
 
+///cond
 #include <string>
 #include <vector>
 #include <typeinfo> // for typeid
 #include <sstream>
-
+///endcond
 
 namespace adios
 {
diff --git a/src/ADIOS.cpp b/src/ADIOS.cpp
index a2b55deba..91a471fbb 100644
--- a/src/ADIOS.cpp
+++ b/src/ADIOS.cpp
@@ -18,7 +18,7 @@
 namespace adios
 {
 
-//here assign default values of non-primitives
+
 ADIOS::ADIOS( )
 { }
 
@@ -36,14 +36,13 @@ ADIOS::ADIOS( const std::string xmlConfigFile, const MPI_Comm mpiComm  ):
 { }
 #endif
 
+
 ADIOS::~ADIOS( )
 { }
 
 
 void ADIOS::Init( )
 {
-    std::cout << "Just testing the Init Function\n";
-
     if( m_IsUsingMPI == false && m_XMLConfigFile.empty() == false )
     {
         InitNoMPI( );
@@ -68,8 +67,9 @@ void ADIOS::InitNoMPI( )
 #ifdef HAVE_MPI
 void ADIOS::InitMPI( )
 {
-    int rank;
+    int rank, size;
     MPI_Comm_rank( m_MPIComm, &rank );
+    MPI_Comm_size( m_MPIComm, &size );
 
     int xmlFileContentSize; // common
     std::string xmlFileContent;
@@ -78,9 +78,9 @@ void ADIOS::InitMPI( )
     {
         std::string xmlFileContent;
         DumpFileToStream( m_XMLConfigFile, xmlFileContent ); //in ADIOSFunctions.h dumps all XML Config File to xmlFileContent
-        xmlFileContentSize = m_XMLConfigFile.size( ) + 1; // add one for the null character
+        xmlFileContentSize = xmlFileContent.size( ) + 1; // add one for the null character
 
-        MPI_Bcast( &xmlFileContentSize, 1, MPI_INT, 0, m_MPIComm  ); //broadcast size
+        MPI_Bcast( &xmlFileContentSize, 1, MPI_INT, 0, m_MPIComm  ); //broadcast size for allocation
         MPI_Bcast( (char*)xmlFileContent.c_str(), xmlFileContentSize, MPI_CHAR, 0, m_MPIComm );
 
         SetMembers( xmlFileContent, m_HostLanguage,  m_Groups );
@@ -119,6 +119,7 @@ void ADIOS::MonitorGroups( std::ostream& logStream ) const
     }
 }
 
+
 void ADIOS::CheckGroup( const std::string groupName )
 {
     auto it = m_Groups.find( groupName );
@@ -126,8 +127,4 @@ void ADIOS::CheckGroup( const std::string groupName )
 }
 
 
-
 } //end namespace
-
-
-
diff --git a/src/ADIOSFunctions.cpp b/src/ADIOSFunctions.cpp
index e83428196..ae458f21d 100644
--- a/src/ADIOSFunctions.cpp
+++ b/src/ADIOSFunctions.cpp
@@ -5,10 +5,12 @@
  *      Author: wfg
  */
 
+///cond
 #include <fstream>
 #include <sstream>
 #include <stdexcept>
 #include <iostream>
+///endcond
 
 #include "ADIOSFunctions.h"
 #include "SSupport.h"
diff --git a/src/CGroup.cpp b/src/CGroup.cpp
index dcb47db68..effe3131f 100644
--- a/src/CGroup.cpp
+++ b/src/CGroup.cpp
@@ -107,13 +107,21 @@ void CGroup::SetTransport( const std::string method, const unsigned int priority
 
 void CGroup::Monitor( std::ostream& logStream ) const
 {
+    logStream << "\tVariable \t Type\n";
     for( auto& variablePair : m_Variables )
     {
-        logStream << "VarName:..." << variablePair.first << "  Type:..." << variablePair.second->m_Type << "\n";
+        logStream << "\t" << variablePair.first << " \t " << variablePair.second->m_Type << "\n";
     }
 
-    logStream << "Transport Method " << m_ActiveTransport << "\n";
-    logStream << std::ostream::boolalpha << "Transport Method Unique?: " << m_Transport.unique() << "\n";
+    logStream << "\tAttribute \t Type \t Value \n";
+    for( auto& attribute : m_Attributes )
+    {
+        logStream << "\t" << attribute.Name << " \t " << attribute.Type << " \t " << attribute.Value << "\n";
+    }
+
+
+    logStream << "\tTransport Method " << m_ActiveTransport << "\n";
+    logStream << "\tIs Transport Method Unique?: " << std::boolalpha << m_Transport.unique() << "\n";
 }
 
 
-- 
GitLab