Panzer Version of the Day
Loading...
Searching...
No Matches
Panzer_PauseToAttach.hpp
Go to the documentation of this file.
1// @HEADER
2// *****************************************************************************
3// Panzer: A partial differential equation assembly
4// engine for strongly coupled complex multiphysics systems
5//
6// Copyright 2011 NTESS and the Panzer contributors.
7// SPDX-License-Identifier: BSD-3-Clause
8// *****************************************************************************
9// @HEADER
10
11#ifndef PANZER_PAUSE_TO_ATTACH
12#define PANZER_PAUSE_TO_ATTACH
13
14#include "Teuchos_RCP.hpp"
15#include "Teuchos_DefaultMpiComm.hpp"
16#include "Teuchos_FancyOStream.hpp"
17
18#include <iostream>
19
20#include <sys/types.h>
21#include <unistd.h>
22
23namespace panzer {
24
33 inline void pauseToAttach(MPI_Comm mpicomm)
34 {
35 Teuchos::RCP<Teuchos::Comm<int> > comm =
36 Teuchos::createMpiComm<int>(Teuchos::rcp(new Teuchos::OpaqueWrapper<MPI_Comm>(mpicomm)));
37 Teuchos::FancyOStream out(Teuchos::rcpFromRef(std::cout));
38 out.setShowProcRank(true);
39 out.setOutputToRootOnly(-1);
40
41 comm->barrier();
42
43 // try to get them to print out all at once
44 out << "PID = " << getpid() << std::endl;
45
46 if (comm->getRank() == 0)
47 getchar();
48 comm->barrier();
49 }
50
52 inline void pauseToAttach()
53 {
54 pauseToAttach(MPI_COMM_WORLD); // CHECK: ALLOW MPI_COMM_WORLD
55 }
56
57
58}
59
60#endif
void pauseToAttach()
Calls pauseToAttach(MPI_Comm) with mpi comm world.