Arcane  4.2.3.0
Developer documentation
Loading...
Searching...
No Matches
TestMainMpi.cc
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2026 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
4// See the top-level COPYRIGHT file for details.
5// SPDX-License-Identifier: Apache-2.0
6//-----------------------------------------------------------------------------
7#include <gtest/gtest.h>
8
9#include "arccore/message_passing_mpi/MessagePassingMpiGlobal.h"
10#include "arccore/message_passing_mpi/StandaloneMpiMessagePassingMng.h"
11
12#include <iostream>
13
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17namespace AlinaTest
18{
19Arcane::Ref<Arcane::MessagePassing::IMessagePassingMng> global_message_passing_mng;
20}
21
22using namespace AlinaTest;
23
24namespace
25{
26char*** global_argv = nullptr;
27int* global_argc = 0;
28
29class MPIEnvironment
30: public ::testing::Environment
31{
32 public:
33
34 void SetUp() override
35 {
36 using Arcane::MessagePassing::Mpi::StandaloneMpiMessagePassingMng;
37 int thread_required = MPI_THREAD_SERIALIZED;
38 global_message_passing_mng = StandaloneMpiMessagePassingMng::createAndInitializeMPI(global_argc,global_argv, thread_required);
39 }
40 void TearDown() override
41 {
42 global_message_passing_mng.reset();
43 }
44};
45
46}
47
48/*---------------------------------------------------------------------------*/
49/*---------------------------------------------------------------------------*/
50
51int main(int argc, char* argv[])
52{
53 global_argc = &argc;
54 global_argv = &argv;
55 ::testing::InitGoogleTest(&argc, argv);
56 ::testing::AddGlobalTestEnvironment(new MPIEnvironment());
57 return RUN_ALL_TESTS();
58}
59
60/*---------------------------------------------------------------------------*/
61/*---------------------------------------------------------------------------*/
void reset()
Positions the instance to the null pointer.