Commit a5a02a02 authored by Leon Pyka's avatar Leon Pyka
Browse files

added env variables to only run one thread

parent 56a4ea7d
Loading
Loading
Loading
Loading
+9 −4
Original line number Diff line number Diff line
import sys
import os
import numpy as np
import mechnet as mn
from multiprocessing import Pool
@@ -7,6 +8,10 @@ sys.path.append("/home/lpyka/hierarchical_interface/")
from lib.push_data import push_data_to, copy_runfile_to 
from lib.my_plot_edges import plot_edges_mechnet_network 

os.environ["OMP_NUM_THREADS"] = "1"
os.environ["OPENBLAS_NUM_THREADS"] = "1"
os.environ["MKL_NUM_THREADS"] = "1"

def get_parametercollection(seed,crack_length, offset):
    par = mn.ParameterCollection()
    nx = 128 # needs to == el**h
@@ -62,7 +67,7 @@ def run_a_simulation_fuse(seed, crack_length, offset):
    simulation = mn.sim.Simulation(builder, solver, intrescal, outgen, applier, checker)
    
    dict_of_crs_edge_data = bounded_network.get_network_data() 
    simdata = simulation.start_simulation(dict_of_crs_edge_data, dict_of_simulation_parameters)
    simdata = simulation.start_simulation(dict_of_crs_edge_data, dict_of_simulation_parameters, maximum_runtime=4*85)
    
    simdata_dict = simdata.get_simdata_dict()
    network_descriptor_dict = bounded_network.get_construction_data()
@@ -73,12 +78,12 @@ def run_a_simulation_fuse(seed, crack_length, offset):
if __name__=="__main__":
    list_of_seeds =  []
    offset = 5
    for seed in range(1000, 1010):
    for seed in range(1010, 1050):
            list_of_seeds.append(seed) 
    crack_lengths = [20, 30, 40, 50,]
    crack_lengths = [10, 20, 30, 40, 50]
    for crack_length in crack_lengths:
        
        with Pool(10) as p:
        with Pool(40) as p:
            results = p.map(partial(run_a_simulation_fuse, crack_length=crack_length, offset=offset), list_of_seeds)
 #   for data in results:
 #       mn.datman.save_simulation_output(data[0], data[1], data[2], data[3], targetdirectory="./", suffix="", overwritemode=False)