environment.h
Go to the documentation of this file.
# ifndef _RHEO_ENVIRONMENT_H
# define _RHEO_ENVIRONMENT_H
//
// This file is part of Rheolef.
//
// Copyright (C) 2000-2009 Pierre Saramito <Pierre.Saramito@imag.fr>
//
// Rheolef is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// Rheolef is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Rheolef; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// =========================================================================
// AUTHOR: Pierre.Saramito@imag.fr
// DATE: 29 september 2015
namespace rheolef {
} // namespace rheolef
#include "rheolef/distributed.h"
#include <boost/optional.hpp>
namespace rheolef {
// [verbatim_environment_option]
struct environment_option_type {
static const int no_thread = 100;
// [verbatim_environment_option]
#ifdef _RHEOLEF_HAVE_MPI
// [verbatim_environment_option_cont]
static const int default_thread = MPI_THREAD_SINGLE;
// [verbatim_environment_option_cont]
#else // _RHEOLEF_HAVE_MPI
static const int default_thread = 0;
#endif // _RHEOLEF_HAVE_MPI
// [verbatim_environment_option_cont2]
environment_option_type() : thread_level (default_thread) {}
int thread_level ;
};
// [verbatim_environment_option_cont2]
#ifndef _RHEOLEF_HAVE_MPI
// [verbatim_environment]
class environment {
public:
environment (int& argc, char**& argv, const environment_option_type& opt = environment_option_type());
~environment();
// [verbatim_environment]
protected:
unsigned int _oldcw;
// [verbatim_environment_cont]
};
// [verbatim_environment_cont]
#else
class environment {
public:
explicit environment (int& argc, char**& argv, const environment_option_type& opt = environment_option_type());
~environment();
static bool initialized();
static bool finalized();
static void abort(int errcode);
static int max_tag();
static int collectives_tag();
static boost::optional<int> host_rank();
static boost::optional<int> io_rank();
static std::string processor_name();
private:
bool _rheolef_has_init;
unsigned int _oldcw;
static const int _num_reserved_tags = 1;
};
#endif // _RHEOLEF_HAVE_MPI
} // namespace rheolef
#endif // _RHEO_ENVIRONMENT_H
rheolef::environment
see the environment page for the full documentation
Definition: environment.h:115
rheolef::environment::processor_name
static std::string processor_name()
Definition: environment.cc:134
rheolef::environment::initialized
static bool initialized()
Definition: environment.cc:54
rheolef::environment::io_rank
static boost::optional< int > io_rank()
Definition: environment.cc:123
rheolef::environment::environment
environment(int &argc, char **&argv, const environment_option_type &opt=environment_option_type())
Definition: environment.cc:64
rheolef::environment::host_rank
static boost::optional< int > host_rank()
Definition: environment.cc:112
rheolef::environment::abort
static void abort(int errcode)
Definition: environment.cc:96
rheolef::environment::~environment
~environment()
Definition: environment.cc:89
rheolef::environment::max_tag
static int max_tag()
Definition: environment.cc:100
rheolef::environment::finalized
static bool finalized()
Definition: environment.cc:59
rheolef::environment::collectives_tag
static int collectives_tag()
Definition: environment.cc:108
rheolef
This file is part of Rheolef.
Definition: compiler_eigen.h:37
rheolef::environment_option_type
Definition: environment.h:85
rheolef::environment_option_type::thread_level
int thread_level
Definition: environment.h:97
rheolef::environment_option_type::no_thread
static const int no_thread
Definition: environment.h:86
rheolef::environment_option_type::environment_option_type
environment_option_type()
Definition: environment.h:96
rheolef::environment_option_type::default_thread
static const int default_thread
Definition: environment.h:90