Algorithmique Numérique Distribuée Public GIT Repository
index b4b3f28..995d328 100755 (executable)
@@ -35,7 +35,7 @@ def convert_trace(trace_path, base_path, output_path, trace_version="1.0"):

new_file_path = os.path.join(output_path, trace_path)
pathlib.Path(os.path.dirname(new_file_path)).mkdir(
-                parents=True, exist_ok=True)
+            parents=True, exist_ok=True)

with open(new_file_path, "w") as new_trace:
@@ -44,7 +44,7 @@ def convert_trace(trace_path, base_path, output_path, trace_version="1.0"):
last_async_call_src = None
last_async_call_dst = None
-                #print(line)
+                # print(line)
new_line = None
split_line = line.lower().strip().split(" ")
mpi_call = split_line[1]
@@ -63,8 +63,8 @@ def convert_trace(trace_path, base_path, output_path, trace_version="1.0"):
if (last_async_call_src is None
or last_async_call_dst is None):
raise Exception("Invalid traces: No Isend or Irecv "
-                                "found before the wait in line " +
-                                str(line_num) + " in file " + old_file_path )
+                                        "found before the wait in line " +
+                                        str(line_num) + " in file " + old_file_path)
new_line = insert_elem(split_line, 2, last_async_call_src)
new_line = insert_elem(split_line, 3, last_async_call_dst)
new_line = insert_elem(split_line, 4, "0")
@@ -74,21 +74,20 @@ def convert_trace(trace_path, base_path, output_path, trace_version="1.0"):
#        " processed\n:OLD: " + line + "\n:NEW: " + new_line)
new_trace.write(new_line + "\n")
else:
-                    new_trace.write(line)
+                    new_trace.write(line.lower())

if __name__ == "__main__":
import argparse
import sys

-
parser = argparse.ArgumentParser(description=sys.modules[__name__].__doc__)

-            default=sys.stdin, help="The trace list file (e.g. smpi_simgrid.txt)")
+                        default=sys.stdin, help="The trace list file (e.g. smpi_simgrid.txt)")

-            help="The path where converted traces will be put")
+                        help="The path where converted traces will be put")

args = parser.parse_args()

@@ -96,10 +95,15 @@ if __name__ == "__main__":

# creates results dir
pathlib.Path(args.output_path).mkdir(
-            parents=True, exist_ok=True)
+        parents=True, exist_ok=True)

# copy trace list file
-    shutil.copy(trace_list_file_path, args.output_path)
+    try:
+        shutil.copy(trace_list_file_path, args.output_path)
+    except shutil.SameFileError:
+        print("ERROR: Inplace replacement of the trace is not supported: "
+              "Please, select another output path")
+        sys.exit(-1)

with open(trace_list_file_path) as tracelist_file: