Browse Source

Added parallel push option to compile on as many cores as available

Yentl Van Tendeloo 9 years ago
parent
commit
f7b068bd55
1 changed files with 12 additions and 1 deletions
  1. 12 1
      integration/utils.py

+ 12 - 1
integration/utils.py

@@ -11,6 +11,7 @@ import subprocess
 import signal
 
 username = "test_user"
+parallel_push = True
 
 def serialize(value):
     if isinstance(value, str):
@@ -87,6 +88,7 @@ def run_file(files, parameters, expected, mode):
         # Run Modelverse server
         proc = execute("run_local_modelverse", ["bootstrap/bootstrap.m"], wait=False)
 
+        threads = []
         for filename in files:
             if filename == "--fast":
                 continue
@@ -98,7 +100,16 @@ def run_file(files, parameters, expected, mode):
                 raise Exception("File not found: %s" % filename)
             print("Found file " + str(mod_filename))
 
-            compile_file(mod_filename, filename, mode, proc)
+            if parallel_push:
+                import threading
+                threads.append(threading.Thread(target=compile_file, args=[mod_filename, filename, mode, proc]))
+                threads[-1].start()
+            else:
+                compile_file(mod_filename, filename, mode, proc)
+
+        if parallel_push:
+            for t in threads:
+                t.join()
 
         if mode[-1] == "O":
             # Fire up the linker