Commit bc373d0b authored by Mathieu Faverge's avatar Mathieu Faverge

Merge branch 'otf2' into 'master'

Otf2

This branch adds a basic support for the OTF2 trace format. The main interesting events are supported (function entry/exit, MPI P2P communication, metrics) and I was able to open medium-sized traces (up to 500MB) on my laptop (for larger traces, you'll need lots of RAM, or a few optimizations in the code).

The code is stable enough and ViTE is usable on most OTF2 traces, so I think it's time to merge it into the master branch.

See merge request !8
parents f5eb21fa e0a4a90a
......@@ -130,6 +130,8 @@ cmake_dependent_option(VITE_DBG_MEMORY_TRACE
### Trace format options
option(VITE_ENABLE_OTF
"Enable the support of OTF file format." OFF)
option(VITE_ENABLE_OTF2
"Enable the support of OTF2 file format." OFF)
option(VITE_ENABLE_TAU
"Enable the support of TAU file format." OFF)
......@@ -190,6 +192,10 @@ if(VITE_ENABLE_OTF)
find_package(OTF)
endif(VITE_ENABLE_OTF)
if(VITE_ENABLE_OTF2)
find_package(OTF2)
endif(VITE_ENABLE_OTF2)
if(VITE_ENABLE_TAU)
find_package(TAU)
endif(VITE_ENABLE_TAU)
......
#
# Find the OTF2 libraries and include dir
#
# OTF2_INCLUDE_DIR - Directories to include to use OTF2
# OTF2_LIBRARY - Files to link against to use OTF2
# OTF2_FOUND - When false, don't try to use OTF2
#
# OTF2_DIR can be used to make it simpler to find the various include
# directories and compiled libraries when OTF2 was not installed in the
# usual/well-known directories (e.g. because you made an in tree-source
# compilation or because you installed it in an "unusual" directory).
# Just set OTF2_DIR it to your specific installation directory
#
FIND_LIBRARY(OTF2_LIBRARY otf2
PATHS
/usr/lib
/usr/local/lib
${OTF2_DIR}/lib
)
IF(OTF2_LIBRARY)
GET_FILENAME_COMPONENT(OTF2_GUESSED_INCLUDE_DIR_tmp "${OTF2_LIBRARY}" PATH)
STRING(REGEX REPLACE "lib$" "include" OTF2_GUESSED_INCLUDE_DIR "${OTF2_GUESSED_INCLUDE_DIR_tmp}")
ENDIF(OTF2_LIBRARY)
FIND_PATH( OTF2_INCLUDE_DIR otf2/otf2.h
PATHS
${OTF2_GUESSED_INCLUDE_DIR}
${OTF2_DIR}/include
/usr/include
/usr/local/include
${CMAKE_SOURCE_DIR}/externals/otf2/include/
)
IF( OTF2_INCLUDE_DIR )
IF( OTF2_LIBRARY )
SET( OTF2_FOUND "YES" )
MARK_AS_ADVANCED( OTF2_DIR )
MARK_AS_ADVANCED( OTF2_INCLUDE_DIR )
MARK_AS_ADVANCED( OTF2_LIBRARY )
ENDIF( OTF2_LIBRARY )
ENDIF( OTF2_INCLUDE_DIR )
IF( NOT OTF2_FOUND )
MESSAGE("OTF2 installation was not found. Please provide OTF2_DIR:")
MESSAGE(" - through the GUI when working with ccmake, ")
MESSAGE(" - as a command line argument when working with cmake e.g. ")
MESSAGE(" cmake .. -DOTF2_DIR:PATH=/usr/local/otf ")
MESSAGE("Note: the following message is triggered by cmake on the first ")
MESSAGE(" undefined necessary PATH variable (e.g. OTF2_INCLUDE_DIR).")
MESSAGE(" Providing OTF2_DIR (as above described) is probably the")
MESSAGE(" simplest solution unless you have a really customized/odd")
MESSAGE(" OTF2 installation...")
SET(OTF2_DIR "" CACHE PATH "Root of OTF2 install tree." )
ENDIF( NOT OTF2_FOUND )
......@@ -296,6 +296,30 @@ IF(VITE_ENABLE_OTF)
ENDIF(VITE_ENABLE_OTF)
#############################################
# OTF2 Parser
#############################################
IF(VITE_ENABLE_OTF2)
ADD_DEFINITIONS(-DWITH_OTF2)
SET(VITE_HDRS
${VITE_HDRS}
parser/OTF2Parser/ParserDefinitionOTF2.hpp
parser/OTF2Parser/ParserEventOTF2.hpp
parser/OTF2Parser/ParserOTF2.hpp
)
SET(VITE_SRCS
${VITE_SRCS}
parser/OTF2Parser/ParserDefinitionOTF2.cpp
parser/OTF2Parser/ParserEventOTF2.cpp
parser/OTF2Parser/ParserOTF2.cpp
)
INCLUDE_DIRECTORIES(${OTF2_INCLUDE_DIR})
ENDIF(VITE_ENABLE_OTF2)
#############################################
# TAU Parser
#############################################
......@@ -411,6 +435,10 @@ IF( VITE_ENABLE_OTF )
LINK_DIRECTORIES( ${OTF_LIBRARY_DIR} )
ENDIF( VITE_ENABLE_OTF )
IF(VITE_ENABLE_OTF2)
LINK_DIRECTORIES(${OTF2_LIBRARY_DIR} )
ENDIF(VITE_ENABLE_OTF2)
#resource
IF(WIN32)
set(VITE_RES
......@@ -476,6 +504,18 @@ IF(VITE_ENABLE_OTF)
ENDIF(WIN32)
ENDIF(VITE_ENABLE_OTF)
IF(VITE_ENABLE_OTF2)
TARGET_LINK_LIBRARIES(vite
${OTF2_LIBRARY}
)
# if OTF2 is compiled with zlib support we need to add it
IF(WIN32)
TARGET_LINK_LIBRARIES(vite
${ZLIB_LIBRARY}
)
ENDIF(WIN32)
ENDIF(VITE_ENABLE_OTF2)
IF(VITE_ENABLE_TAU)
TARGET_LINK_LIBRARIES(vite
${TAU_LIBRARY}
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*
** This file is part of the ViTE project.
**
** This software is governed by the CeCILL-A license under French law
** and abiding by the rules of distribution of free software. You can
** use, modify and/or redistribute the software under the terms of the
** CeCILL-A license as circulated by CEA, CNRS and INRIA at the following
** URL: "http://www.cecill.info".
**
** As a counterpart to the access to the source code and rights to copy,
** modify and redistribute granted by the license, users are provided
** only with a limited warranty and the software's author, the holder of
** the economic rights, and the successive licensors have only limited
** liability.
**
** In this respect, the user's attention is drawn to the risks associated
** with loading, using, modifying and/or developing or reproducing the
** software by the user in light of its specific status of free software,
** that may mean that it is complicated to manipulate, and that also
** therefore means that it is reserved for developers and experienced
** professionals having in-depth computer knowledge. Users are therefore
** encouraged to load and test the software's suitability as regards
** their requirements in conditions enabling the security of their
** systems and/or data to be ensured and, more generally, to use and
** operate it in the same conditions as regards security.
**
** The fact that you are presently reading this means that you have had
** knowledge of the CeCILL-A license and that you accept its terms.
**
**
** ViTE developers are (for version 0.* to 1.0):
**
** - COULOMB Kevin
** - FAVERGE Mathieu
** - JAZEIX Johnny
** - LAGRASSE Olivier
** - MARCOUEILLE Jule
** - NOISETTE Pascal
** - REDONDY Arthur
** - VUCHENER Clément
**
*/
/**
* @file ParserOTF2.cpp
*
* @author Lagrasse Olivier
* @author Johnny Jazeix
* @author Mathieu Faverge
*
*/
#include <iostream>
#include <fstream>
#include <string>
#include <map>
#include <list>
/* -- */
#include <otf2/otf2.h>
/* -- */
#include "trace/values/Values.hpp"
#include "trace/EntityTypes.hpp"
#include "trace/Entitys.hpp"
#include "trace/Trace.hpp"
/* -- */
#include "parser/Parser.hpp"
#include "parser/OTF2Parser/ParserOTF2.hpp"
#include "parser/OTF2Parser/ParserDefinitionOTF2.hpp"
#include "parser/OTF2Parser/ParserEventOTF2.hpp"
/* -- */
using namespace std;
#define VITE_OTF_2_MAXFILES_OPEN 100
#define VITE_ERR_OTF_2_OPENREADER "Failed to create the OTF2 Reader\n"
ParserOTF2::ParserOTF2() {}
ParserOTF2::ParserOTF2(const string &filename) : Parser(filename) {}
ParserOTF2::~ParserOTF2() {}
void ParserOTF2::parse(Trace &trace,
bool finish_trace_after_parse) {
ParserDefinitionOTF2 *parserdefinition;
ParserEventOTF2 *parserevent;
OTF2_Reader *reader;
string filename = get_next_file_to_parse();
reader = OTF2_Reader_Open(filename.c_str());
if(reader == NULL) {
cerr << QObject::tr(VITE_ERR_OTF_2_OPENREADER).toStdString() << endl;
finish();
if(finish_trace_after_parse) { // true by default
trace.finish();
}
return;
}
parserdefinition = new ParserDefinitionOTF2(reader);
parserdefinition->set_handlers(&trace);
parserdefinition->read_definitions(reader);
parserdefinition->create_container_types(&trace);
parserdefinition->initialize_types(&trace);
#if DEBUG
parserdefinition->print_definitions();
#endif // DEBUG
parserevent = new ParserEventOTF2(reader);
parserevent->set_handlers(reader, &trace);
parserevent->read_events(reader);
// parserevent->read_markers(reader);
finish();
if(finish_trace_after_parse) { // true by default
trace.finish();
}
delete parserevent;
delete parserdefinition;
OTF2_Reader_Close(reader);
}
float ParserOTF2::get_percent_loaded() const {
// return ParserEventOTF::get_percent_loaded();
return 1;
}
/*
** This file is part of the ViTE project.
**
** This software is governed by the CeCILL-A license under French law
** and abiding by the rules of distribution of free software. You can
** use, modify and/or redistribute the software under the terms of the
** CeCILL-A license as circulated by CEA, CNRS and INRIA at the following
** URL: "http://www.cecill.info".
**
** As a counterpart to the access to the source code and rights to copy,
** modify and redistribute granted by the license, users are provided
** only with a limited warranty and the software's author, the holder of
** the economic rights, and the successive licensors have only limited
** liability.
**
** In this respect, the user's attention is drawn to the risks associated
** with loading, using, modifying and/or developing or reproducing the
** software by the user in light of its specific status of free software,
** that may mean that it is complicated to manipulate, and that also
** therefore means that it is reserved for developers and experienced
** professionals having in-depth computer knowledge. Users are therefore
** encouraged to load and test the software's suitability as regards
** their requirements in conditions enabling the security of their
** systems and/or data to be ensured and, more generally, to use and
** operate it in the same conditions as regards security.
**
** The fact that you are presently reading this means that you have had
** knowledge of the CeCILL-A license and that you accept its terms.
**
**
** ViTE developers are (for version 0.* to 1.0):
**
** - COULOMB Kevin
** - FAVERGE Mathieu
** - JAZEIX Johnny
** - LAGRASSE Olivier
** - MARCOUEILLE Jule
** - NOISETTE Pascal
** - REDONDY Arthur
** - VUCHENER Clément
**
*/
/**
* @file ParserOTF2.hpp
*
* @brief the implementation of Parser for OTF2 traces.
*
* @author Lagrasse Olivier
* @author Johnny Jazeix
* @author Mathieu Faverge
*
*/
#ifndef PARSEROTF2_HPP
#define PARSEROTF2_HPP
/*!
*
* \class ParserOTF2
* \brief parse the input data format of OTF2.
*
*/
class ParserOTF2 : public Parser {
private:
ParserOTF2(const ParserOTF2 &);
public:
/*!
* \fn ParserOTF2()
*/
ParserOTF2();
ParserOTF2(const std::string &filename);
~ParserOTF2();
/*!
* \fn parse(Trace &trace, bool finish_trace_after_parse = true)
* \param trace : the structure of data to fill
* \param finish_trace_after_parse boolean set if we do not have to finish the trace after parsing
*/
void parse(Trace &trace,
bool finish_trace_after_parse = true);
/*!
* \fn get_percent_loaded() const
* \brief return the size of the file already read.
* \return the scale of the size already loaded of the file by the parser. (between 0 and 1)
*/
float get_percent_loaded() const;
};
#endif // PARSEROTF2_HPP
......@@ -74,6 +74,11 @@
#endif
#endif //VITE_ENABLE_OTF
#ifdef WITH_OTF2
#include <otf2/otf2.h>
#include "parser/OTF2Parser/ParserOTF2.hpp"
#endif //WITH_OTF2
#ifdef VITE_ENABLE_TAU
#include <TAU_tf.h>
#include "parser/TauParser/ParserTau.hpp"
......@@ -118,6 +123,14 @@ bool ParserFactory::create(Parser **parser,
*Message::get_instance() << "OTF parser was not compiled. Use parser Paje by default" << Message::endw;
return false;
#endif //VITE_ENABLE_OTF
}
else if( ext == ".otf2" ) {
#ifdef WITH_OTF2
*parser = new ParserOTF2(filename);
#else
*Message::get_instance() << "OTF2 parser was not compiled. Use parser Paje by default" << Message::endw;
return false;
#endif //WITH_OTF2
}
else if( (ext == ".trc") || (ext == ".edf") ) {
#ifdef VITE_ENABLE_TAU
......
......@@ -57,6 +57,7 @@
#include <QPainter>
#define GLM_FORCE_RADIANS
#include <glm/glm.hpp>
#define GLM_ENABLE_EXPERIMENTAL
#include <glm/gtx/transform.hpp>
#include <glm/gtc/type_ptr.hpp>
//#include <ft2build.h>
......
......@@ -269,7 +269,6 @@ void Trace::define_link_type(Name &name,
if (source && destination) {
LinkType *lt = new LinkType(name, ancestor, source, destination, opt);
_link_types.insert( pair<std::string, LinkType*>(name.get_alias(), lt) );
#if defined(USE_ITC) && defined(BOOST_SERIALIZE)
Serializer<EntityType>::Instance().setUid(lt);
#endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment