From 59008ee424a8f5dab01451e05075701d24fcd4f0 Mon Sep 17 00:00:00 2001
From: Georges Da Costa <dacosta@irit.fr>
Date: Fri, 26 May 2023 14:06:10 +0200
Subject: [PATCH] Adds the capability to run on MacOS

---
 expetator/experiment.py       |  8 ++++++--
 expetator/monitors/mojitos.py | 14 +++++++++-----
 2 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/expetator/experiment.py b/expetator/experiment.py
index c4cb898..694c8e2 100755
--- a/expetator/experiment.py
+++ b/expetator/experiment.py
@@ -15,8 +15,12 @@ from execo import Process
 class Executor:
     'Allow access to the platform'
     def __init__(self):
-        self.mpi_host_file = '/dev/shm/mpi_host_file'
-        self.mpi_core_file = '/dev/shm/mpi_core_file'
+        if os.path.isdir('/dev/shm'):
+            self.mpi_host_file = '/dev/shm/mpi_host_file'
+            self.mpi_core_file = '/dev/shm/mpi_core_file'
+        else:
+            self.mpi_host_file = '/tmp/expetator_mpi_host_file'
+            self.mpi_core_file = '/tmp/expetator_mpi_core_file'
         self.mpi_options = ''
         self.hostnames = ['localhost']
         self.nbhosts = 1
diff --git a/expetator/monitors/mojitos.py b/expetator/monitors/mojitos.py
index fe0d12f..a2ae125 100644
--- a/expetator/monitors/mojitos.py
+++ b/expetator/monitors/mojitos.py
@@ -93,7 +93,11 @@ class Mojitos:
             self.cmdline += ' -r'
         if self.load:
             self.cmdline += ' -u'
-        self.cmdline += ' -o /dev/shm/monitoring_moj &'
+        if os.path.isdir('/dev/shm'):
+            self.monitoring_file = '/dev/shm/monitoring_moj'
+        else:
+            self.monitoring_file = '/tmp/expetator_monitoring_moj'
+        self.cmdline += ' -o %s &' % self.monitoring_file
 
 
     def start(self):
@@ -110,8 +114,8 @@ class Mojitos:
         os.makedirs(filename_moj, exist_ok=True)
         if len(self.executor.hostnames) > 1:
             for hostname in self.executor.hostnames:
-                self.executor.local('oarcp %s:/dev/shm/monitoring_moj %s/%s_%s_%s' %
-                                    (hostname, filename_moj, hostname, benchname, beg_time))
+                self.executor.local('oarcp %s:%s %s/%s_%s_%s' %
+                                    (hostname, self.monitoring_file, filename_moj, hostname, benchname, beg_time))
         else:
-            self.executor.local('cp /dev/shm/monitoring_moj %s/%s_%s_%s' %
-                                    (filename_moj, 'localhost', benchname, beg_time))
+            self.executor.local('cp %s %s/%s_%s_%s' %
+                                    (self.monitoring_file, filename_moj, 'localhost', benchname, beg_time))
-- 
GitLab