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
d7071c37
Commit
d7071c37
authored
Sep 02, 2016
by
remicres
Browse files
ADD: memory parameter can be specified for each tiling mode (auto/none/user)
parent
b47a8806
Changes
2
Hide whitespace changes
Inline
Side-by-side
app/otbLSGRM.cxx
View file @
d7071c37
...
...
@@ -103,8 +103,10 @@ private:
AddParameter
(
ParameterType_Int
,
"tiling.user.sizex"
,
"Tiles width"
);
AddParameter
(
ParameterType_Int
,
"tiling.user.sizey"
,
"Tiles height"
);
AddParameter
(
ParameterType_Int
,
"tiling.user.nfirstiter"
,
"Number of first iterations"
);
AddParameter
(
ParameterType_Int
,
"tiling.user.memory"
,
"Available memory"
);
AddChoice
(
"tiling.none"
,
"No tiling layout"
);
AddParameter
(
ParameterType_Int
,
"memory"
,
"Restrict memory use (mb)"
);
MandatoryOff
(
"memory"
);
}
void
DoUpdateParameters
()
...
...
@@ -184,7 +186,6 @@ private:
controller
->
SetTileWidth
(
GetParameterInt
(
"tiling.user.sizex"
));
controller
->
SetTileHeight
(
GetParameterInt
(
"tiling.user.sizey"
));
controller
->
SetNumberOfFirstIterations
(
GetParameterInt
(
"tiling.user.nfirstiter"
));
controller
->
SetInternalMemoryAvailable
(
GetParameterInt
(
"tiling.user.memory"
));
}
else
if
(
inputTilingMode
==
TILING_NONE
)
{
...
...
@@ -193,7 +194,14 @@ private:
}
else
{
otbAppLogFATAL
(
"Unknow tiling mode!"
);
otbAppLogFATAL
(
"Unknown tiling mode!"
);
}
// Input RAM value?
if
(
HasValue
(
"memory"
))
{
otbAppLogINFO
(
"Setting maximum memory to "
<<
GetParameterInt
(
"memory"
)
<<
" MBytes"
);
controller
->
SetInternalMemoryAvailable
(
GetParameterInt
(
"memory"
));
}
// Run the segmentation
...
...
include/lsgrmController.txx
View file @
d7071c37
...
...
@@ -260,9 +260,11 @@ long unsigned int Controller<TSegmenter>::GetMaximumNumberOfNodesInMemory()
{
itkDebugMacro(<< "Computing maximum number of nodes in memory");
m_Memory = getMemorySize();
assert(m_Memory > 0);
if (m_Memory == 0)
{
m_Memory = getMemorySize();
assert(m_Memory > 0);
}
m_Memory /= 2; // For safety and can prevent out of memory troubles
return std::ceil(((float) m_Memory) / ((float) GetNodeMemory()));
...
...
@@ -412,7 +414,10 @@ void Controller<TSegmenter>::GetAutomaticConfiguration()
template <class TSegmenter>
void Controller<TSegmenter>::SetInternalMemoryAvailable(long long unsigned int v) // expecting a value in Mbytes.
{
assert(v > 0);
if (v<=0)
{
itkExceptionMacro(<<"Memory value is not valid (value=" << v << ")");
}
m_Memory = v * 1024ul * 1024ul;
}
...
...
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