mptensor v0.5.1
Parallel Library for Tensor Network Methods
Loading...
Searching...
No Matches
mpi.hpp
Go to the documentation of this file.
1/*
2 mptensor - Parallel Library for Tensor Network Methods
3
4 Copyright 2016 Satoshi Morita
5
6 mptensor is free software: you can redistribute it and/or modify it
7 under the terms of the GNU Lesser General Public License as
8 published by the Free Software Foundation, either version 3 of the
9 License, or (at your option) any later version.
10
11 mptensor is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public
17 License along with mptensor. If not, see
18 <https://www.gnu.org/licenses/>.
19*/
20
31#ifndef _MPTENSOR_MPI_HPP_
32#define _MPTENSOR_MPI_HPP_
33
34#ifndef _NO_MPI
35#include <mpi.h>
36#endif
37
38namespace mptensor {
39namespace mpi {
40
41#ifdef _NO_MPI
42using comm_type = int;
43extern const comm_type MPI_COMM_WORLD;
44#else
46#endif
47
48extern int rank;
49extern int size;
50extern bool is_root;
51
52void initialize(int argc, char **argv);
53void finalize();
54void barrier(const comm_type &comm);
55void get_info(const comm_type &comm, int &rank, int &size, bool &is_root);
56
57} // namespace mpi
58} // namespace mptensor
59
60#endif // _MPTENSOR_MPI_HPP_
std::complex< double > complex
Definition complex.hpp:38
void initialize(int argc, char **argv)
True if the calling process is the root (rank 0), false otherwise.
Definition mpi.cc:70
void finalize()
Finalize MPI environment.
Definition mpi.cc:83
MPI_Comm comm_type
Definition mpi.hpp:45
int size
Rank of the calling process in the communicator.
Definition mpi.cc:61
void get_info(const comm_type &comm, int &rank, int &size, bool &is_root)
Get MPI information: rank, size, and whether the process is the root.
Definition mpi.cc:102
int rank
Type for MPI communicator.
Definition mpi.cc:60
void barrier(const comm_type &comm)
Barrier synchronization among processes in the communicator.
Definition mpi.cc:93
bool is_root
Number of processes in the communicator.
Definition mpi.cc:62
Definition complex.hpp:34