Skip to content

Commit

Permalink
Add environment variable to launch a file server process on single host
Browse files Browse the repository at this point in the history
When the environment variable KhiopsFileServerActivated is set to true, an MPI file server process
is launched on a single machine. These process are used on clusters to exchange temporary files.
This feature allows to test the file server on a common laptop.
  • Loading branch information
bruno-at-orange committed Apr 12, 2024
1 parent 9ba6e71 commit 70ff89d
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Learning/KWDataUtils/PLUseMPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,13 @@ inline void UseMPI()
PLParallelTask::GetDriver()->InitializeResourceSystem();

// Chargement du driver pour l'acces aux fichiers distants (file://)
if (RMResourceManager::GetResourceSystem()->GetHostNumber() > 1 or PLTaskDriver::GetFileServerOnSingleHost())
if (RMResourceManager::GetResourceSystem()->GetHostNumber() > 1 or GetFileServerActivated())
SystemFileDriverCreator::RegisterDriver(new PLMPISystemFileDriverRemote);

// Activation du serveure de fichier en mono-machine si necessaire
if (GetFileServerActivated())
PLTaskDriver::SetFileServerOnSingleHost(true);

// Verification des versions de chaque processus
PLParallelTask::SetVersion(GetLearningVersion());
PLMPITaskDriver::CheckVersion();
Expand Down
27 changes: 27 additions & 0 deletions src/Learning/KWUtils/KWVersion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,33 @@ int GetParallelTraceMode()
return nParallelTraceMode;
}

boolean GetFileServerActivated()
{
static boolean bIsInitialized = false;
static boolean bFileServerActivated = false;
int nValue;

// Determination du mode parallele au premier appel
if (not bIsInitialized)
{
ALString sFileServerActivated;

// Recherche de la variable d'environnement
sFileServerActivated = p_getenv("KhiopsFileServerActivated");
sFileServerActivated.MakeLower();

// Determination du mode parallele
if (sFileServerActivated == "true")
bFileServerActivated = true;
else if (sFileServerActivated == "false")
bFileServerActivated = false;

// Memorisation du flag d'initialisation
bIsInitialized = true;
}
return bFileServerActivated;
}

boolean GetLearningPriorStudyMode()
{
static boolean bIsInitialized = false;
Expand Down
4 changes: 4 additions & 0 deletions src/Learning/KWUtils/KWVersion.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,10 @@ boolean GetParallelExpertMode();
// aux methodes de PLParallelTask)
int GetParallelTraceMode();

// Indicateur du lancement d'un serveur de fichier sur un systeme mono-machine. Les serveurs sont normalement instancies sur
// un cluster de machine. Cet indicateur permet de tester le driver de fichier distant sans cluster.
boolean GetFileServerActivated();

// Indicateur du mode d'etude des prior dans le cadre de la construction de variable (en mode expert uniquement)
// Ce mode est controlable par la variable d'environnement KhiopsPriorStudyMode a true ou false
boolean GetLearningPriorStudyMode();
Expand Down

0 comments on commit 70ff89d

Please sign in to comment.