Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Cresson Remi
LSGRM
Commits
84c4d6fd
Commit
84c4d6fd
authored
Sep 06, 2016
by
remicres
Browse files
REFAC: MPI related functions now explicitely called in graphOperations
parent
0c3ae789
Changes
2
Hide whitespace changes
Inline
Side-by-side
include/lsgrmGraphOperations.txx
View file @
84c4d6fd
...
...
@@ -175,7 +175,9 @@ long long unsigned int RunPartialSegmentation(const typename TSegmenter::ParamTy
{
for(unsigned int col = 0; col < nbTilesX; col++)
{
#ifdef OTB_USE_MPI
if (MyTurn(row*nbTilesX + col))
#endif
{
// Get the current tile
std::cout << "Processing tile " << row << ", " << col << std::endl;
...
...
@@ -252,7 +254,9 @@ long long unsigned int RunPartialSegmentation(const typename TSegmenter::ParamTy
{
for(unsigned int col = 0; col < nbTilesX; col++)
{
#ifdef OTB_USE_MPI
if (MyTurn(row*nbTilesX + col))
#endif
{
// Get current tile
ProcessingTile currentTile = tiles[row*nbTilesX + col];
...
...
@@ -653,7 +657,9 @@ long long unsigned int RunFirstPartialSegmentation(
{
for(unsigned int col = 0; col < nbTilesX; col++)
{
#ifdef OTB_USE_MPI
if (MyTurn(row*nbTilesX + col))
#endif
{
// Reading images
ProcessingTile currentTile = tiles[row*nbTilesX + col];
...
...
include/lsgrmHeader.h
View file @
84c4d6fd
...
...
@@ -21,27 +21,26 @@
#include "otbImageFileWriter.h"
#endif
/* MPI related functions */
#ifdef OTB_USE_MPI
/*
* This function returns TRUE if the process #myrank is assigned
* to the task #div in a pool of #nprocs processes
*/
bool
MyTurn
(
int
div
=
0
)
{
#ifdef OTB_USE_MPI
otb
::
MPIConfig
::
Pointer
mpiConfig
=
otb
::
MPIConfig
::
Instance
();
unsigned
int
proc
=
0
;
if
(
mpiConfig
->
GetNbProcs
()
!=
0
)
proc
=
div
%
mpiConfig
->
GetNbProcs
();
return
(
proc
==
mpiConfig
->
GetMyRank
());
#endif
return
true
;
}
/*
* This function gather the given value in other process, and update it
* TODO: MPI implementation using OTB MPI Wrapper
*/
#ifdef OTB_USE_MPI
template
<
typename
T
>
void
GatherMe
(
T
&
x
,
MPI_Datatype
dataType
)
{
...
...
@@ -166,21 +165,17 @@ void BroadcastImage(typename TImageType::Pointer & inPtr)
it1
.
Set
(
it2
.
Get
());
}
}
// recopy image
}
// while data to transmit
}
#endif
/*
* Gather accumulatedMemory and isFusion variables
* TODO: MPI implementation using OTB MPI Wrapper
*/
void
GatherUsefulVariables
(
unsigned
long
long
int
&
accumulatedMemory
,
bool
&
isFusion
)
{
#ifdef OTB_USE_MPI
otb
::
MPIConfig
::
Instance
()
->
barrier
();
int
isFusionInteger
=
0
;
long
long
int
accumulatedMemoryLLI
=
static_cast
<
long
long
int
>
(
accumulatedMemory
);
...
...
@@ -191,9 +186,11 @@ void GatherUsefulVariables(unsigned long long int& accumulatedMemory, bool& isFu
accumulatedMemory
=
static_cast
<
long
long
unsigned
int
>
(
accumulatedMemoryLLI
);
if
(
isFusionInteger
>
0
)
isFusion
=
true
;
#endif
}
#endif
/*
* Print time elapsed
*/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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