diff --git a/app/otbLSGRM.cxx b/app/otbLSGRM.cxx
index f3c0bdca86bde421a561524189a71fe7f62faf44..0c15b64919a847439f0f25b16e3abab7fa5d4ff8 100644
--- a/app/otbLSGRM.cxx
+++ b/app/otbLSGRM.cxx
@@ -97,6 +97,7 @@ private:
 
     // For large scale
     AddParameter(ParameterType_Directory, "tmpdir", "Directory for temporary files");
+    MandatoryOff("tmpdir");
     AddParameter(ParameterType_Choice, "tiling", "Tiling layout for the large scale segmentation");
     AddChoice("tiling.auto", "Automatic tiling layout");
     AddChoice("tiling.user", "User tiling layout");
@@ -124,7 +125,16 @@ private:
     std::string outbfname = itksys::SystemTools::GetFilenameWithoutExtension(outfname.c_str());
 
     // Get specified temporary directory
-    std::string tmpdir = GetParameterAsString("tmpdir");
+    std::string tmpdir;
+    if (HasValue("tmpdir"))
+      {
+      tmpdir= GetParameterAsString("tmpdir");
+      }
+    else
+      {
+      tmpdir = itksys::SystemTools::GetFilenamePath(outfname);
+      }
+
     if (!tmpdir.empty())
       {
       // A temporary directory is specified: we check that it ends with a POSIX separator
@@ -140,6 +150,7 @@ private:
       {
       otbAppLogFATAL("The directory " << tmpdir << " does not exist.");
       }
+    otbAppLogINFO("Using temporary directory " << tmpdir);
 
     // Return the prefix
     std::string prefix = tmpdir + outbfname;