Skip to content
Snippets Groups Projects
Commit 67340746 authored by Mikael Djurfeldt's avatar Mikael Djurfeldt
Browse files

Add mpi_utils.cc and music/mpi_utils.hh and include the latter

parent c98e6289
No related branches found
No related tags found
No related merge requests found
......@@ -5,6 +5,7 @@ ACLOCAL = $(top_srcdir)/aclocal.sh
lib_LTLIBRARIES = libmusic.la libmusic-c.la
libmusic_la_SOURCES = \
mpi_utils.cc music/mpi_utils.hh \
runtime.cc music/runtime.hh \
setup.cc music/setup.hh \
error.cc music/error.hh music/debug.hh \
......@@ -88,6 +89,6 @@ musicinclude_HEADERS = music/runtime.hh music/setup.hh \
music/message.hh music/music-config.hh \
music/predict_rank.hh music/predict_rank-c.h \
music/communication.hh music/version.hh \
music/memory.hh
music/memory.hh music/mpi_utils.hh
MKDEP = gcc -M $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
......@@ -30,6 +30,7 @@
#include <cstring>
#include "music/event.hh"
#include "music/mpi_utils.hh"
namespace MUSIC {
......
......@@ -31,6 +31,7 @@
#include <cstring>
#include "music/event.hh"
#include "music/mpi_utils.hh"
namespace MUSIC {
......
......@@ -22,6 +22,7 @@
#include <mpi.h>
#endif
#include "music/mpi_utils.hh"
#include "music/error.hh"
#include <iostream>
......
/*
* This file is part of MUSIC.
* Copyright (C) 2022 Mikael Djurfeldt
*
* MUSIC is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* MUSIC is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "music/mpi_utils.hh"
namespace MUSIC {
int
mpi_get_rank (MPI_Comm comm)
{
int rank;
MPI_Comm_rank (comm, &rank);
return rank;
}
int
mpi_get_size (MPI_Comm comm)
{
int size;
MPI_Comm_size (comm, &size);
return size;
}
int
mpi_get_size (MPI_Group group)
{
int size;
MPI_Group_size (group, &size);
return size;
}
int
mpi_get_size (MPI_Datatype type)
{
int size;
MPI_Type_size (type, &size);
return size;
}
MPI_Group
mpi_get_group (MPI_Comm comm)
{
MPI_Group group;
MPI_Comm_group (comm, &group);
return group;
}
}
/*
* This file is part of MUSIC.
* Copyright (C) 2022 Mikael Djurfeldt
*
* MUSIC is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* MUSIC is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MUSIC_MPI_UTILS_HH
#define MUSIC_MPI_UTILS_HH
#include "music/music-config.hh"
#if MUSIC_USE_MPI
#include <mpi.h>
namespace MUSIC
{
int mpi_get_rank (MPI_Comm comm);
int mpi_get_size (MPI_Comm comm);
int mpi_get_size (MPI_Group group);
int mpi_get_size (MPI_Datatype type);
MPI_Group mpi_get_group (MPI_Comm comm);
}
#endif /* MUSIC_USE_MPI */
#endif /* MUSIC_MPI_UTILS_HH */
......@@ -22,6 +22,7 @@
#include "music/music-config.hh"
#include "music/mpi_utils.hh"
#include "music/connector.hh"
#include <vector>
......
......@@ -29,6 +29,7 @@
#include <music/BIFO.hh>
#include <music/event.hh>
#include <music/message.hh>
#include <music/mpi_utils.hh>
namespace MUSIC {
......
......@@ -28,6 +28,7 @@
#include "music/array_data.hh"
#include "music/index_map_factory.hh"
#include "music/error.hh"
#include "music/mpi_utils.hh"
#include <cstring>
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment