Skip to content

Commit

Permalink
Finished adding cluster exectution model, will test multi-node deploy…
Browse files Browse the repository at this point in the history
…ment on HPC next
  • Loading branch information
shellshocked2003 committed Oct 19, 2022
1 parent bc6fda0 commit 8d93c72
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 21 deletions.
6 changes: 1 addition & 5 deletions src/UQpy/run_model/RunModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,17 +206,13 @@ def parallel_execution(self):
f"{self.n_new_simulations}")

elif self.run_type is RunType.CLUSTER:
print("YEEEEEHAAAAA!!!!!")
if self.cluster_script is None:
raise ValueError("\nUQpy: User-provided slurm script not input, please provide this input\n")
os.system(f"python -m UQpy.run_model.model_execution.ClusterExecution {self.cores_per_task} "
f"{self.n_new_simulations} {self.n_existing_simulations} {self.cluster_script}")

print("DONE WITH CLUSTER")

else:
raise ValueError("\nUQpy: RunType is not in currently supported list of cluster types\n")

with open('qoi.pkl', 'rb') as filehandle:
results = pickle.load(filehandle)

Expand Down
19 changes: 3 additions & 16 deletions src/UQpy/run_model/model_execution/ClusterExecution.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import pickle

try:
print("Oh boy....")
model = None
samples = None
samples_per_process = 0
Expand All @@ -30,9 +29,6 @@
with open('samples.pkl', 'rb') as filehandle:
samples = pickle.load(filehandle)

print(len(samples))
print(samples[0].shape)

# Loop over the number of samples and create input files in a folder in current directory
for i in range(len(samples)):
new_text = model._find_and_replace_var_names_with_values(samples[i])
Expand All @@ -48,7 +44,6 @@

# Run user-provided cluster script--for now, it is assumed the user knows how to
# tile jobs in the script
print("This is the cluster script:", cluster_script)
os.system(f"{cluster_script} {cores_per_task} {n_new_simulations} {n_existing_simulations}")

results = []
Expand All @@ -63,20 +58,12 @@
output = model._output_serial(i)
results.append(output)

# Change back to model directory
os.chdir(model.model_dir)

with open('qoi.pkl', 'wb') as filehandle:
pickle.dump(results, filehandle)



# CONTINUE HERE TO SEE


# if comm.rank == 0:
# result = []
# [result.extend(el) for el in qoi]
# with open('qoi.pkl', 'wb') as filehandle:
# pickle.dump(result, filehandle)

except Exception as e:
print(e)

0 comments on commit 8d93c72

Please sign in to comment.