Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Podhorszki, Norbert
ADIOS2
Commits
65c4a1a4
Unverified
Commit
65c4a1a4
authored
Mar 03, 2020
by
Atkins, Charles Vernon
Committed by
GitHub
Mar 03, 2020
Browse files
Merge pull request #2011 from bradking/comm-mpi-ownership
helper: Do not always duplicate MPI_Comm on Comm construction
parents
dab81f1d
00d5f840
Changes
12
Hide whitespace changes
Inline
Side-by-side
bindings/C/adios2/c/adios2_c_adios_mpi.cpp
View file @
65c4a1a4
...
...
@@ -30,7 +30,7 @@ adios2_adios *adios2_init_config_glue_mpi(const char *config_file,
const
bool
debugBool
=
(
debug_mode
==
adios2_debug_mode_on
)
?
true
:
false
;
adios
=
reinterpret_cast
<
adios2_adios
*>
(
new
adios2
::
core
::
ADIOS
(
config_file
,
adios2
::
helper
::
Comm
From
MPI
(
comm
),
debugBool
,
config_file
,
adios2
::
helper
::
Comm
Dup
MPI
(
comm
),
debugBool
,
host_language
));
}
catch
(...)
...
...
bindings/C/adios2/c/adios2_c_io_mpi.cpp
View file @
65c4a1a4
...
...
@@ -29,7 +29,7 @@ adios2_engine *adios2_open_new_comm(adios2_io *io, const char *name,
engine
=
reinterpret_cast
<
adios2_engine
*>
(
&
reinterpret_cast
<
adios2
::
core
::
IO
*>
(
io
)
->
Open
(
name
,
adios2_ToOpenMode
(
mode
),
adios2
::
helper
::
Comm
From
MPI
(
comm
)));
adios2
::
helper
::
Comm
Dup
MPI
(
comm
)));
}
catch
(...)
{
...
...
bindings/CXX11/adios2/cxx11/ADIOSMPI.cpp
View file @
65c4a1a4
...
...
@@ -13,7 +13,7 @@
namespace
adios2
{
ADIOS
::
ADIOS
(
const
std
::
string
&
configFile
,
MPI_Comm
comm
,
const
bool
debugMode
)
:
m_ADIOS
(
std
::
make_shared
<
core
::
ADIOS
>
(
configFile
,
helper
::
Comm
From
MPI
(
comm
),
:
m_ADIOS
(
std
::
make_shared
<
core
::
ADIOS
>
(
configFile
,
helper
::
Comm
Dup
MPI
(
comm
),
debugMode
,
"C++"
))
{
}
...
...
bindings/CXX11/adios2/cxx11/IOMPI.cpp
View file @
65c4a1a4
...
...
@@ -18,7 +18,7 @@ Engine IO::Open(const std::string &name, const Mode mode, MPI_Comm comm)
{
helper
::
CheckForNullptr
(
m_IO
,
"for engine "
+
name
+
", in call to IO::Open"
);
return
Engine
(
&
m_IO
->
Open
(
name
,
mode
,
helper
::
Comm
From
MPI
(
comm
)));
return
Engine
(
&
m_IO
->
Open
(
name
,
mode
,
helper
::
Comm
Dup
MPI
(
comm
)));
}
}
// end namespace adios2
bindings/CXX11/adios2/cxx11/fstream/ADIOS2fstreamMPI.cpp
View file @
65c4a1a4
...
...
@@ -16,7 +16,7 @@ namespace adios2
fstream
::
fstream
(
const
std
::
string
&
name
,
const
openmode
mode
,
MPI_Comm
comm
,
const
std
::
string
engineType
)
:
m_Stream
(
std
::
make_shared
<
core
::
Stream
>
(
name
,
ToMode
(
mode
),
helper
::
Comm
From
MPI
(
comm
),
engineType
,
"C++"
))
name
,
ToMode
(
mode
),
helper
::
Comm
Dup
MPI
(
comm
),
engineType
,
"C++"
))
{
}
...
...
@@ -24,7 +24,7 @@ fstream::fstream(const std::string &name, const openmode mode, MPI_Comm comm,
const
std
::
string
&
configFile
,
const
std
::
string
ioInConfigFile
)
:
m_Stream
(
std
::
make_shared
<
core
::
Stream
>
(
name
,
ToMode
(
mode
),
helper
::
Comm
From
MPI
(
comm
),
configFile
,
helper
::
Comm
Dup
MPI
(
comm
),
configFile
,
ioInConfigFile
,
"C++"
))
{
}
...
...
@@ -34,7 +34,7 @@ void fstream::open(const std::string &name, const openmode mode, MPI_Comm comm,
{
CheckOpen
(
name
);
m_Stream
=
std
::
make_shared
<
core
::
Stream
>
(
name
,
ToMode
(
mode
),
helper
::
Comm
From
MPI
(
comm
),
engineType
,
"C++"
);
name
,
ToMode
(
mode
),
helper
::
Comm
Dup
MPI
(
comm
),
engineType
,
"C++"
);
}
void
fstream
::
open
(
const
std
::
string
&
name
,
const
openmode
mode
,
MPI_Comm
comm
,
...
...
@@ -43,7 +43,7 @@ void fstream::open(const std::string &name, const openmode mode, MPI_Comm comm,
{
CheckOpen
(
name
);
m_Stream
=
std
::
make_shared
<
core
::
Stream
>
(
name
,
ToMode
(
mode
),
helper
::
Comm
From
MPI
(
comm
),
configFile
,
name
,
ToMode
(
mode
),
helper
::
Comm
Dup
MPI
(
comm
),
configFile
,
ioInConfigFile
,
"C++"
);
}
...
...
bindings/Python/py11ADIOS.cpp
View file @
65c4a1a4
...
...
@@ -23,7 +23,7 @@ namespace py11
ADIOS
::
ADIOS
(
const
std
::
string
&
configFile
,
MPI4PY_Comm
mpiComm
,
const
bool
debugMode
)
:
m_ADIOS
(
std
::
make_shared
<
adios2
::
core
::
ADIOS
>
(
configFile
,
helper
::
Comm
From
MPI
(
mpiComm
),
debugMode
,
"Python"
))
configFile
,
helper
::
Comm
Dup
MPI
(
mpiComm
),
debugMode
,
"Python"
))
{
}
...
...
bindings/Python/py11File.cpp
View file @
65c4a1a4
...
...
@@ -34,7 +34,7 @@ File::File(const std::string &name, const std::string mode, MPI_Comm comm,
const
std
::
string
engineType
)
:
m_Name
(
name
),
m_Mode
(
mode
),
m_Stream
(
std
::
make_shared
<
core
::
Stream
>
(
name
,
ToMode
(
mode
),
helper
::
Comm
From
MPI
(
comm
),
engineType
,
"Python"
))
name
,
ToMode
(
mode
),
helper
::
Comm
Dup
MPI
(
comm
),
engineType
,
"Python"
))
{
}
...
...
@@ -42,7 +42,7 @@ File::File(const std::string &name, const std::string mode, MPI_Comm comm,
const
std
::
string
&
configFile
,
const
std
::
string
ioInConfigFile
)
:
m_Name
(
name
),
m_Mode
(
mode
),
m_Stream
(
std
::
make_shared
<
core
::
Stream
>
(
name
,
ToMode
(
mode
),
helper
::
Comm
From
MPI
(
comm
),
configFile
,
helper
::
Comm
Dup
MPI
(
comm
),
configFile
,
ioInConfigFile
,
"Python"
))
{
}
...
...
bindings/Python/py11IO.cpp
View file @
65c4a1a4
...
...
@@ -254,7 +254,7 @@ Engine IO::Open(const std::string &name, const int mode, MPI4PY_Comm comm)
"for engine "
+
name
+
", in call to IO::Open"
);
return
Engine
(
&
m_IO
->
Open
(
name
,
static_cast
<
adios2
::
Mode
>
(
mode
),
helper
::
Comm
From
MPI
(
comm
)));
helper
::
Comm
Dup
MPI
(
comm
)));
}
#endif
...
...
source/adios2/helper/adiosCommMPI.cpp
View file @
65c4a1a4
...
...
@@ -567,19 +567,31 @@ Comm::Status CommReqImplMPI::Wait(const std::string &hint)
return
status
;
}
Comm
Comm
From
MPI
(
MPI_Comm
mpiComm
)
Comm
Comm
With
MPI
(
MPI_Comm
mpiComm
)
{
static
InitMPI
const
initMPI
;
if
(
mpiComm
==
MPI_COMM_NULL
)
{
return
CommDummy
();
}
MPI_Comm
newComm
;
MPI_Comm_dup
(
mpiComm
,
&
newComm
);
auto
comm
=
std
::
unique_ptr
<
CommImpl
>
(
new
CommImplMPI
(
newComm
));
auto
comm
=
std
::
unique_ptr
<
CommImpl
>
(
new
CommImplMPI
(
mpiComm
));
return
CommImpl
::
MakeComm
(
std
::
move
(
comm
));
}
Comm
CommDupMPI
(
MPI_Comm
mpiComm
)
{
MPI_Comm
newComm
;
if
(
mpiComm
!=
MPI_COMM_NULL
)
{
MPI_Comm_dup
(
mpiComm
,
&
newComm
);
}
else
{
newComm
=
MPI_COMM_NULL
;
}
return
CommWithMPI
(
newComm
);
}
MPI_Comm
CommAsMPI
(
Comm
const
&
comm
)
{
if
(
CommImplMPI
*
mpi
=
dynamic_cast
<
CommImplMPI
*>
(
CommImpl
::
Get
(
comm
)))
...
...
source/adios2/helper/adiosCommMPI.h
View file @
65c4a1a4
...
...
@@ -22,10 +22,15 @@ namespace adios2
namespace
helper
{
/**
* @brief Create a communicator by taking ownership of a MPI communicator.
*/
Comm
CommWithMPI
(
MPI_Comm
mpiComm
);
/**
* @brief Create a communicator by duplicating a MPI communicator.
*/
Comm
Comm
From
MPI
(
MPI_Comm
mpiComm
);
Comm
Comm
Dup
MPI
(
MPI_Comm
mpiComm
);
/**
* @brief Get the underlying raw MPI communicator.
...
...
source/adios2/toolkit/sst/util/sst_conn_tool.cxx
View file @
65c4a1a4
...
...
@@ -7,7 +7,7 @@
#ifdef ADIOS2_HAVE_MPI
#include
"adios2/helper/adiosCommMPI.h"
static
adios2
::
helper
::
Comm
CommWorld
=
adios2
::
helper
::
Comm
From
MPI
(
MPI_COMM_WORLD
);
adios2
::
helper
::
Comm
With
MPI
(
MPI_COMM_WORLD
);
#else
#include
"adios2/helper/adiosCommDummy.h"
static
adios2
::
helper
::
Comm
CommWorld
=
adios2
::
helper
::
CommDummy
();
...
...
source/utils/adios_reorganize/Reorganize.cpp
View file @
65c4a1a4
...
...
@@ -52,7 +52,7 @@ Reorganize::Reorganize(int argc, char *argv[])
{
#ifdef ADIOS2_HAVE_MPI
{
auto
commWorld
=
helper
::
Comm
From
MPI
(
MPI_COMM_WORLD
);
auto
commWorld
=
helper
::
Comm
With
MPI
(
MPI_COMM_WORLD
);
m_Comm
=
commWorld
.
Split
(
m_CommSplitColor
,
0
);
}
#else
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment