Skip to content

Commit

Permalink
Merge pull request #57 from upb-lea/nn
Browse files Browse the repository at this point in the history
add paths creation if not exist
  • Loading branch information
tillpiepenbrock authored Oct 31, 2023
2 parents 92a1285 + 3c37d63 commit 928e37e
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions femmt/examples/hpc_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,14 +166,20 @@ def parallel_simulation_study(averaging_count):

if __name__ == "__main__":
# ---- Choosing the execution ----
# execution_type = "default_example"
execution_type = "default_example"
# execution_type = "custom_hpc"
execution_type = "parallel_study"
# execution_type = "parallel_study"

if execution_type == "default_example":
example_results_folder = os.path.join(os.path.dirname(__file__), "example_results")
if not os.path.exists(example_results_folder):
os.mkdir(example_results_folder)
parallel_results_folder = os.path.join(example_results_folder, "parallel")
if not os.path.exists(parallel_results_folder):
os.mkdir(parallel_results_folder)
working_directory = os.path.join(parallel_results_folder, "default")
if not os.path.exists(working_directory):
os.mkdir(working_directory)

number_of_models = 10
number_of_processes = 5
Expand All @@ -198,8 +204,14 @@ def parallel_simulation_study(averaging_count):

elif execution_type == "custom_hpc":
example_results_folder = os.path.join(os.path.dirname(__file__), "example_results")
if not os.path.exists(example_results_folder):
os.mkdir(example_results_folder)
parallel_results_folder = os.path.join(example_results_folder, "parallel")
if not os.path.exists(parallel_results_folder):
os.mkdir(parallel_results_folder)
working_directory = os.path.join(parallel_results_folder, "default")
if not os.path.exists(working_directory):
os.mkdir(working_directory)

number_of_models = 8
number_of_processes = 4
Expand All @@ -223,6 +235,16 @@ def parallel_simulation_study(averaging_count):
print(f"Execution time: {execution_time}")

elif execution_type == "parallel_study":
example_results_folder = os.path.join(os.path.dirname(__file__), "example_results")
if not os.path.exists(example_results_folder):
os.mkdir(example_results_folder)
parallel_results_folder = os.path.join(example_results_folder, "parallel")
if not os.path.exists(parallel_results_folder):
os.mkdir(parallel_results_folder)
working_directory = os.path.join(parallel_results_folder, "default")
if not os.path.exists(working_directory):
os.mkdir(working_directory)

parallel_simulation_study(3)
else:
raise Exception(f"Execution type {execution_type} not found.")
Expand Down

0 comments on commit 928e37e

Please sign in to comment.