import json
import sys
import os
import copy
import shutil
import glob
import subprocess
import time

def main():

    #if len(sys.argv) != 2:
    #    print("Usage: python ./submit_job.py [mpi_grid]")
    #    sys.exit(0)

    #grid = list(map(int, sys.argv[1].split()))

    num_ranks = 1
    #for i in grid: num_ranks *= i


    new_env = copy.deepcopy(os.environ)
    new_env["OMP_NUM_THREADS"] = "8"
    new_env["OMP_NESTED"] = "false"
    new_env["MKL_NUM_THREADS"] = "8"
    new_env["MKL_DYNAMIC"] = "false"
    new_env["CRAY_CUDA_MPS"] = "0"
    new_env["MPICH_RDMA_ENABLED_CUDA"] = "1"
    new_env["MPICH_NO_GPU_DIRECT"] = "1"
    new_env["CRAY_LIBSCI_ACC_MODE"] = "1"

    aprun_command = "aprun -n " + str(num_ranks) + " -N1 -d8 -cc none"
    job_command = "./test_zgemm --M=100 --N=100 --K=100"

    command = aprun_command + " " + job_command

    job_duration = -time.time()
    path = "./"
    proc = subprocess.Popen(command.split(), cwd=path, env=new_env)
    proc.wait()
    job_duration += time.time()

    print("job duration" + str(job_duration))

if __name__ == "__main__":
    main()



@@ -1,12 +1,30 @@
+#!/usr/bin/python%0A
 import json%0A
@@ -125,22 +125,25 @@
 main():%0A
+    
 %0A    
-#
 if len(s
@@ -157,25 +157,24 @@
 ) != 2:%0A    
-#
     print(%22U
@@ -183,27 +183,20 @@
 ge: 
-python ./submit_job
+run_job_py34
 .py 
@@ -212,17 +212,16 @@
 %5D%22)%0A    
-#
     sys.
@@ -233,17 +233,16 @@
 0)%0A%0A    
-#
 grid = l
@@ -276,16 +276,20 @@
 lit()))%0A
+    
 %0A    num
@@ -303,17 +303,16 @@
 = 1%0A    
-#
 for i in
@@ -334,16 +334,38 @@
 s *= i%0A%0A
+    print(os.environ)%0A
 %0A    new
@@ -819,25 +819,28 @@
 --M=
-1
+40
 00 --N=
-1
+40
 00 --K=
-1
+40
 00%22%0A
@@ -1077,16 +1077,18 @@
 duration
+: 
 %22 + str(

update the script