def conv_spatial(): mpi_num_procs, omp_num_threads = utils.parse_args() num_steps = 10 T_END = 1.0 # ############################################################################ # # TEST 2: SPATIAL CONVERGENCE # ############################################################################ tl_factor = 0.1 tl_init = 1 tl_list = [tl_init*math.pow(tl_factor,float(cnt)) for cnt in range(0,num_steps)] dt_factor = 1 dt_init = T_END/2**20 dt_list = [dt_init*math.pow(dt_factor,float(cnt)) for cnt in range(0,num_steps)] tn_factor = 1.0/dt_factor tn_init = 1 tn_list = [tn_init*math.pow(tn_factor,float(cnt)) for cnt in range(0,num_steps)] # NUM MPI PROCESSES np_list = [mpi_num_procs for cnt in range(0, num_steps)] # NUM OMP THREADS nt_list = [omp_num_threads for cnt in range(0, num_steps)] cmd_args = generate_command_args(tl_list,\ dt_list,\ tn_list,\ # de_list,\ # q_list, \ np_list,\ nt_list,\ num_steps) utils.execute_commands(cmd_args,'spatial')
def conv_temporal(): mpi_num_procs, omp_num_threads = utils.parse_args() num_steps = 8 ############################################################################ # TEST 1: TEMPORAL CONVERGENCE ############################################################################ # prog = 'advdiff-ss' # prog = 'advdiff-ss-tv' prog = 'advdiff-ss-tv-extrap' vtk_save_rate = 0 mrg_type = 3 np = mpi_num_procs num_pnts = 8**(math.floor(math.log(np,8)+1)) nt = omp_num_threads # TREE TOLERANCE tl_factor = 1#0.1 tl_init = 1e-5 tl_list = [tl_init*math.pow(tl_factor,float(cnt)) for cnt in range(0,num_steps)] # TIME RESOLUTION dt_factor = 0.5 # dt_init = 0.1/16#0.5**5 dt_init = 0.5**0 dt_list = [dt_init*math.pow(dt_factor,float(cnt)) for cnt in range(0,num_steps)] # NUM TIME STEPS T_END = 1.0 tn_factor = 1.0/dt_factor tn_init = T_END/dt_init tn_list = [tn_init*math.pow(tn_factor,float(cnt)) for cnt in range(0,num_steps)] dp_list = [15 for cnt in range(0,num_steps)] cq_list = [14 for cnt in range(0,num_steps)] ci_list = [True for cnt in range(0,num_steps)] uf_list = [2 for cnt in range(0,num_steps)] pn_list = [num_pnts for cnt in range(0,num_steps)] np_list = [np for cnt in range(0,num_steps)] nt_list = [nt for cnt in range(0,num_steps)] mg_list = [mrg_type for cnt in range(0,num_steps)] vs_list = [vtk_save_rate for cnt in range(0,num_steps)] tt_list = [11 for cnt in range(0,num_steps)] cmd_args = OrderedDict() cmd_args = utils.generate_commands( prog, pn_list, tl_list, dp_list, cq_list, ci_list, uf_list, np_list, nt_list, dt_list, tn_list, vs_list, mg_list, tt_list) utils.execute_commands(cmd_args, 'temporal')
def test2(): mpi_num_procs, omp_num_threads = utils.parse_args() num_steps = 8 ############################################################################ # TEST 2: ############################################################################ tl_fact = 0.1 tl_init = 1e-6 tl_list = [tl_init*math.pow(tl_fact,float(cnt)) for cnt in range(0,num_steps)] cuf_fact = 1 cuf_init = 2 uf_list = [cuf_init*math.pow(cuf_fact,float(cnt)) for cnt in range(0,num_steps)] use_cubic = False # NUM MPI PROCESSES np_list = [mpi_num_procs for cnt in range(0, num_steps)] # NUM OMP THREADS nt_list = [omp_num_threads for cnt in range(0, num_steps)] cmd_args = generate_command_args(tl_list,\ uf_list,\ use_cubic,\ np_list,\ nt_list,\ num_steps) utils.execute_commands(cmd_args, 'table2')
def conv_temporal_spatial_long_time(): ############################################################################ # TEST 2: CONVERGENCE TEST FOR ADVECTION-DIFFUSION SOLVER ############################################################################ mpi_num_procs, omp_num_threads = utils.parse_args() # prog = 'advdiff-ss' # prog = 'advdiff-ss-tv' prog = 'advdiff-ss-tv-extrap' dt = 0.0628 vtk_save_rate = 0 mrg_type = 3 np = mpi_num_procs num_pnts = 8**(math.floor(math.log(np, 8) + 1)) nt = omp_num_threads # UNIFORM # dp_list = [5 , 6 , 7 ] # cq_list = [3 , 3 , 3 ] # ci_list = [True , True , True ] # uf_list = [2 , 2 , 2 ] # dt_list = [dt , dt/2 , dt/4 ] # tn_list = [100 , 200 , 400 ] # num_steps = len(dp_list) # tl_list = [1e-30 for cnt in range(0,num_steps)] # ADAPTIVE # LOW ORDER tl_list = [1e-02, 1e-03, 1e-04] dp_list = [15, 15, 15] cq_list = [3, 3, 3] ci_list = [True, True, True] uf_list = [2, 2, 2] dt_list = [dt, dt / 2, dt / 3] tn_list = [100, 200, 300] # HIGH ORDER # tl_list = [1e-03, 1e-04, 1e-05, 1e-6 ] # dp_list = [15 , 15 , 15 , 15 ] # cq_list = [14 , 14 , 14 , 14 ] # ci_list = [True , True , True , True ] # uf_list = [2 , 2 , 2 , 2 ] # dt_list = [dt/4 , dt/8 , dt/16, dt/32 ] # tn_list = [400 , 800 , 1600 , 3200 ] num_steps = len(dp_list) pn_list = [num_pnts for cnt in range(0, num_steps)] np_list = [np for cnt in range(0, num_steps)] nt_list = [nt for cnt in range(0, num_steps)] mg_list = [mrg_type for cnt in range(0, num_steps)] vs_list = [vtk_save_rate for cnt in range(0, num_steps)] tt_list = [11 for cnt in range(0, num_steps)] cmd_args = OrderedDict() cmd_args = utils.generate_commands(prog, pn_list, tl_list, dp_list, cq_list, ci_list, uf_list, np_list, nt_list, dt_list, tn_list, vs_list, mg_list, tt_list) utils.execute_commands(cmd_args, 'temporal-spatial-long-time')
def conv_temporal(): mpi_num_procs, omp_num_threads = utils.parse_args() num_steps = 8 ############################################################################ # TEST 1: TEMPORAL CONVERGENCE ############################################################################ # prog = 'advdiff-ss' # prog = 'advdiff-ss-tv' prog = 'advdiff-ss-tv-extrap' vtk_save_rate = 0 mrg_type = 3 np = mpi_num_procs num_pnts = 8**(math.floor(math.log(np, 8) + 1)) nt = omp_num_threads # TREE TOLERANCE tl_factor = 1 #0.1 tl_init = 1e-5 tl_list = [ tl_init * math.pow(tl_factor, float(cnt)) for cnt in range(0, num_steps) ] # TIME RESOLUTION dt_factor = 0.5 # dt_init = 0.1/16#0.5**5 dt_init = 0.5**0 dt_list = [ dt_init * math.pow(dt_factor, float(cnt)) for cnt in range(0, num_steps) ] # NUM TIME STEPS T_END = 1.0 tn_factor = 1.0 / dt_factor tn_init = T_END / dt_init tn_list = [ tn_init * math.pow(tn_factor, float(cnt)) for cnt in range(0, num_steps) ] dp_list = [15 for cnt in range(0, num_steps)] cq_list = [14 for cnt in range(0, num_steps)] ci_list = [True for cnt in range(0, num_steps)] uf_list = [2 for cnt in range(0, num_steps)] pn_list = [num_pnts for cnt in range(0, num_steps)] np_list = [np for cnt in range(0, num_steps)] nt_list = [nt for cnt in range(0, num_steps)] mg_list = [mrg_type for cnt in range(0, num_steps)] vs_list = [vtk_save_rate for cnt in range(0, num_steps)] tt_list = [11 for cnt in range(0, num_steps)] cmd_args = OrderedDict() cmd_args = utils.generate_commands(prog, pn_list, tl_list, dp_list, cq_list, ci_list, uf_list, np_list, nt_list, dt_list, tn_list, vs_list, mg_list, tt_list) utils.execute_commands(cmd_args, 'temporal')
def conv_temporal_spatial_long_time(): ############################################################################ # TEST 2: CONVERGENCE TEST FOR ADVECTION ############################################################################ mpi_num_procs, omp_num_threads = utils.parse_args() prog = 'advection' dt = 0.0628 vsr = 0 mrg_type = 3 np = mpi_num_procs num_pnts = 8**(math.floor(math.log(np,8)+1)) nt = omp_num_threads # UNIFORM dp_list = [5 , 6 , 7 ]#, 5 , 6 , 7 ] cq_list = [3 , 3 , 3 ]#, 3 , 3 , 3 ] ci_list = [False , False , False ]#, False , False , False] uf_list = [2 , 2 , 2 ]#, 2 , 2 , 2 ] dt_list = [dt , dt/2 , dt/4 ]#, dt , dt/2 , dt/4 ] tn_list = [100 , 200 , 400 ]#, 100 , 200 , 400 ] num_steps = len(dp_list) tl_list = [1e-30 for cnt in range(0,num_steps)] # ADAPTIVE # tl_list = [1e-02, 1e-03, 1e-04, 1e-02 , 1e-03 , 1e-04] # dp_list = [15 , 15 , 15 , 15 , 15 , 15 ] # cq_list = [3 , 3 , 3 , 3 , 3 , 3 ] # ci_list = [True , True , True , False , False , False] # uf_list = [2 , 2 , 2 , 2 , 2 , 2 ] # dt_list = [dt , dt/2 , dt/4 , dt , dt/2 , dt/4 ] # tn_list = [100 , 200 , 400 , 100 , 200 , 400 ] num_steps = len(dp_list) pn_list = [num_pnts for cnt in range(0,num_steps)] np_list = [np for cnt in range(0,num_steps)] nt_list = [nt for cnt in range(0,num_steps)] mg_list = [mrg_type for cnt in range(0,num_steps)] vs_list = [vsr for cnt in range(0,num_steps)] cmd_args = OrderedDict() cmd_args = utils.generate_commands( prog, pn_list, tl_list, dp_list, cq_list, ci_list, uf_list, np_list, nt_list, dt_list, tn_list, vs_list, mg_list) utils.execute_commands(cmd_args, 'temporal-spatial-long-time')
def test1(): mpi_num_procs, omp_num_threads = utils.parse_args() ############################################################################ # TEST 1: TEMPORAL/SPATIAL ERROR ############################################################################ num_steps = 6 # TREE TOLERANCE tl_factor = 1 tl_init = 1e-10 tl_list = [tl_init*math.pow(tl_factor,float(cnt)) for cnt in range(0, num_steps)] # TREE DEPTH # de_factor = 0 # de_init = 5 # de_list = [de_init+cnt*de_factor for cnt in range(0, num_steps)] de_list = [5,5,5,7,7,7] # TIME RESOLUTION dt_factor = 1 dt_init = 6.28*1e-2 dt_list = [dt_init*math.pow(dt_factor,float(cnt)) for cnt in range(0, num_steps)] # NUM TIME STEPS NUM_ROT = 5 T_END = 6.28*NUM_ROT tn_factor = 1 tn_init = T_END/dt_init tn_list = [tn_init*math.pow(tn_factor,float(cnt)) for cnt in range(0, num_steps)] # CHEBYSHEV DEGREE # q_factor = 1; # q_init = 2; # q_list = [q_init*math.pow(q_factor,float(cnt)) for cnt in range(0, num_steps)] q_list = [3,8,14,3,8,14] # NUM MPI PROCESSES np_list = [mpi_num_procs for cnt in range(0, num_steps)] # NUM OMP THREADS nt_list = [omp_num_threads for cnt in range(0, num_steps)] cmd_args = generate_command_args(tl_list,\ dt_list,\ tn_list,\ de_list,\ q_list, \ np_list,\ nt_list,\ num_steps) utils.execute_commands(cmd_args,'table1-ROT'+str(NUM_ROT))
def get_message(): # from_number = request.form['From'] req_body = request.form['Body'] print(req_body) # Check first word in body to see if it is custom command commands = get_commands(req_body) # If custom command, run function associated with it # If not custom command, run the body as normal os command #p = Process(target = execute_commands, args = (commands, request.form['Channel'])) execute_commands(commands, request.form['Channel']) #p.start() #p.join() return 'ok'
def build_slangd(version, b6k_cs_pw): versioned_dist = 'slangd-' + version.replace('.', '_') build_time = int(time.time()) ldflags = f"-X main.Version={version} " ldflags += f"-X main.BuildTime={build_time} " for os in OS: for arch in ARCHS: filename_with_ending = filename = f"{versioned_dist}-{os}-{arch}" if os == 'windows': filename_with_ending += ".exe" compress_cmd = f"zip {filename}.zip {filename_with_ending}" else: compress_cmd = f"tar -czvf {filename}.tar.gz {filename_with_ending}" execute_commands([ f"env GOOS={os} GOARCH={arch} go build -ldflags \"{ldflags}\" -o ./ci/release/{filename_with_ending} ./cmd/slangd", ]) if os == 'windows' and b6k_cs_pw: execute_commands([ f"osslsigncode sign -pkcs12 ./ci/b6k_csc.p12 -pass {b6k_cs_pw} -in ./ci/release/{filename_with_ending} -out ./ci/release/signed_{filename_with_ending}", ], True, False) execute_commands([ f"rm ./ci/release/{filename_with_ending}", f"mv ./ci/release/signed_{filename_with_ending} ./ci/release/{filename_with_ending}", ]) chdir("./ci/release/") execute_commands([ compress_cmd, f"rm {filename_with_ending}", ]) chdir("../..")
def scals(): mpi_num_procs, omp_num_threads = utils.parse_args() ############################################################################ # TEST 1: STRONG SCALING ############################################################################ # prog = 'advection' prog = 'advdiff-ss' np_list = [ 1, 2, 4, 8, # 16, # 32, # 64, ] mrg_type = 3; max_np = max(np_list) num_pnts = 8**3#(math.floor(math.log(max_np,8)+1)) num_steps = len(np_list) pn_list = [num_pnts for cnt in range(0,num_steps)] tl_list = [1e-0 for cnt in range(0,num_steps)] dp_list = [15 for cnt in range(0,num_steps)] cq_list = [14 for cnt in range(0,num_steps)] ci_list = [True for cnt in range(0,num_steps)] uf_list = [4 for cnt in range(0,num_steps)] nt_list = [omp_num_threads for cnt in range(0,num_steps)] dt_list = [0.125 for cnt in range(0,num_steps)] tn_list = [1 for cnt in range(0,num_steps)] vs_list = [0 for cnt in range(0,num_steps)] mg_list = [mrg_type for cnt in range(0,num_steps)] cmd_args = OrderedDict() cmd_args = utils.generate_commands( prog, pn_list, tl_list, dp_list, cq_list, ci_list, uf_list, np_list, nt_list, dt_list, tn_list, vs_list, mg_list) utils.execute_commands(cmd_args, 'sscal'+prog)
def conv_temporal_spatial(): ############################################################################ # TEST 3: TEMPORAL/SPATIAL CONVERGENCE ############################################################################ use_cubic = True # TREE TOLERANCE tl_factor = 0.1 tl_init = 1e-1 tl_list = [ tl_init * math.pow(tl_factor, float(cnt)) for cnt in range(0, num_steps) ] # TIME RESOLUTION dt_factor = 0.5 dt_init = 1 dt_list = [ dt_init * math.pow(dt_factor, float(cnt)) for cnt in range(0, num_steps) ] # NUM TIME STEPS tn_factor = 1.0 / dt_factor tn_init = T_END / dt_init tn_list = [ tn_init * math.pow(tn_factor, float(cnt)) for cnt in range(0, num_steps) ] # NUM MPI PROCESSES np_list = [mpi_num_procs for cnt in range(0, num_steps)] # NUM OMP THREADS nt_list = [omp_num_threads for cnt in range(0, num_steps)] cmd_args = generate_command_args(tl_list,\ dt_list,\ tn_list,\ # de_list,\ # q_list, \ np_list,\ nt_list,\ use_cubic,\ num_steps) utils.execute_commands(cmd_args, 'temporal-spatial')
def conv_temporal_spatial_long_time(): ############################################################################ # TEST 2: CONVERGENCE TEST FOR ADVECTION ############################################################################ mpi_num_procs, omp_num_threads = utils.parse_args() prog = 'advection' dt = 0.0628 vsr = 0 mrg_type = 3 np = mpi_num_procs num_pnts = 8**(math.floor(math.log(np, 8) + 1)) nt = omp_num_threads # UNIFORM dp_list = [5, 6, 7] #, 5 , 6 , 7 ] cq_list = [3, 3, 3] #, 3 , 3 , 3 ] ci_list = [False, False, False] #, False , False , False] uf_list = [2, 2, 2] #, 2 , 2 , 2 ] dt_list = [dt, dt / 2, dt / 4] #, dt , dt/2 , dt/4 ] tn_list = [100, 200, 400] #, 100 , 200 , 400 ] num_steps = len(dp_list) tl_list = [1e-30 for cnt in range(0, num_steps)] # ADAPTIVE # tl_list = [1e-02, 1e-03, 1e-04, 1e-02 , 1e-03 , 1e-04] # dp_list = [15 , 15 , 15 , 15 , 15 , 15 ] # cq_list = [3 , 3 , 3 , 3 , 3 , 3 ] # ci_list = [True , True , True , False , False , False] # uf_list = [2 , 2 , 2 , 2 , 2 , 2 ] # dt_list = [dt , dt/2 , dt/4 , dt , dt/2 , dt/4 ] # tn_list = [100 , 200 , 400 , 100 , 200 , 400 ] num_steps = len(dp_list) pn_list = [num_pnts for cnt in range(0, num_steps)] np_list = [np for cnt in range(0, num_steps)] nt_list = [nt for cnt in range(0, num_steps)] mg_list = [mrg_type for cnt in range(0, num_steps)] vs_list = [vsr for cnt in range(0, num_steps)] cmd_args = OrderedDict() cmd_args = utils.generate_commands(prog, pn_list, tl_list, dp_list, cq_list, ci_list, uf_list, np_list, nt_list, dt_list, tn_list, vs_list, mg_list) utils.execute_commands(cmd_args, 'temporal-spatial-long-time')
def omp(): ############################################################################ # TEST: OMP SCALING ############################################################################ mpi_num_procs, omp_num_threads = utils.parse_args() # prog = 'advection' prog = 'advdiff-ss' dt = 0.0628 vsr = 0 mrg_type = 3 num_pnts = 8**(math.floor(math.log(mpi_num_procs,8)+1)) num_steps = omp_num_threads nt_list = [cnt+1 for cnt in range(0,num_steps)] np_list = [mpi_num_procs for cnt in range(0,num_steps)] tn_list = [10 for cnt in range(0,num_steps)] pn_list = [num_pnts for cnt in range(0,num_steps)] tl_list = [1e-30 for cnt in range(0,num_steps)] dp_list = [4 for cnt in range(0,num_steps)] mg_list = [mrg_type for cnt in range(0,num_steps)] vs_list = [vsr for cnt in range(0,num_steps)] cq_list = [14 for cnt in range(0,num_steps)] ci_list = [True for cnt in range(0,num_steps)] uf_list = [4 for cnt in range(0,num_steps)] dt_list = [dt for cnt in range(0,num_steps)] cmd_args = OrderedDict() cmd_args = utils.generate_commands( prog, pn_list, tl_list, dp_list, cq_list, ci_list, uf_list, np_list, nt_list, dt_list, tn_list, vs_list, mg_list) utils.execute_commands(cmd_args, 'omp'+prog)
def test2(): ############################################################################ # TEST 2: V depth: [6] C depth: [5, 7, 9] config: regular V, irregular C ############################################################################ mpi_num_procs, omp_num_threads = utils.parse_args() num_steps = 3 mt_factor = 1 mt_init = 1 mt_list = [mt_init+cnt*mt_factor for cnt in range(0, num_steps)] de_factor = 0 de_init = 5 de_list = [de_init+cnt*de_factor for cnt in range(0, num_steps)] dt_factor = 1 dt_init = 0.25 dt_list = [dt_init*math.pow(dt_factor,float(cnt)) for cnt in range(0,num_steps)] tn_factor = 1.0 tn_init = 1 tn_list = [tn_init*math.pow(tn_factor,float(cnt)) for cnt in range(0,num_steps)] test_init = 5 test_factor = 0; test_list = [test_init+cnt*test_factor for cnt in range(0,num_steps)] # NUM MPI PROCESSES np_list = [mpi_num_procs for cnt in range(0, num_steps)] # NUM OMP THREADS nt_list = [omp_num_threads for cnt in range(0, num_steps)] cmd_args = generate_command_args(de_list, dt_list, tn_list, test_list, mt_list, np_list, nt_list, num_steps) utils.execute_commands(cmd_args, 'test2')
def test3(): ############################################################################ # TEST 3: V,C depth: [5, 7, 9] config: irregular V, irregular C ############################################################################ mpi_num_procs, omp_num_threads = utils.parse_args() num_steps = 3 mt_factor = 1 mt_init = 1 mt_list = [mt_init + cnt * mt_factor for cnt in range(0, num_steps)] de_factor = 0 de_init = 5 de_list = [de_init + cnt * de_factor for cnt in range(0, num_steps)] dt_factor = 1 dt_init = 0.25 dt_list = [ dt_init * math.pow(dt_factor, float(cnt)) for cnt in range(0, num_steps) ] tn_factor = 1.0 tn_init = 1 tn_list = [ tn_init * math.pow(tn_factor, float(cnt)) for cnt in range(0, num_steps) ] test_init = 6 test_factor = 0 test_list = [test_init + cnt * test_factor for cnt in range(0, num_steps)] # NUM MPI PROCESSES np_list = [mpi_num_procs for cnt in range(0, num_steps)] # NUM OMP THREADS nt_list = [omp_num_threads for cnt in range(0, num_steps)] cmd_args = generate_command_args(de_list, dt_list, tn_list, test_list, mt_list, np_list, nt_list, num_steps) utils.execute_commands(cmd_args, 'test3')
def test1(): mpi_num_procs, omp_num_threads = utils.parse_args() num_steps = 8 T_END = 2 * math.pi ############################################################################ # TEST 1: TEMPORAL ERROR ############################################################################ tl_fact = 1 #0.1 tl_init = 1e-5 tl_list = [ tl_init * math.pow(tl_fact, float(cnt)) for cnt in range(0, num_steps) ] tn_fact = 2 tn_init = 50 tn_list = [ tn_init * math.pow(tn_fact, float(cnt)) for cnt in range(0, num_steps) ] dt_fact = 0.5 dt_init = T_END / tn_init dt_list = [ dt_init * math.pow(dt_fact, float(cnt)) for cnt in range(0, num_steps) ] # NUM MPI PROCESSES np_list = [mpi_num_procs for cnt in range(0, num_steps)] # NUM OMP THREADS nt_list = [omp_num_threads for cnt in range(0, num_steps)] cmd_args = generate_command_args(tl_list,\ dt_list,\ tn_list,\ # de_list,\ # q_list, \ np_list,\ nt_list,\ num_steps) utils.execute_commands(cmd_args, 'table1')
def build_slang(version): versioned_dist = 'slang-' + version.replace('.', '_') for os in OS: for arch in ARCHS: filename_with_ending = filename = f"{versioned_dist}-{os}-{arch}" if os == 'windows': filename_with_ending += ".exe" compress_cmd = f"zip {filename}.zip {filename_with_ending}" else: compress_cmd = f"tar -czvf {filename}.tar.gz {filename_with_ending}" execute_commands([ f"env GOOS={os} GOARCH={arch} go build -o ./ci/release/{filename_with_ending} ./cmd/slang", ]) chdir("./ci/release/") execute_commands([ compress_cmd, f"rm {filename_with_ending}", ]) chdir("../..")
def conv_temporal_spatial(): ############################################################################ # TEST 3: TEMPORAL/SPATIAL CONVERGENCE ############################################################################ use_cubic = True # TREE TOLERANCE tl_factor = 0.1 tl_init = 1e-1 tl_list = [tl_init*math.pow(tl_factor,float(cnt)) for cnt in range(0,num_steps)] # TIME RESOLUTION dt_factor = 0.5 dt_init = 1 dt_list = [dt_init*math.pow(dt_factor,float(cnt)) for cnt in range(0,num_steps)] # NUM TIME STEPS tn_factor = 1.0/dt_factor tn_init = T_END/dt_init tn_list = [tn_init*math.pow(tn_factor,float(cnt)) for cnt in range(0,num_steps)] # NUM MPI PROCESSES np_list = [mpi_num_procs for cnt in range(0, num_steps)] # NUM OMP THREADS nt_list = [omp_num_threads for cnt in range(0, num_steps)] cmd_args = generate_command_args(tl_list,\ dt_list,\ tn_list,\ # de_list,\ # q_list, \ np_list,\ nt_list,\ use_cubic,\ num_steps) utils.execute_commands(cmd_args,'temporal-spatial')
def conv_spatial(): mpi_num_procs, omp_num_threads = utils.parse_args() num_steps = 8 T_END = 0.125 ############################################################################ # TEST 2: SPATIAL ERROR ############################################################################ tl_fact = 0.1 tl_init = 1e-1 tl_list = [tl_init*math.pow(tl_fact,float(cnt)) for cnt in range(0,num_steps)] dt_fact = 1 dt_init = 1e-3 dt_list = [dt_init*math.pow(dt_fact,float(cnt)) for cnt in range(0,num_steps)] tn_fact = 1.0/dt_fact tn_init = 4#T_END/dt_init tn_list = [tn_init*math.pow(tn_fact,float(cnt)) for cnt in range(0,num_steps)] # NUM MPI PROCESSES np_list = [mpi_num_procs for cnt in range(0, num_steps)] # NUM OMP THREADS nt_list = [omp_num_threads for cnt in range(0, num_steps)] cmd_args = generate_command_args(tl_list,\ dt_list,\ tn_list,\ # de_list,\ # q_list, \ np_list,\ nt_list,\ num_steps) utils.execute_commands(cmd_args, 'spatial')
def test1(): mpi_num_procs, omp_num_threads = utils.parse_args() num_steps = 8 T_END = 2*math.pi ############################################################################ # TEST 1: TEMPORAL ERROR ############################################################################ tl_fact = 1#0.1 tl_init = 1e-5 tl_list = [tl_init*math.pow(tl_fact,float(cnt)) for cnt in range(0,num_steps)] tn_fact = 2; tn_init = 50 tn_list = [tn_init*math.pow(tn_fact,float(cnt)) for cnt in range(0,num_steps)] dt_fact = 0.5 dt_init = T_END/tn_init dt_list = [dt_init*math.pow(dt_fact,float(cnt)) for cnt in range(0,num_steps)] # NUM MPI PROCESSES np_list = [mpi_num_procs for cnt in range(0, num_steps)] # NUM OMP THREADS nt_list = [omp_num_threads for cnt in range(0, num_steps)] cmd_args = generate_command_args(tl_list,\ dt_list,\ tn_list,\ # de_list,\ # q_list, \ np_list,\ nt_list,\ num_steps) utils.execute_commands(cmd_args, 'table1')
my_uf_list = [1] else: my_uf_list = uf_list if cq is 4 and tl is 1e-7: continue for uf in my_uf_list: cmd_args[cmd_id] = generate_command_args([tl],\ [cq],\ [uf],\ use_cubic,\ [mpi_num_procs],\ [omp_num_threads],\ 1)[1] cmd_id = cmd_id + 1 # print cmd_args utils.execute_commands(cmd_args, 'table1') # ########################################################################## # # TEST 2: # ########################################################################## tl_list = [\ 1e-2,\ 1e-4,\ 1e-7,\ ] cq_list = [\ # 3,\ 4,\ 6,\ 10,\ 14,\
for tl in tl_list: if cq is 4 and tl is 1e-7: continue for dp in dp_list: # USE UF 4 FOR Q 14 if cq is 14: uf = 4 for np in np_list: ARGS = ['-N' , str(num_pnts), \ '-tol' , str(tl), \ '-d' , str(dp), \ '-q' , str(cq), \ '-cuf' , str(uf), \ '-tn' , str(2), \ '-dt' , str(1e-9), \ '-vs' , str(1), \ '-merge' , str(3), \ '-omp' , str(omp_num_threads)] if use_cubic: ARGS = ARGS + ['-cubic', '1'] cmd_args[cmd_id] = utils.determine_command_prefix(np) + ['valgrind', '--tool=massif','--massif-out-file='+'valgrind-cmd-'+str(cmd_id)+'-%p.mem'] + [EXEC] + ARGS cmd_id = cmd_id + 1 utils.execute_commands(cmd_args, prog+'-table-'+str(table_counter)) table_counter = table_counter + 1 raw_files_list = pp.list_raw_files(os.getcwd(), '.mem') print raw_files_list for raw_file in raw_files_list: os.popen('ms_print '+raw_file+' > '+raw_file+'.ms')
def generate_command_args(max_depth, mpi_num_procs, omp_num_threads): EXEC = os.path.join(utils.TBSLAS_EXAMPLES_BIN_DIR, "advdiff-ss") # generate a dictionary data type of commands cmd_args = OrderedDict() cmd_id = 1 ARGS = ['-N' , '2048', \ '-tol' , '1e-5', \ '-d' , str(max_depth), \ '-dt' , '0.125', \ '-tn' , '5', \ '-test', str(4), \ '-omp' , str(omp_num_threads), \ ] cmd_args[cmd_id] = utils.determine_command_prefix(mpi_num_procs) + [EXEC] + ARGS return cmd_args ################################################################################ # MAIN ################################################################################ if __name__ == '__main__': mpi_num_procs, omp_num_threads = utils.parse_args() max_depth = 7 ############################################################################ # TEST 1: TEMPORAL CONVERGENCE ############################################################################ cmd_args = generate_command_args(max_depth, mpi_num_procs, omp_num_threads) utils.execute_commands(cmd_args, 'vis-advdiff')
from utils import get_commands, execute_commands req_body = '' while req_body != 'exit': req_body = input('Turtle Command$ ') # Check first word in body to see if it is custom command commands = get_commands(req_body) # If custom command, run function associated with it # If not custom command, run the body as normal os command output = execute_commands(commands) print(output)
def conv_spatial(): ############################################################################ # TEMPORAL CONVERGENCE TEST FOR ADVECTION ############################################################################ mpi_num_procs, omp_num_threads = utils.parse_args() prog = 'advection' num_steps = 8 ############################## # TREE TOLERANCE ############################## tl_fact = 0.1 tl_init = 1e-1 tl_list = [ tl_init * math.pow(tl_fact, float(cnt)) for cnt in range(0, num_steps) ] ############################## # TIME RESOLUTION ############################## dt_fact = 1 dt_init = 1e-3 dt_list = [ dt_init * math.pow(dt_fact, float(cnt)) for cnt in range(0, num_steps) ] T_END = 1.0 tn_fact = 1.0 / dt_fact tn_init = 1 #T_END/dt_init tn_list = [ tn_init * math.pow(tn_fact, float(cnt)) for cnt in range(0, num_steps) ] ############################## # TREE DEPTH/POINTS ############################## dp_list = [15 for cnt in range(0, num_steps)] num_pnts = 8**(math.floor(math.log(mpi_num_procs, 8) + 1)) pn_list = [num_pnts for cnt in range(0, num_steps)] ############################## # PARALLEL ############################## mpi_num_procs = mpi_num_procs np_list = [mpi_num_procs for cnt in range(0, num_steps)] nt = omp_num_threads nt_list = [nt for cnt in range(0, num_steps)] mrg_type = 3 mg_list = [mrg_type for cnt in range(0, num_steps)] ############################## # CHEBYSHEV/CUBIC INTERPOLATION ############################## cq_list = [14 for cnt in range(0, num_steps)] ci_list = [True for cnt in range(0, num_steps)] uf_list = [4 for cnt in range(0, num_steps)] ############################## # VISUALIZATION ############################## vtk_save_rate = 0 vs_list = [vtk_save_rate for cnt in range(0, num_steps)] cmd_args = OrderedDict() cmd_args = utils.generate_commands(prog, pn_list, tl_list, dp_list, cq_list, ci_list, uf_list, np_list, nt_list, dt_list, tn_list, vs_list, mg_list) utils.execute_commands(cmd_args, 'spatial')
my_uf_list = [1] else: my_uf_list = uf_list if cq is 4 and tl is 1e-7: continue for uf in my_uf_list: cmd_args[cmd_id] = generate_command_args([tl],\ [cq],\ [uf],\ use_cubic,\ [mpi_num_procs],\ [omp_num_threads],\ 1)[1] cmd_id = cmd_id + 1 # print cmd_args utils.execute_commands(cmd_args, 'table1') # ########################################################################## # # TEST 2: # ########################################################################## tl_list = [\ 1e-2,\ 1e-4,\ 1e-7,\ ] cq_list = [\ # 3,\ 4,\ 6,\ 10,\ 14,\
EXEC = os.path.join(utils.TBSLAS_EXAMPLES_BIN_DIR, "advdiff-ss") # generate a dictionary data type of commands cmd_args = OrderedDict() cmd_id = 1 ARGS = ['-N' , '2048', \ '-tol' , '1e-5', \ '-d' , str(max_depth), \ '-dt' , '0.125', \ '-tn' , '5', \ '-test', str(4), \ '-omp' , str(omp_num_threads), \ ] cmd_args[cmd_id] = utils.determine_command_prefix(mpi_num_procs) + [ EXEC ] + ARGS return cmd_args ################################################################################ # MAIN ################################################################################ if __name__ == '__main__': mpi_num_procs, omp_num_threads = utils.parse_args() max_depth = 7 ############################################################################ # TEST 1: TEMPORAL CONVERGENCE ############################################################################ cmd_args = generate_command_args(max_depth, mpi_num_procs, omp_num_threads) utils.execute_commands(cmd_args, 'vis-advdiff')
cmd_id = 1 ARGS = ['-N' , '4096', \ '-tol' , '1e-2', \ '-d' , str(max_depth), \ '-dt' , '0.0628', \ '-tn' , '500', \ '-test', str(2), \ '-omp' , str(omp_num_threads), \ '-q' , str(4), \ ] if use_cubic: ARGS = ARGS + ['-cubic', '1'] ARGS = ARGS + ['-cuf', '2'] cmd_args[cmd_id] = utils.determine_command_prefix(mpi_num_procs) + [EXEC] + ARGS return cmd_args ################################################################################ # MAIN ################################################################################ if __name__ == '__main__': mpi_num_procs, omp_num_threads = utils.parse_args() max_depth = 8 ############################################################################ # TEST 1: TEMPORAL CONVERGENCE ############################################################################ use_cubic = True cmd_args = generate_command_args(max_depth, mpi_num_procs, omp_num_threads, use_cubic) utils.execute_commands(cmd_args, 'vis-zalesak')
import sys from utils import execute_commands name = 'PACKAGE' if __name__ == '__main__': if len(sys.argv) != 2: print('Usage: python3 package.py vx.y.z') exit(-1) versioned_dist = 'slang-ui-' + sys.argv[1].replace('.', '_') print(f'Step: {name}') execute_commands([ 'mkdir ci/release', f'mv dist {versioned_dist}', f'zip -r ci/release/{versioned_dist}.zip {versioned_dist}', # f'tar -zcvf ci/{versioned_dist}.zip {versioned_dist}', ])
# USE UF 4 FOR Q 14 if cq is 14: uf = 4 for np in np_list: ARGS = ['-N' , str(num_pnts), \ '-tol' , str(tl), \ '-d' , str(dp), \ '-q' , str(cq), \ '-cuf' , str(uf), \ '-tn' , str(2), \ '-dt' , str(1e-9), \ '-vs' , str(1), \ '-merge' , str(3), \ '-omp' , str(omp_num_threads)] if use_cubic: ARGS = ARGS + ['-cubic', '1'] cmd_args[cmd_id] = utils.determine_command_prefix( np) + [ 'valgrind', '--tool=massif', '--massif-out-file=' + 'valgrind-cmd-' + str(cmd_id) + '-%p.mem' ] + [EXEC] + ARGS cmd_id = cmd_id + 1 utils.execute_commands(cmd_args, prog + '-table-' + str(table_counter)) table_counter = table_counter + 1 raw_files_list = pp.list_raw_files(os.getcwd(), '.mem') print raw_files_list for raw_file in raw_files_list: os.popen('ms_print ' + raw_file + ' > ' + raw_file + '.ms')
build_time = int(time.time()) ldflags = f"-X main.Version={version} " ldflags += f"-X main.BuildTime={build_time} " for os in OS: for arch in ARCHS: filename_with_ending = filename = f"{versioned_dist}-{os}-{arch}" if os == 'windows': filename_with_ending += ".exe" compress_cmd = f"zip {filename}.zip {filename_with_ending}" else: compress_cmd = f"tar -czvf {filename}.tar.gz {filename_with_ending}" execute_commands([ f"env GOOS={os} GOARCH={arch} go build -ldflags \"{ldflags}\" -o ./ci/release/{filename_with_ending} ./cmd/slangd", ]) if os == 'windows' and b6k_cs_pw: execute_commands([ f"osslsigncode sign -pkcs12 ./ci/b6k_csc.p12 -pass {b6k_cs_pw} -in ./ci/release/{filename_with_ending} -out ./ci/release/signed_{filename_with_ending}", ], True, False) execute_commands([ f"rm ./ci/release/{filename_with_ending}", f"mv ./ci/release/signed_{filename_with_ending} ./ci/release/{filename_with_ending}", ]) chdir("./ci/release/") execute_commands([ compress_cmd, f"rm {filename_with_ending}",
def scalws(): ############################################################################ # TEST 1: WEAK/STRONG SCALING FOR ADVECTION SOLVER ############################################################################ prog = 'advection' tl_list = [ # 1e+0, 1e-2, 1e-4, 1e-7, ] dp_list = [ # 6, # 8, # 10, 15, ] cq_list = [ 4, 6, 14, ] np_list = [ 1, 2, 4, 8, 16, 32, ] # dt = 7.85398e-03 # tn = 100 dt = 0.0628 tn = 200 use_cubic = True vsr = 0 merge_type = 3 max_np = max(np_list) num_pnts = 8**(math.floor(math.log(max_np,8)+1)) uf = 2 table_counter = 0 for cq in cq_list: for tl in tl_list: if cq is 4 and tl is 1e-7: continue for dp in dp_list: # USE UF 4 FOR Q 14 if cq is 14: uf = 4 cmd_args = OrderedDict() cmd_id = 0 for np in np_list: cmd_args[cmd_id] = utils.generate_commands( prog = prog, pn_list = [num_pnts ], tl_list = [tl ], dp_list = [dp ], cq_list = [cq ], ci_list = [use_cubic ], uf_list = [uf ], np_list = [np ], nt_list = [omp_num_threads ], dt_list = [dt ], tn_list = [tn ], vs_list = [vsr ], mg_list = [merge_type ] )[1] cmd_id = cmd_id + 1 utils.execute_commands(cmd_args, 'scalws'+prog+'-table-'+str(table_counter)) table_counter = table_counter + 1
def conv_temporal_spatial_long_time(): ############################################################################ # TEST 2: CONVERGENCE TEST FOR ADVECTION-DIFFUSION SOLVER ############################################################################ mpi_num_procs, omp_num_threads = utils.parse_args() # prog = 'advdiff-ss' # prog = 'advdiff-ss-tv' prog = 'advdiff-ss-tv-extrap' dt = 0.0628 vtk_save_rate = 0 mrg_type = 3 np = mpi_num_procs num_pnts = 8**(math.floor(math.log(np,8)+1)) nt = omp_num_threads # UNIFORM # dp_list = [5 , 6 , 7 ] # cq_list = [3 , 3 , 3 ] # ci_list = [True , True , True ] # uf_list = [2 , 2 , 2 ] # dt_list = [dt , dt/2 , dt/4 ] # tn_list = [100 , 200 , 400 ] # num_steps = len(dp_list) # tl_list = [1e-30 for cnt in range(0,num_steps)] # ADAPTIVE # LOW ORDER tl_list = [1e-02, 1e-03, 1e-04 ] dp_list = [15 , 15 , 15 ] cq_list = [3 , 3 , 3 ] ci_list = [True , True , True ] uf_list = [2 , 2 , 2 ] dt_list = [dt , dt/2 , dt/3 ] tn_list = [100 , 200 , 300 ] # HIGH ORDER # tl_list = [1e-03, 1e-04, 1e-05, 1e-6 ] # dp_list = [15 , 15 , 15 , 15 ] # cq_list = [14 , 14 , 14 , 14 ] # ci_list = [True , True , True , True ] # uf_list = [2 , 2 , 2 , 2 ] # dt_list = [dt/4 , dt/8 , dt/16, dt/32 ] # tn_list = [400 , 800 , 1600 , 3200 ] num_steps = len(dp_list) pn_list = [num_pnts for cnt in range(0,num_steps)] np_list = [np for cnt in range(0,num_steps)] nt_list = [nt for cnt in range(0,num_steps)] mg_list = [mrg_type for cnt in range(0,num_steps)] vs_list = [vtk_save_rate for cnt in range(0,num_steps)] tt_list = [11 for cnt in range(0,num_steps)] cmd_args = OrderedDict() cmd_args = utils.generate_commands( prog, pn_list, tl_list, dp_list, cq_list, ci_list, uf_list, np_list, nt_list, dt_list, tn_list, vs_list, mg_list, tt_list) utils.execute_commands(cmd_args, 'temporal-spatial-long-time')
def conv_spatial(): ############################################################################ # TEMPORAL CONVERGENCE TEST FOR ADVECTION ############################################################################ mpi_num_procs, omp_num_threads = utils.parse_args() prog = 'advection' num_steps = 8 ############################## # TREE TOLERANCE ############################## tl_fact = 0.1 tl_init = 1e-1 tl_list = [tl_init*math.pow(tl_fact,float(cnt)) for cnt in range(0,num_steps)] ############################## # TIME RESOLUTION ############################## dt_fact = 1 dt_init = 1e-3 dt_list = [dt_init*math.pow(dt_fact,float(cnt)) for cnt in range(0,num_steps)] T_END = 1.0 tn_fact = 1.0/dt_fact tn_init = 1#T_END/dt_init tn_list = [tn_init*math.pow(tn_fact,float(cnt)) for cnt in range(0,num_steps)] ############################## # TREE DEPTH/POINTS ############################## dp_list = [15 for cnt in range(0,num_steps)] num_pnts = 8**(math.floor(math.log(mpi_num_procs,8)+1)) pn_list = [num_pnts for cnt in range(0,num_steps)] ############################## # PARALLEL ############################## mpi_num_procs = mpi_num_procs np_list = [mpi_num_procs for cnt in range(0,num_steps)] nt = omp_num_threads nt_list = [nt for cnt in range(0,num_steps)] mrg_type = 3 mg_list = [mrg_type for cnt in range(0,num_steps)] ############################## # CHEBYSHEV/CUBIC INTERPOLATION ############################## cq_list = [14 for cnt in range(0, num_steps)] ci_list = [True for cnt in range(0, num_steps)] uf_list = [4 for cnt in range(0, num_steps)] ############################## # VISUALIZATION ############################## vtk_save_rate = 0 vs_list = [vtk_save_rate for cnt in range(0,num_steps)] cmd_args = OrderedDict() cmd_args = utils.generate_commands( prog, pn_list, tl_list, dp_list, cq_list, ci_list, uf_list, np_list, nt_list, dt_list, tn_list, vs_list, mg_list) utils.execute_commands(cmd_args, 'spatial')
#!/usr/bin/env python import click from utils import get_txt_input, get_cmd_input, execute_commands @click.command() def hello(): click.echo('Project 2 Test!') #if __name__ == '__main__': #hello() if __name__ == '__main__': # Executes script from command prompt try: lines = get_txt_input() except (IndexError, FileNotFoundError): lines = get_cmd_input() print('') execute_commands(lines)
import sys from utils import execute_commands if __name__ == '__main__': if len(sys.argv) != 2: print('Usage: python3 package.py vx.y.z') exit(-1) versioned_dist = 'slang-lib-' + sys.argv[1].replace('.', '_') execute_commands([ f'mkdir {versioned_dist}', f'cp -r slang {versioned_dist}/', 'mkdir ci/release', f'zip -r ci/release/{versioned_dist}.zip {versioned_dist}', # f'tar -zcvf ci/{versioned_dist}.zip {versioned_dist}', ])
'-dt' , '0.0628', \ '-tn' , '500', \ '-test', str(2), \ '-omp' , str(omp_num_threads), \ '-q' , str(4), \ ] if use_cubic: ARGS = ARGS + ['-cubic', '1'] ARGS = ARGS + ['-cuf', '2'] cmd_args[cmd_id] = utils.determine_command_prefix(mpi_num_procs) + [ EXEC ] + ARGS return cmd_args ################################################################################ # MAIN ################################################################################ if __name__ == '__main__': mpi_num_procs, omp_num_threads = utils.parse_args() max_depth = 8 ############################################################################ # TEST 1: TEMPORAL CONVERGENCE ############################################################################ use_cubic = True cmd_args = generate_command_args(max_depth, mpi_num_procs, omp_num_threads, use_cubic) utils.execute_commands(cmd_args, 'vis-zalesak')