Rosetta
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
mpi_stderr.cc
Go to the documentation of this file.
1 // -*- mode:c++;tab-width:2;indent-tabs-mode:t;show-trailing-whitespace:t;rm-trailing-spaces:t -*-
2 // vi: set ts=2 noet:
3 //
4 // (c) Copyright Rosetta Commons Member Institutions.
5 // (c) This file is part of the Rosetta software suite and is made available under license.
6 // (c) The Rosetta software is developed by the contributing members of the Rosetta Commons.
7 // (c) For more information, see http://www.rosettacommons.org. Questions about this can be
8 // (c) addressed to University of Washington UW TechTransfer, email: license@u.washington.edu.
9 
10 /// @file utility/options/ScalarOption_T_.hh
11 /// @brief Program scalar-valued option abstract base class
12 /// @author Stuart G. Mentzer (Stuart_Mentzer@objexx.com)
13 /// @author Modified by Sergey Lyskov
14 
15 #ifdef USEMPI
16 #include <mpi.h> // Must go first
17 #endif
18 // Unit headers
20 
21 // C++ headers
22 #include <iostream>
23 #include <set>
24 
25 namespace utility {
26 namespace options {
27 
28 
29 void mpi_safe_std_err( std::string msg ) {
30 #ifdef __native_client__
31  throw( std::string( msg ) ); // exceptions provide a good mechanism to get the rror message back to where the browser can display it. stdout/stderr are useless here.
32 #endif
33 
34  int mpi_rank( 0 );
35 #ifdef USEMPI
36  /// Give a different RNG to each processor
37 
38  MPI_Comm_rank( MPI_COMM_WORLD, &mpi_rank );
39 #endif
40  if ( mpi_rank == 0 ) {
41  std::cerr << msg << std::endl;std::cerr.flush();
42  }
43 }
44 
45 }
46 }
47 
ocstream cerr(std::cerr)
Wrapper around std::cerr.
Definition: ocstream.hh:290
void mpi_safe_std_err(std::string msg)
Definition: mpi_stderr.cc:29
rule< Scanner, options_closure::context_t > options
Definition: Tag.cc:377
int mpi_rank()
Definition: mpi_util.cc:254
ocstream & flush()
Flush the stream.
Definition: ocstream.hh:143