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
25 inline void pauseToAttach(MPI_Comm mpicomm)
26 {
27 Teuchos::RCP<Teuchos::Comm<int> > comm =
28 Teuchos::createMpiComm<int>(Teuchos::rcp(new Teuchos::OpaqueWrapper<MPI_Comm>(mpicomm)));
29 Teuchos::FancyOStream out(Teuchos::rcpFromRef(std::cout));
30 out.setShowProcRank(true);
31 out.setOutputToRootOnly(-1);
32
33 comm->barrier();
34
35 // try to get them to print out all at once
36 out << "PID = " << getpid() << std::endl;
37
38 if (comm->getRank() == 0)
39 getchar();
40 comm->barrier();
41 }
42
43 inline void pauseToAttach()
44 {
45 pauseToAttach(MPI_COMM_WORLD); // CHECK: ALLOW MPI_COMM_WORLD
46 }
47
48
49}
50
51#endif