Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion dsl/pace/dsl/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,15 @@
DTypes = Union[bool, np.bool_, int, np.int32, np.int64, float, np.float32, np.float64]


def floating_point_precision() -> int:
return int(os.getenv("PACE_FLOAT_PRECISION", "64"))


def global_set_floating_point_precision():
"""Set the global floating point precision for all reference
to Float in the codebase. Defaults to 64 bit."""
global Float
precision_in_bit = int(os.getenv("PACE_FLOAT_PRECISION", "64"))
precision_in_bit = floating_point_precision()
if precision_in_bit == 64:
return np.float64
elif precision_in_bit == 32:
Expand Down
28 changes: 23 additions & 5 deletions fv3core/pace/fv3core/initialization/geos_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
from pace.driver.performance.collector import PerformanceCollector
from pace.dsl.dace import DaceConfig, orchestrate
from pace.dsl.gt4py_utils import is_gpu_backend
from pace.dsl.typing import floating_point_precision
from pace.util._optional_imports import cupy as cp
from pace.util.logging import pace_log


Expand Down Expand Up @@ -131,13 +133,29 @@ def __init__(
self.output_dict: Dict[str, np.ndarray] = {}
self._allocate_output_dir()

# Feedback information
device_ordinal_info = (
f" Device PCI bus id: {cp.cuda.Device(0).pci_bus_id}\n"
if is_gpu_backend(backend)
else "N/A"
)
MPS_pipe_directory = os.getenv("CUDA_MPS_PIPE_DIRECTORY", None)
MPS_is_on = (
MPS_pipe_directory
and is_gpu_backend(backend)
and os.path.exists(f"{MPS_pipe_directory}/log")
)
pace_log.info(
"Pace GEOS wrapper initialized: \n"
f" dt : {self.dycore_state.bdt}\n"
f" bridge : {self._fortran_mem_space} > {self._pace_mem_space}\n"
f" backend: {backend}\n"
f" orchestration: {self._is_orchestrated}\n"
f" sizer : {sizer.nx}x{sizer.ny}x{sizer.nz} (halo: {sizer.n_halo})"
f" dt : {self.dycore_state.bdt}\n"
f" bridge : {self._fortran_mem_space} > {self._pace_mem_space}\n"
f" backend : {backend}\n"
f" float : {floating_point_precision()}bit"
f" orchestration : {self._is_orchestrated}\n"
f" sizer : {sizer.nx}x{sizer.ny}x{sizer.nz}"
f"(halo: {sizer.n_halo})\n"
f" {device_ordinal_info}"
f" Nvidia MPS : {MPS_is_on}"
)

def _critical_path(self):
Expand Down
64 changes: 31 additions & 33 deletions util/pace/util/grid/eta.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,6 @@ def set_hybrid_pressure_coefficients(km: int) -> HybridPressureCoefficients:
)

elif km == 91:

ak = np.array(
[
1.00000000,
Expand Down Expand Up @@ -402,7 +401,6 @@ def set_hybrid_pressure_coefficients(km: int) -> HybridPressureCoefficients:
)

elif km == 72:

ak = np.array(
[
1.00000000,
Expand Down Expand Up @@ -560,7 +558,6 @@ def set_hybrid_pressure_coefficients(km: int) -> HybridPressureCoefficients:
)

elif km == 137:

ak = np.array(
[
1.00000000,
Expand Down Expand Up @@ -761,35 +758,35 @@ def set_hybrid_pressure_coefficients(km: int) -> HybridPressureCoefficients:
0.00000000,
0.00000000,
0.00000000,
7.00000010E-06,
2.40000008E-05,
5.90000018E-05,
1.12000002E-04,
1.99000002E-04,
3.39999999E-04,
5.61999972E-04,
8.90000025E-04,
1.35300006E-03,
1.99200003E-03,
2.85700010E-03,
3.97100020E-03,
5.37799997E-03,
7.13300006E-03,
9.26099997E-03,
1.18060000E-02,
1.48160001E-02,
1.83179993E-02,
2.23549996E-02,
2.69639995E-02,
3.21759991E-02,
3.80260013E-02,
4.45480011E-02,
5.17730005E-02,
5.97280003E-02,
6.84479997E-02,
7.79580027E-02,
8.82859975E-02,
9.94620025E-02,
7.00000010e-06,
2.40000008e-05,
5.90000018e-05,
1.12000002e-04,
1.99000002e-04,
3.39999999e-04,
5.61999972e-04,
8.90000025e-04,
1.35300006e-03,
1.99200003e-03,
2.85700010e-03,
3.97100020e-03,
5.37799997e-03,
7.13300006e-03,
9.26099997e-03,
1.18060000e-02,
1.48160001e-02,
1.83179993e-02,
2.23549996e-02,
2.69639995e-02,
3.21759991e-02,
3.80260013e-02,
4.45480011e-02,
5.17730005e-02,
5.97280003e-02,
6.84479997e-02,
7.79580027e-02,
8.82859975e-02,
9.94620025e-02,
0.111505002,
0.124448001,
0.138312995,
Expand Down Expand Up @@ -849,7 +846,8 @@ def set_hybrid_pressure_coefficients(km: int) -> HybridPressureCoefficients:

else:
raise NotImplementedError(
"Only grids with 72, 79, 91 or 137 vertical levels have been implemented so far"
"Only grids with 72, 79, 91 or 137 vertical levels"
"have been implemented so far"
)

if 0.0 in bk:
Expand Down