You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* check that premade rundir folder exists. If not, try second option, if still not raise valueerror
* typo
* Force setup_run_directory function to raise AttributeError if it doesn't have access to a cpu layout rather than throw generic error
* black
print("Could not find premade run directories at ", premade_rundir_path)
1431
+
print(
1432
+
"Perhaps the package was imported directly rather than installed with conda. Checking if this is the case... "
1433
+
)
1434
+
1435
+
premade_rundir_path=Path(
1436
+
importlib.resources.files("regional_mom6").parent
1437
+
/"demos/premade_run_directories"
1438
+
)
1439
+
ifnotpremade_rundir_path.exists():
1440
+
raiseValueError(
1441
+
f"Cannot find the premade run directory files at {premade_rundir_path} either.\n\n"
1442
+
+"There may be an issue with package installation. Check that the `premade_run_directory` folder is present in one of these two locations"
1443
+
)
1428
1444
1429
1445
# Define the locations of the directories we'll copy files across from. Base contains most of the files, and overwrite replaces files in the base directory.
1430
1446
base_run_dir=premade_rundir_path/"common_files"
@@ -1490,18 +1506,32 @@ def setup_run_directory(
1490
1506
mask_table=p.name
1491
1507
x, y= (int(v) forvinlayout.split("x"))
1492
1508
ncpus= (x*y) -int(masked)
1493
-
ifmask_table==None:
1509
+
layout= (
1510
+
x,
1511
+
y,
1512
+
) # This is a local variable keeping track of the layout as read from the mask table. Not to be confused with self.layout which is unchanged and may differ.
1513
+
1494
1514
print(
1495
-
"No mask table found! This suggests the domain is mostly water, so there are "
1496
-
+"no `non compute` cells that are entirely land. If this doesn't seem right, "
1497
-
+"ensure you've already run `FRE_tools`."
1515
+
f"Mask table {p.name} read. Using this to infer the cpu layout {layout}, total masked out cells {masked}, and total number of CPUs {ncpus}."
1498
1516
)
1499
-
ifnothasattr(self, "layout"):
1517
+
1518
+
ifmask_table==None:
1519
+
ifself.layout==None:
1500
1520
raiseAttributeError(
1501
-
"No layout information found. This suggests that `FRE_tools()` hasn't been called yet. "
1502
-
+"Please do so, in order for the number of processors required is computed."
1521
+
"No mask table found, and the cpu layout has not been set. At least one of these is requiret to set up the experiment."
1503
1522
)
1504
-
ncpus=self.layout[0] *self.layout[1]
1523
+
print(
1524
+
f"No mask table found, but the cpu layout has been set to {self.layout} This suggests the domain is mostly water, so there are "
1525
+
+"no `non compute` cells that are entirely land. If this doesn't seem right, "
1526
+
+"ensure you've already run the `FRE_tools` method which sets up the cpu mask table. Keep an eye on any errors that might print while"
1527
+
+"the FRE tools (which run C++ in the background) are running."
1528
+
)
1529
+
# Here we define a local copy of the layout just for use within this function.
1530
+
# This prevents the layout from being overwritten in the main class in case
1531
+
# in case the user accidentally loads in the wrong mask table.
1532
+
layout=self.layout
1533
+
ncpus=layout[0] *layout[1]
1534
+
1505
1535
print("Number of CPUs required: ", ncpus)
1506
1536
1507
1537
## Modify the input namelists to give the correct layouts
0 commit comments