jonghanko commited on
Commit
8622a4b
·
verified ·
1 Parent(s): 7ee1b6a

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_C/_VariableFunctions.pyi +0 -0
  2. Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_C/_autograd.pyi +138 -0
  3. Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_C/_distributed_c10d.pyi +757 -0
  4. Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_C/_distributed_rpc.pyi +188 -0
  5. Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_C/_distributed_rpc_testing.pyi +32 -0
  6. Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_C/_export.pyi +10 -0
  7. Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_C/_functions.pyi +19 -0
  8. Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_C/_functorch.pyi +83 -0
  9. Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_C/_instruction_counter.pyi +4 -0
  10. Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_C/_itt.pyi +5 -0
  11. Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_C/_lazy.pyi +26 -0
  12. Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_C/_lazy_ts_backend.pyi +12 -0
  13. Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_C/_monitor.pyi +58 -0
  14. Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_C/_nn.pyi +89 -0
  15. Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_C/_nvtx.pyi +9 -0
  16. Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_C/_onnx.pyi +39 -0
  17. Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_C/_profiler.pyi +246 -0
  18. Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_C/_verbose.pyi +3 -0
  19. Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_awaits/__init__.py +53 -0
  20. Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_awaits/__pycache__/__init__.cpython-310.pyc +0 -0
  21. Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_functorch/__init__.py +5 -0
  22. Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_functorch/__pycache__/__init__.cpython-310.pyc +0 -0
  23. Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_functorch/__pycache__/aot_autograd.cpython-310.pyc +0 -0
  24. Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_functorch/__pycache__/apis.cpython-310.pyc +0 -0
  25. Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_functorch/__pycache__/autograd_function.cpython-310.pyc +0 -0
  26. Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_functorch/__pycache__/batch_norm_replacement.cpython-310.pyc +0 -0
  27. Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_functorch/__pycache__/compile_utils.cpython-310.pyc +0 -0
  28. Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_functorch/__pycache__/config.cpython-310.pyc +0 -0
  29. Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_functorch/__pycache__/deprecated.cpython-310.pyc +0 -0
  30. Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_functorch/__pycache__/eager_transforms.cpython-310.pyc +0 -0
  31. Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_functorch/__pycache__/functional_call.cpython-310.pyc +0 -0
  32. Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_functorch/__pycache__/make_functional.cpython-310.pyc +0 -0
  33. Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_functorch/__pycache__/partitioners.cpython-310.pyc +0 -0
  34. Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_functorch/__pycache__/pyfunctorch.cpython-310.pyc +0 -0
  35. Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_functorch/__pycache__/utils.cpython-310.pyc +0 -0
  36. Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_functorch/__pycache__/vmap.cpython-310.pyc +0 -0
  37. Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_functorch/_activation_checkpointing/__init__.py +5 -0
  38. Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_functorch/_activation_checkpointing/__pycache__/__init__.cpython-310.pyc +0 -0
  39. Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_functorch/_activation_checkpointing/__pycache__/ac_logging_utils.cpython-310.pyc +0 -0
  40. Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_functorch/_activation_checkpointing/__pycache__/graph_info_provider.cpython-310.pyc +0 -0
  41. Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_functorch/_activation_checkpointing/__pycache__/knapsack.cpython-310.pyc +0 -0
  42. Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_functorch/_activation_checkpointing/__pycache__/knapsack_evaluator.cpython-310.pyc +0 -0
  43. Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_functorch/_activation_checkpointing/ac_logging_utils.py +145 -0
  44. Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_functorch/_activation_checkpointing/graph_info_provider.py +321 -0
  45. Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_functorch/_activation_checkpointing/knapsack.py +121 -0
  46. Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_functorch/_activation_checkpointing/knapsack_evaluator.py +261 -0
  47. Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_functorch/_aot_autograd/__init__.py +5 -0
  48. Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_functorch/_aot_autograd/__pycache__/__init__.cpython-310.pyc +0 -0
  49. Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_functorch/_aot_autograd/__pycache__/autograd_cache.cpython-310.pyc +0 -0
  50. Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_functorch/_aot_autograd/__pycache__/collect_metadata_analysis.cpython-310.pyc +0 -0
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_C/_VariableFunctions.pyi ADDED
The diff for this file is too large to render. See raw diff
 
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_C/_autograd.pyi ADDED
@@ -0,0 +1,138 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # mypy: allow-untyped-defs
2
+ from enum import Enum
3
+ from typing import Any, Callable
4
+
5
+ import torch
6
+ from torch._C._profiler import (
7
+ _ProfilerEvent,
8
+ ActiveProfilerType,
9
+ ProfilerActivity,
10
+ ProfilerConfig,
11
+ )
12
+
13
+ # Defined in torch/csrc/autograd/init.cpp
14
+
15
+ class DeviceType(Enum):
16
+ CPU = ...
17
+ CUDA = ...
18
+ XPU = ...
19
+ MKLDNN = ...
20
+ OPENGL = ...
21
+ OPENCL = ...
22
+ IDEEP = ...
23
+ HIP = ...
24
+ FPGA = ...
25
+ MAIA = ...
26
+ XLA = ...
27
+ MTIA = ...
28
+ MPS = ...
29
+ HPU = ...
30
+ Meta = ...
31
+ Vulkan = ...
32
+ Metal = ...
33
+ PrivateUse1 = ...
34
+
35
+ class ProfilerEvent:
36
+ def cpu_elapsed_us(self, other: ProfilerEvent) -> float: ...
37
+ def cpu_memory_usage(self) -> int: ...
38
+ def cuda_elapsed_us(self, other: ProfilerEvent) -> float: ...
39
+ def privateuse1_elapsed_us(self, other: ProfilerEvent) -> float: ...
40
+ def cuda_memory_usage(self) -> int: ...
41
+ def device(self) -> int: ...
42
+ def handle(self) -> int: ...
43
+ def has_cuda(self) -> bool: ...
44
+ def is_remote(self) -> bool: ...
45
+ def kind(self) -> int: ...
46
+ def name(self) -> str: ...
47
+ def node_id(self) -> int: ...
48
+ def sequence_nr(self) -> int: ...
49
+ def shapes(self) -> list[list[int]]: ...
50
+ def thread_id(self) -> int: ...
51
+ def flops(self) -> float: ...
52
+ def is_async(self) -> bool: ...
53
+
54
+ class _KinetoEvent:
55
+ def name(self) -> str: ...
56
+ def overload_name(self) -> str: ...
57
+ def device_index(self) -> int: ...
58
+ def device_resource_id(self) -> int: ...
59
+ def start_ns(self) -> int: ...
60
+ def end_ns(self) -> int: ...
61
+ def duration_ns(self) -> int: ...
62
+ def is_async(self) -> bool: ...
63
+ def linked_correlation_id(self) -> int: ...
64
+ def shapes(self) -> list[list[int]]: ...
65
+ def dtypes(self) -> list[str]: ...
66
+ def concrete_inputs(self) -> list[Any]: ...
67
+ def kwinputs(self) -> dict[str, Any]: ...
68
+ def device_type(self) -> DeviceType: ...
69
+ def start_thread_id(self) -> int: ...
70
+ def end_thread_id(self) -> int: ...
71
+ def correlation_id(self) -> int: ...
72
+ def fwd_thread_id(self) -> int: ...
73
+ def stack(self) -> list[str]: ...
74
+ def scope(self) -> int: ...
75
+ def sequence_nr(self) -> int: ...
76
+ def flops(self) -> int: ...
77
+ def cuda_elapsed_us(self) -> int: ...
78
+ def privateuse1_elapsed_us(self) -> int: ...
79
+ def is_user_annotation(self) -> bool: ...
80
+
81
+ class _ProfilerResult:
82
+ def events(self) -> list[_KinetoEvent]: ...
83
+ def legacy_events(self) -> list[list[ProfilerEvent]]: ...
84
+ def save(self, path: str) -> None: ...
85
+ def experimental_event_tree(self) -> list[_ProfilerEvent]: ...
86
+ def trace_start_ns(self) -> int: ...
87
+
88
+ class SavedTensor: ...
89
+
90
+ def _enable_profiler(
91
+ config: ProfilerConfig,
92
+ activities: set[ProfilerActivity],
93
+ ) -> None: ...
94
+ def _prepare_profiler(
95
+ config: ProfilerConfig,
96
+ activities: set[ProfilerActivity],
97
+ ) -> None: ...
98
+ def _toggle_collection_dynamic(
99
+ enable: bool,
100
+ activities: set[ProfilerActivity],
101
+ ) -> None: ...
102
+ def _disable_profiler() -> _ProfilerResult: ...
103
+ def _profiler_enabled() -> bool: ...
104
+ def _add_metadata_json(key: str, value: str) -> None: ...
105
+ def _kineto_step() -> None: ...
106
+ def _get_current_graph_task_keep_graph() -> bool: ...
107
+ def _get_sequence_nr() -> int: ...
108
+ def kineto_available() -> bool: ...
109
+ def _record_function_with_args_enter(name: str, *args) -> torch.Tensor: ...
110
+ def _record_function_with_args_exit(handle: torch.Tensor) -> None: ...
111
+ def _supported_activities() -> set[ProfilerActivity]: ...
112
+ def _enable_record_function(enable: bool) -> None: ...
113
+ def _set_empty_test_observer(is_global: bool, sampling_prob: float) -> None: ...
114
+ def _push_saved_tensors_default_hooks(
115
+ pack_hook: Callable[[torch.Tensor], Any],
116
+ unpack_hook: Callable[[Any], torch.Tensor],
117
+ ) -> None: ...
118
+ def _pop_saved_tensors_default_hooks() -> None: ...
119
+ def _unsafe_set_version_counter(
120
+ t: tuple[torch.Tensor, ...], prev_version: tuple[int, ...]
121
+ ) -> None: ...
122
+ def _enable_profiler_legacy(config: ProfilerConfig) -> None: ...
123
+ def _disable_profiler_legacy() -> list[list[ProfilerEvent]]: ...
124
+ def _profiler_type() -> ActiveProfilerType: ...
125
+ def _saved_tensors_hooks_enable() -> None: ...
126
+ def _saved_tensors_hooks_disable(message: str) -> None: ...
127
+ def _saved_tensors_hooks_get_disabled_error_message() -> str | None: ...
128
+ def _saved_tensors_hooks_set_tracing(is_tracing: bool) -> bool: ...
129
+
130
+ class CreationMeta(Enum):
131
+ DEFAULT = ...
132
+ IN_CUSTOM_FUNCTION = ...
133
+ MULTI_OUTPUT_NODE = ...
134
+ NO_GRAD_MODE = ...
135
+ INFERENCE_MODE = ...
136
+
137
+ def _set_creation_meta(t: torch.Tensor, creation_meta: CreationMeta) -> None: ...
138
+ def _get_creation_meta(t: torch.Tensor) -> CreationMeta: ...
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_C/_distributed_c10d.pyi ADDED
@@ -0,0 +1,757 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # mypy: allow-untyped-defs
2
+ # mypy: disable-error-code="type-arg"
3
+ from datetime import timedelta
4
+ from enum import Enum
5
+ from typing import Any, overload
6
+
7
+ import torch
8
+ from torch import Tensor
9
+ from torch._C import ScriptObject
10
+ from torch._C._autograd import DeviceType
11
+ from torch.futures import Future
12
+
13
+ # This module is defined in torch/csrc/distributed/c10d/init.cpp
14
+
15
+ _DEFAULT_FIRST_BUCKET_BYTES: int
16
+ _DEFAULT_NO_TIMEOUT: timedelta
17
+ _DEFAULT_PG_TIMEOUT: timedelta
18
+ _DEFAULT_PG_NCCL_TIMEOUT: timedelta
19
+
20
+ class BuiltinCommHookType(Enum):
21
+ ALLREDUCE = ...
22
+ FP16_COMPRESS = ...
23
+
24
+ def _register_comm_hook(reducer: Reducer, state: Any, comm_hook: Any): ...
25
+ def _register_builtin_comm_hook(
26
+ reducer: Reducer,
27
+ comm_hook_type: BuiltinCommHookType,
28
+ ): ...
29
+ def _set_global_rank(rank: int) -> None: ...
30
+ def _hash_tensors(tensors: list[Tensor]) -> int: ...
31
+
32
+ class GradBucket:
33
+ def index(self) -> int: ...
34
+ def buffer(self) -> Tensor: ...
35
+ def gradients(self) -> list[Tensor]: ...
36
+ def is_last(self) -> bool: ...
37
+ def set_buffer(self, tensor: Tensor) -> None: ...
38
+ def parameters(self) -> list[Tensor]: ...
39
+
40
+ class Reducer:
41
+ def __init__(
42
+ self,
43
+ params: list[Tensor],
44
+ bucket_indices: list[list[int]],
45
+ per_bucket_size_limits: list[int],
46
+ process_group: ProcessGroup,
47
+ expect_sparse_gradients: list[bool] = ...,
48
+ bucket_bytes_cap: int = ..., # kDefaultBucketBytesCap in reducer.hpp
49
+ find_unused_parameters: bool = ...,
50
+ gradient_as_bucket_view: bool = ...,
51
+ param_to_name_mapping: dict[int, str] = ...,
52
+ first_bucket_types_cap: int = ..., # kDefaultFirstBucketBytes in reducer.hpp
53
+ ) -> None: ...
54
+ def prepare_for_forward(self) -> None: ...
55
+ def prepare_for_backward(self, output: list[Tensor]) -> None: ...
56
+ def get_backward_stats(self) -> list[int]: ...
57
+ def _install_post_backward_futures(self, futures: list[Future]) -> None: ...
58
+ def _rebuild_buckets(self) -> bool: ...
59
+ def _get_zeros_like_grad_buckets(self) -> list[GradBucket]: ...
60
+ def _push_all_rebuilt_params(self) -> None: ...
61
+ def _set_forward_pass_work_handle(
62
+ self,
63
+ work: Work,
64
+ use_static_world_size: bool,
65
+ ): ...
66
+ def _get_local_used_map(self) -> Tensor: ...
67
+ def _set_ddp_runtime_logging_sample_rate(self, sample_rate: int) -> None: ...
68
+ def _set_static_graph(self) -> None: ...
69
+ def _run_comm_hook(self, bucket: GradBucket) -> Future: ...
70
+ def set_logger(self, logger: Logger) -> None: ...
71
+ def _remove_autograd_hooks(self) -> None: ...
72
+ def _check_reducer_finalized(self) -> None: ...
73
+ def _set_sparse_metadata(self, global_unique_ids: dict[str, Tensor]) -> None: ...
74
+ def _reset_state(self) -> None: ...
75
+ def _update_process_group(self, new_process_group: ProcessGroup) -> None: ...
76
+
77
+ class DDPLoggingData:
78
+ strs_map: dict[str, str]
79
+ ints_map: dict[str, int]
80
+
81
+ class Logger:
82
+ def __init__(self, reducer: Reducer) -> None: ...
83
+ def set_construction_data_and_log(
84
+ self,
85
+ module_name: str,
86
+ device_ids: list[int],
87
+ output_device: int,
88
+ broadcast_buffers: bool,
89
+ has_sync_bn: bool,
90
+ static_graph: bool,
91
+ ): ...
92
+ def set_runtime_stats_and_log(self) -> None: ...
93
+ def set_error_and_log(self, error: str) -> None: ...
94
+ def _get_ddp_logging_data(self) -> DDPLoggingData: ...
95
+ def _set_comm_hook_name(self, comm_hook: str) -> None: ...
96
+ def _set_uneven_input_join(self) -> None: ...
97
+ def _set_static_graph(self) -> None: ...
98
+
99
+ class _WorkerServer:
100
+ def __init__(self, socket_path: str) -> None: ...
101
+ def shutdown(self) -> None: ...
102
+
103
+ def get_debug_level(): ...
104
+ def set_debug_level(): ...
105
+ def set_debug_level_from_env(): ...
106
+
107
+ class DebugLevel(Enum):
108
+ OFF = ...
109
+ INFO = ...
110
+ DETAIL = ...
111
+
112
+ class ReduceOp:
113
+ def __init__(self, op: RedOpType) -> None: ...
114
+
115
+ SUM: RedOpType = ...
116
+ AVG: RedOpType = ...
117
+ PRODUCT: RedOpType = ...
118
+ MIN: RedOpType = ...
119
+ MAX: RedOpType = ...
120
+ BAND: RedOpType = ...
121
+ BOR: RedOpType = ...
122
+ BXOR: RedOpType = ...
123
+ PREMUL_SUM: RedOpType = ...
124
+ UNUSED: RedOpType = ...
125
+
126
+ # mypy error being ignored:
127
+ # Detected enum "torch._C._distributed_c10d.ReduceOp.RedOpType" in a type
128
+ # stub with zero members. There is a chance this is due to a recent change
129
+ # in the semantics of enum membership. If so, use `member = value` to mark
130
+ # an enum member, instead of `member: type`
131
+ class RedOpType(Enum): ... # type: ignore[misc]
132
+
133
+ class BroadcastOptions:
134
+ rootRank: int
135
+ rootTensor: int
136
+ timeout: timedelta
137
+ asyncOp: bool
138
+
139
+ class AllreduceOptions:
140
+ reduceOp: ReduceOp
141
+ timeout: timedelta
142
+
143
+ class AllreduceCoalescedOptions(AllreduceOptions): ...
144
+
145
+ class ReduceOptions:
146
+ reduceOp: ReduceOp
147
+ rootRank: int
148
+ rootTensor: int
149
+ timeout: timedelta
150
+
151
+ class AllgatherOptions:
152
+ timeout: timedelta
153
+ asyncOp: bool
154
+
155
+ class GatherOptions:
156
+ rootRank: int
157
+ timeout: timedelta
158
+
159
+ class ScatterOptions:
160
+ rootRank: int
161
+ timeout: timedelta
162
+ asyncOp: bool
163
+
164
+ class ReduceScatterOptions:
165
+ reduceOp: ReduceOp
166
+ timeout: timedelta
167
+ asyncOp: bool
168
+
169
+ class BarrierOptions:
170
+ device_ids: list[int]
171
+ device: torch.device
172
+ timeout: timedelta
173
+
174
+ class AllToAllOptions:
175
+ timeout: timedelta
176
+
177
+ class Store:
178
+ def set(self, key: str, value: str): ...
179
+ def get(self, key: str) -> bytes: ...
180
+ def add(self, key: str, value: int) -> int: ...
181
+ def compare_set(
182
+ self,
183
+ key: str,
184
+ expected_value: str,
185
+ desired_value: str,
186
+ ) -> bytes: ...
187
+ def delete_key(self, key: str) -> bool: ...
188
+ def num_keys(self) -> int: ...
189
+ def set_timeout(self, timeout: timedelta): ...
190
+ @overload
191
+ def wait(self, keys: list[str]): ...
192
+ @overload
193
+ def wait(self, keys: list[str], timeout: timedelta): ...
194
+
195
+ class FileStore(Store):
196
+ def __init__(self, path: str, numWorkers: int = ...) -> None: ...
197
+
198
+ class HashStore(Store):
199
+ def __init__(self) -> None: ...
200
+
201
+ class TCPStore(Store):
202
+ def __init__(
203
+ self,
204
+ host_name: str,
205
+ port: int,
206
+ world_size: int | None = ...,
207
+ is_master: bool = ...,
208
+ timeout: timedelta = ...,
209
+ wait_for_workers: bool = ...,
210
+ multi_tenant: bool = ...,
211
+ master_listen_fd: int | None = ...,
212
+ use_libuv: bool | None = ...,
213
+ ) -> None: ...
214
+ @property
215
+ def host(self) -> str: ...
216
+ @property
217
+ def port(self) -> int: ...
218
+
219
+ class PrefixStore(Store):
220
+ def __init__(self, prefix: str, store: Store) -> None: ...
221
+ @property
222
+ def underlying_store(self) -> Store: ...
223
+
224
+ class _ControlCollectives:
225
+ def barrier(self, key: str, timeout: timedelta, blocking: bool) -> None: ...
226
+ def broadcast_send(self, key: str, data: str, timeout: timedelta) -> None: ...
227
+ def broadcast_recv(self, key: str, timeout: timedelta) -> str: ...
228
+ def gather_send(self, key: str, data: str, timeout: timedelta) -> None: ...
229
+ def gather_recv(self, key: str, timeout: timedelta) -> str: ...
230
+ def scatter_send(self, key: str, data: str, timeout: timedelta) -> None: ...
231
+ def scatter_recv(self, key: str, timeout: timedelta) -> str: ...
232
+ def all_gather(self, key: str, data: str, timeout: timedelta) -> str: ...
233
+ def all_sum(self, key: str, data: int, timeout: timedelta) -> int: ...
234
+
235
+ class _StoreCollectives(_ControlCollectives):
236
+ def __init__(self, store: Store, rank: int, world_size: int) -> None: ...
237
+
238
+ class _DistributedBackendOptions:
239
+ def __init__(self) -> None: ...
240
+ @property
241
+ def store(self) -> Store: ...
242
+ @store.setter
243
+ def store(self, store: Store) -> None: ...
244
+ @property
245
+ def group_rank(self) -> int: ...
246
+ @group_rank.setter
247
+ def group_rank(self, rank: int) -> None: ...
248
+ @property
249
+ def group_size(self) -> int: ...
250
+ @group_size.setter
251
+ def group_size(self, size: int) -> None: ...
252
+ @property
253
+ def timeout(self) -> timedelta: ...
254
+ @timeout.setter
255
+ def timeout(self, timeout: timedelta) -> None: ...
256
+ @property
257
+ def group_id(self) -> str: ...
258
+ @group_id.setter
259
+ def group_id(self, group_id: str) -> None: ...
260
+ @property
261
+ def global_ranks_in_group(self) -> list[int]: ...
262
+ @global_ranks_in_group.setter
263
+ def global_ranks_in_group(self, ranks: list[int]) -> None: ...
264
+
265
+ class Work:
266
+ def is_completed(self) -> bool: ...
267
+ def is_success(self) -> bool: ...
268
+ def exception(self) -> Any: ...
269
+ def wait(self, timeout: timedelta = ...) -> bool: ...
270
+ def get_future(self) -> Future: ...
271
+ def source_rank(self) -> int: ...
272
+ def _source_rank(self) -> int: ...
273
+ def result(self) -> list[Tensor]: ...
274
+ def synchronize(self): ...
275
+ def boxed(self) -> ScriptObject: ...
276
+ @staticmethod
277
+ def unbox(obj: ScriptObject) -> Work: ...
278
+
279
+ class Backend:
280
+ class Options:
281
+ def __init__(self, backend: str, timeout: timedelta = ...) -> None: ...
282
+ @property
283
+ def backend(self) -> str: ...
284
+ @property
285
+ def _timeout(self) -> timedelta: ...
286
+ @_timeout.setter
287
+ def _timeout(self, val: timedelta) -> None: ...
288
+
289
+ def __init__(
290
+ self,
291
+ rank: int,
292
+ size: int,
293
+ ) -> None: ...
294
+ @property
295
+ def supports_splitting(self) -> bool: ...
296
+ @property
297
+ def supports_coalescing(self) -> bool: ...
298
+ @property
299
+ def options(self) -> Options: ...
300
+ def rank(self) -> int: ...
301
+ def size(self) -> int: ...
302
+ def abort(self) -> None: ...
303
+ def shutdown(self) -> None: ...
304
+ def eager_connect_single_device(self, device: torch.device | None) -> None: ...
305
+ def _set_sequence_number_for_group(self) -> None: ...
306
+ def _set_default_timeout(self, timeout: timedelta) -> None: ...
307
+ def get_error(self) -> ErrorType: ...
308
+ @property
309
+ def mem_allocator(self) -> Any: ...
310
+
311
+ class ProcessGroup:
312
+ class BackendType(Enum):
313
+ UNDEFINED = ...
314
+ GLOO = ...
315
+ NCCL = ...
316
+ UCC = ...
317
+ MPI = ...
318
+ XCCL = ...
319
+ CUSTOM = ...
320
+
321
+ def __init__(
322
+ self,
323
+ store: Store,
324
+ rank: int,
325
+ size: int,
326
+ ) -> None: ...
327
+ def rank(self) -> int: ...
328
+ def size(self) -> int: ...
329
+ def abort(self) -> None: ...
330
+ def shutdown(self) -> None: ...
331
+ @overload
332
+ def broadcast(
333
+ self,
334
+ tensors: list[Tensor],
335
+ opts=...,
336
+ ) -> Work: ...
337
+ @overload
338
+ def broadcast(
339
+ self,
340
+ tensor: Tensor,
341
+ root: int,
342
+ ) -> Work: ...
343
+ @overload
344
+ def allreduce(
345
+ self,
346
+ tensors: list[Tensor],
347
+ opts: AllreduceOptions = ...,
348
+ ) -> Work: ...
349
+ @overload
350
+ def allreduce(
351
+ self,
352
+ tensors: list[Tensor],
353
+ op=...,
354
+ ) -> Work: ...
355
+ @overload
356
+ def allreduce(
357
+ self,
358
+ tensor: Tensor,
359
+ op=...,
360
+ ) -> Work: ...
361
+ def allreduce_coalesced(
362
+ self,
363
+ tensors: list[Tensor],
364
+ opts=...,
365
+ ) -> Work: ...
366
+ def reduce_scatter_tensor_coalesced(
367
+ self,
368
+ outputTensors: list[Tensor],
369
+ inputTensors: list[Tensor],
370
+ opts: ReduceScatterOptions | None = None,
371
+ ) -> Work: ...
372
+ @overload
373
+ def reduce(
374
+ self,
375
+ tensors: list[Tensor],
376
+ opts=...,
377
+ ) -> Work: ...
378
+ @overload
379
+ def reduce(
380
+ self,
381
+ tensor: Tensor,
382
+ root: int,
383
+ op=...,
384
+ ) -> Work: ...
385
+ @overload
386
+ def allgather(
387
+ self,
388
+ output_tensors: list[list[Tensor]],
389
+ input_tensors: list[Tensor],
390
+ opts=...,
391
+ ) -> Work: ...
392
+ @overload
393
+ def allgather(
394
+ self,
395
+ output_tensors: list[Tensor],
396
+ input_tensor: Tensor,
397
+ ) -> Work: ...
398
+ def _allgather_base(
399
+ self,
400
+ output: Tensor,
401
+ input: Tensor,
402
+ opts=...,
403
+ ) -> Work: ...
404
+ def allgather_coalesced(
405
+ self,
406
+ output_lists: list[list[Tensor]],
407
+ input_list: list[Tensor],
408
+ opts=...,
409
+ ) -> Work: ...
410
+ def allgather_into_tensor_coalesced(
411
+ self,
412
+ output_lists: list[Tensor],
413
+ input_list: list[Tensor],
414
+ opts=...,
415
+ ) -> Work: ...
416
+ @overload
417
+ def gather(
418
+ self,
419
+ output_tensors: list[list[Tensor]],
420
+ input_tensors: list[Tensor],
421
+ opts=...,
422
+ ) -> Work: ...
423
+ @overload
424
+ def gather(
425
+ self,
426
+ output_tensors: list[Tensor],
427
+ input_tensor: Tensor,
428
+ root: int,
429
+ ) -> Work: ...
430
+ @overload
431
+ def scatter(
432
+ self,
433
+ output_tensors: list[Tensor],
434
+ input_tensors: list[list[Tensor]],
435
+ opts=...,
436
+ ) -> Work: ...
437
+ @overload
438
+ def scatter(
439
+ self,
440
+ output_tensor: Tensor,
441
+ input_tensors: list[Tensor],
442
+ root: int,
443
+ ) -> Work: ...
444
+ @overload
445
+ def reduce_scatter(
446
+ self,
447
+ output_tensors: list[Tensor],
448
+ input_tensors: list[list[Tensor]],
449
+ opts=...,
450
+ ) -> Work: ...
451
+ @overload
452
+ def reduce_scatter(
453
+ self,
454
+ output_tensors: Tensor,
455
+ input_tensor: list[Tensor],
456
+ ) -> Work: ...
457
+ def _reduce_scatter_base(
458
+ self,
459
+ outputTensor: Tensor,
460
+ inputTensor: Tensor,
461
+ opts: ReduceScatterOptions | None,
462
+ ) -> Work: ...
463
+ @overload
464
+ def alltoall_base(
465
+ self,
466
+ output_tensor: Tensor,
467
+ input_tensor: Tensor,
468
+ output_split_sizes: list[int],
469
+ input_split_sizes: list[int],
470
+ opts=...,
471
+ ) -> Work: ...
472
+ @overload
473
+ def alltoall_base(
474
+ self,
475
+ output: Tensor,
476
+ input: Tensor,
477
+ output_split_sizes: list[int],
478
+ input_split_sizes: list[int],
479
+ ) -> Work: ...
480
+ @overload
481
+ def alltoall(
482
+ self,
483
+ output_tensor: list[Tensor],
484
+ input_tensor: list[Tensor],
485
+ opts=...,
486
+ ) -> Work: ...
487
+ @overload
488
+ def alltoall(
489
+ self,
490
+ output: list[Tensor],
491
+ input: list[Tensor],
492
+ ) -> Work: ...
493
+ def send(
494
+ self,
495
+ tensors: list[Tensor],
496
+ dstRank: int,
497
+ tag: int,
498
+ ) -> Work: ...
499
+ def recv(
500
+ self,
501
+ tensors: list[Tensor],
502
+ srcRank: int,
503
+ tag: int,
504
+ ) -> Work: ...
505
+ def recv_anysource(self, tensors: list[Tensor], tag: int) -> Work: ...
506
+ def barrier(self, opts=...) -> Work: ...
507
+ def boxed(self) -> ScriptObject: ...
508
+ @staticmethod
509
+ def unbox(obj: ScriptObject) -> ProcessGroup: ...
510
+ def _start_coalescing(self, device: torch.device) -> None: ...
511
+ def _end_coalescing(self, device: torch.device) -> Work: ...
512
+ def _get_backend_name(self) -> str: ...
513
+ def _backend_id(self, backend_type: BackendType) -> int: ...
514
+ @property
515
+ def _device_types(self) -> list[torch.device]: ...
516
+ def _get_backend(self, device: torch.device) -> Backend: ...
517
+ def _set_default_backend(self, backend_type: BackendType) -> None: ...
518
+ def _register_backend(
519
+ self,
520
+ device: torch.device,
521
+ backend_type: BackendType,
522
+ backend: Backend | None,
523
+ ) -> None: ...
524
+ def _set_group_name(self, name: str) -> None: ...
525
+ def _set_group_desc(self, desc: str) -> None: ...
526
+ def name(self) -> str: ...
527
+ def _has_hooks(self) -> bool: ...
528
+ def _wait_for_pending_works(self) -> None: ...
529
+ def _set_sequence_number_for_group(self) -> None: ...
530
+ @property
531
+ def bound_device_id(self) -> torch.device | None: ...
532
+ @bound_device_id.setter
533
+ def bound_device_id(self, device: torch.device | None) -> None: ...
534
+ @property
535
+ def group_name(self) -> str: ...
536
+ @property
537
+ def group_desc(self) -> str: ...
538
+
539
+ class FakeProcessGroup(Backend):
540
+ def __init__(self, rank: int, world_size: int) -> None: ...
541
+
542
+ class FakeWork(Work):
543
+ seq_id: int
544
+ def __init__(self) -> None: ...
545
+ def wait(self, timeout: timedelta = ...) -> bool: ...
546
+ def getFuture(self) -> Future: ...
547
+
548
+ class ProcessGroupGloo(Backend):
549
+ class Device: ...
550
+
551
+ class Options(Backend.Options):
552
+ devices: list[ProcessGroupGloo.Device]
553
+ threads: int
554
+
555
+ def __init__(self): ...
556
+
557
+ def __init__(
558
+ self,
559
+ store: Store,
560
+ rank: int,
561
+ size: int,
562
+ timeout: timedelta,
563
+ ) -> None: ...
564
+ @staticmethod
565
+ def create_device(hostname="", interface="") -> Device: ...
566
+ @staticmethod
567
+ def create_default_device() -> Device: ...
568
+ def _set_default_timeout(self, timeout) -> None: ...
569
+
570
+ class _ProcessGroupWrapper(Backend):
571
+ def __init__(self, pg: Backend, gloo_pg: ProcessGroupGloo) -> None: ...
572
+ wrapped_pg: Backend
573
+
574
+ class ErrorType(Enum):
575
+ SUCCESS = ...
576
+ TIMEOUT = ...
577
+ COMM_ERROR = ...
578
+ REMOTE_ERROR = ...
579
+
580
+ class ProcessGroupNCCL(Backend):
581
+ class NCCLConfig:
582
+ blocking: int
583
+ cga_cluster_size: int
584
+ min_ctas: int
585
+ max_ctas: int
586
+
587
+ class Options(Backend.Options):
588
+ config: ProcessGroupNCCL.NCCLConfig
589
+ is_high_priority_stream: bool
590
+ split_from: ProcessGroupNCCL
591
+ split_color: int
592
+ global_ranks_in_group: list[int]
593
+ group_name: str
594
+
595
+ def __init__(self, is_high_priority_stream: bool = False): ...
596
+
597
+ def __init__(
598
+ self,
599
+ store: Store,
600
+ rank: int,
601
+ size: int,
602
+ options: Options,
603
+ ) -> None: ...
604
+ def _group_start(self) -> None: ...
605
+ def _group_end(self) -> None: ...
606
+ def _set_default_timeout(self, timeout) -> None: ...
607
+ def perform_nocolor_split(self, device: torch.device) -> None: ...
608
+ def register_mem_pool(self, pool: torch.cuda.MemPool) -> None: ...
609
+ def deregister_mem_pool(self, pool: torch.cuda.MemPool) -> None: ...
610
+ def comm_split_count(self) -> int: ...
611
+ def _add_ephemeral_timeout(self, timeout: timedelta) -> None: ...
612
+ def abort(self) -> None: ...
613
+ def _is_initialized(self) -> bool: ...
614
+ @property
615
+ def uid(self) -> int: ...
616
+ @property
617
+ def options(self) -> Options: ... # type: ignore[override]
618
+
619
+ class ProcessGroupUCC(Backend):
620
+ def __init__(
621
+ self,
622
+ store: Store,
623
+ rank: int,
624
+ size: int,
625
+ timeout: timedelta,
626
+ ) -> None: ...
627
+
628
+ class ProcessGroupMPI(Backend):
629
+ def __init__(
630
+ self,
631
+ rank: int,
632
+ size: int,
633
+ pgComm: int,
634
+ ) -> None: ...
635
+ @staticmethod
636
+ def create(ranks: list[int]) -> ProcessGroupMPI: ...
637
+
638
+ def _compute_bucket_assignment_by_size(
639
+ tensors: list[Tensor],
640
+ bucket_size_limits: list[int],
641
+ expect_sparse_gradient: list[bool] = ...,
642
+ tensor_indices: list[int] = ...,
643
+ ) -> tuple[list[list[int]], list[int]]: ...
644
+ def _broadcast_coalesced(
645
+ process_group: ProcessGroup,
646
+ tensors: list[Tensor],
647
+ buffer_size: int,
648
+ src: int,
649
+ ): ...
650
+ def _test_python_store(store: Store): ...
651
+ def _verify_params_across_processes(
652
+ process_group: ProcessGroup,
653
+ params: list[Tensor],
654
+ logger: Logger | None,
655
+ ): ...
656
+ def _make_nccl_premul_sum(factor: float | list[Tensor]) -> ReduceOp: ...
657
+ def _register_process_group(
658
+ group_name: str,
659
+ process_group: ProcessGroup,
660
+ ) -> None: ...
661
+ def _resolve_process_group(group_name: str) -> ProcessGroup: ...
662
+ def _register_work(tensor: torch.Tensor, work: Work) -> ProcessGroup: ...
663
+ def _get_work_registry_size() -> int: ...
664
+ def _set_allow_inflight_collective_as_graph_input(
665
+ value: bool,
666
+ ) -> None: ...
667
+ def _allow_inflight_collective_as_graph_input() -> bool: ...
668
+ def _unregister_all_process_groups() -> None: ...
669
+ def _unregister_process_group(group_name: str) -> None: ...
670
+
671
+ class _SymmetricMemory:
672
+ @staticmethod
673
+ def set_group_info(
674
+ group_name: str,
675
+ rank: int,
676
+ world_size: int,
677
+ store: Store,
678
+ ) -> None: ...
679
+ @staticmethod
680
+ def empty_strided_p2p(
681
+ size: torch.types._size,
682
+ stride: torch.types._size,
683
+ dtype: torch.dtype,
684
+ device: torch.device,
685
+ group_name: str | None = None,
686
+ alloc_id: int | None = None,
687
+ ) -> torch.Tensor: ...
688
+ @staticmethod
689
+ def has_multicast_support(
690
+ device_type: DeviceType,
691
+ device_idx: int,
692
+ ) -> bool: ...
693
+ @property
694
+ def rank(self) -> int: ...
695
+ @property
696
+ def world_size(self) -> int: ...
697
+ @staticmethod
698
+ def rendezvous(
699
+ tensor: torch.Tensor, group_name: str | None = None
700
+ ) -> _SymmetricMemory: ...
701
+ def get_buffer(
702
+ self,
703
+ rank: int,
704
+ sizes: torch.types._size,
705
+ dtype: torch.dtype,
706
+ storage_offset: int | None = 0,
707
+ ) -> torch.Tensor: ...
708
+ def get_signal_pad(
709
+ self,
710
+ rank: int,
711
+ sizes: torch.types._size = [],
712
+ dtype: torch.dtype | None = None,
713
+ storage_offset: int | None = 0,
714
+ ) -> torch.Tensor: ...
715
+ def barrier(self, channel: int = 0, timeout_ms: int = 0) -> None: ...
716
+ def put_signal(
717
+ self,
718
+ dst_rank: int,
719
+ channel: int = 0,
720
+ timeout_ms: int = 0,
721
+ ) -> None: ...
722
+ def wait_signal(
723
+ self,
724
+ src_rank: int,
725
+ channel: int = 0,
726
+ timeout_ms: int = 0,
727
+ ) -> None: ...
728
+ @staticmethod
729
+ def memset32(
730
+ tensor: torch.Tensor, offset: int, val: int, count: int = 1
731
+ ) -> torch.Tensor: ...
732
+ @staticmethod
733
+ def stream_write_value32(
734
+ tensor: torch.Tensor, offset: int, val: int
735
+ ) -> torch.Tensor: ...
736
+ @property
737
+ def buffer_ptrs(self) -> list[int]: ...
738
+ @property
739
+ def buffer_ptrs_dev(self) -> int: ...
740
+ @property
741
+ def signal_pad_ptrs(self) -> list[int]: ...
742
+ @property
743
+ def signal_pad_ptrs_dev(self) -> int: ...
744
+ @property
745
+ def multicast_ptr(self) -> int: ...
746
+ @property
747
+ def buffer_size(self) -> int: ...
748
+ @property
749
+ def signal_pad_size(self) -> int: ...
750
+
751
+ class ProcessGroupXCCL(Backend):
752
+ def __init__(
753
+ self,
754
+ store: Store,
755
+ rank: int,
756
+ size: int,
757
+ ): ...
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_C/_distributed_rpc.pyi ADDED
@@ -0,0 +1,188 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # mypy: allow-untyped-defs
2
+ # mypy: disable-error-code="type-arg"
3
+ from datetime import timedelta
4
+ from typing import Any, Generic, overload, TypeVar
5
+
6
+ import torch
7
+ from torch._C import Future
8
+ from torch._C._autograd import ProfilerEvent
9
+ from torch._C._distributed_c10d import Store
10
+ from torch._C._profiler import ProfilerConfig
11
+
12
+ # This module is defined in torch/csrc/distributed/rpc/init.cpp
13
+
14
+ _DEFAULT_INIT_METHOD: str
15
+ _DEFAULT_NUM_WORKER_THREADS: int
16
+ _UNSET_RPC_TIMEOUT: float
17
+ _DEFAULT_RPC_TIMEOUT_SEC: float
18
+
19
+ _T = TypeVar("_T")
20
+
21
+ class RpcBackendOptions:
22
+ rpc_timeout: float
23
+ init_method: str
24
+ def __init__(
25
+ self,
26
+ rpc_timeout: float = ...,
27
+ init_method: str = ...,
28
+ ) -> None: ...
29
+
30
+ class WorkerInfo:
31
+ def __init__(self, name: str, worker_id: int) -> None: ...
32
+ @property
33
+ def name(self) -> str: ...
34
+ @property
35
+ def id(self) -> int: ...
36
+ def __eq__(self, other: object) -> bool: ...
37
+
38
+ class RpcAgent:
39
+ def join(self, shutdown: bool = False, timeout: float = 0): ...
40
+ def sync(self): ...
41
+ def shutdown(self): ...
42
+ @overload
43
+ def get_worker_info(self) -> WorkerInfo: ...
44
+ @overload
45
+ def get_worker_info(self, workerName: str) -> WorkerInfo: ...
46
+ def get_worker_infos(self) -> list[WorkerInfo]: ...
47
+ def _get_device_map(self, dst: WorkerInfo) -> dict[torch.device, torch.device]: ...
48
+ def get_debug_info(self) -> dict[str, str]: ...
49
+ def get_metrics(self) -> dict[str, str]: ...
50
+
51
+ class PyRRef(Generic[_T]):
52
+ def __init__(self, value: _T, type_hint: Any = None) -> None: ...
53
+ def is_owner(self) -> bool: ...
54
+ def confirmed_by_owner(self) -> bool: ...
55
+ def owner(self) -> WorkerInfo: ...
56
+ def owner_name(self) -> str: ...
57
+ def to_here(self, timeout: float = ...) -> _T: ...
58
+ def local_value(self) -> Any: ...
59
+ def rpc_sync(self, timeout: float = ...) -> Any: ...
60
+ def rpc_async(self, timeout: float = ...) -> Any: ...
61
+ def remote(self, timeout: float = ...) -> Any: ...
62
+ def _serialize(self) -> tuple: ...
63
+ @staticmethod
64
+ def _deserialize(tp: tuple) -> PyRRef: ...
65
+ def _get_type(self) -> type[_T]: ...
66
+ def _get_future(self) -> Future[_T]: ...
67
+ def _get_profiling_future(self) -> Future[_T]: ...
68
+ def _set_profiling_future(self, profilingFuture: Future[_T]): ...
69
+
70
+ class _TensorPipeRpcBackendOptionsBase(RpcBackendOptions):
71
+ num_worker_threads: int
72
+ device_maps: dict[str, dict[torch.device, torch.device]]
73
+ devices: list[torch.device]
74
+ def __init__(
75
+ self,
76
+ num_worker_threads: int,
77
+ _transports: list | None,
78
+ _channels: list | None,
79
+ rpc_timeout: float = ...,
80
+ init_method: str = ...,
81
+ device_maps: dict[str, dict[torch.device, torch.device]] = {}, # noqa: B006
82
+ devices: list[torch.device] = [], # noqa: B006
83
+ ) -> None: ...
84
+ def _set_device_map(
85
+ self,
86
+ to: str,
87
+ device_map: dict[torch.device, torch.device],
88
+ ): ...
89
+
90
+ class TensorPipeAgent(RpcAgent):
91
+ def __init__(
92
+ self,
93
+ store: Store,
94
+ name: str,
95
+ worker_id: int,
96
+ world_size: int | None,
97
+ opts: _TensorPipeRpcBackendOptionsBase,
98
+ reverse_device_maps: dict[str, dict[torch.device, torch.device]],
99
+ devices: list[torch.device],
100
+ ) -> None: ...
101
+ def join(self, shutdown: bool = False, timeout: float = 0): ...
102
+ def shutdown(self): ...
103
+ @overload
104
+ def get_worker_info(self) -> WorkerInfo: ...
105
+ @overload
106
+ def get_worker_info(self, workerName: str) -> WorkerInfo: ...
107
+ @overload
108
+ def get_worker_info(self, id: int) -> WorkerInfo: ...
109
+ def get_worker_infos(self) -> list[WorkerInfo]: ...
110
+ def _get_device_map(self, dst: WorkerInfo) -> dict[torch.device, torch.device]: ...
111
+ def _update_group_membership(
112
+ self,
113
+ worker_info: WorkerInfo,
114
+ my_devices: list[torch.device],
115
+ reverse_device_map: dict[str, dict[torch.device, torch.device]],
116
+ is_join: bool,
117
+ ): ...
118
+ def _get_backend_options(self) -> _TensorPipeRpcBackendOptionsBase: ...
119
+ @property
120
+ def is_static_group(self) -> bool: ...
121
+ @property
122
+ def store(self) -> Store: ...
123
+
124
+ def _is_current_rpc_agent_set() -> bool: ...
125
+ def _get_current_rpc_agent() -> RpcAgent: ...
126
+ def _set_and_start_rpc_agent(agent: RpcAgent): ...
127
+ def _reset_current_rpc_agent(): ...
128
+ def _delete_all_user_and_unforked_owner_rrefs(timeout: timedelta = ...): ...
129
+ def _destroy_rref_context(ignoreRRefLeak: bool): ...
130
+ def _rref_context_get_debug_info() -> dict[str, str]: ...
131
+ def _cleanup_python_rpc_handler(): ...
132
+ def _invoke_rpc_builtin(
133
+ dst: WorkerInfo,
134
+ opName: str,
135
+ rpcTimeoutSeconds: float,
136
+ *args: Any,
137
+ **kwargs: Any,
138
+ ): ...
139
+ def _invoke_rpc_python_udf(
140
+ dst: WorkerInfo,
141
+ pickledPythonUDF: str,
142
+ tensors: list[torch.Tensor],
143
+ rpcTimeoutSeconds: float,
144
+ isAsyncExecution: bool,
145
+ ): ...
146
+ def _invoke_rpc_torchscript(
147
+ dstWorkerName: str,
148
+ qualifiedNameStr: str,
149
+ argsTuple: tuple,
150
+ kwargsDict: dict,
151
+ rpcTimeoutSeconds: float,
152
+ isAsyncExecution: bool,
153
+ ): ...
154
+ def _invoke_remote_builtin(
155
+ dst: WorkerInfo,
156
+ opName: str,
157
+ rpcTimeoutSeconds: float,
158
+ *args: Any,
159
+ **kwargs: Any,
160
+ ): ...
161
+ def _invoke_remote_python_udf(
162
+ dst: WorkerInfo,
163
+ pickledPythonUDF: str,
164
+ tensors: list[torch.Tensor],
165
+ rpcTimeoutSeconds: float,
166
+ isAsyncExecution: bool,
167
+ ): ...
168
+ def _invoke_remote_torchscript(
169
+ dstWorkerName: WorkerInfo,
170
+ qualifiedNameStr: str,
171
+ rpcTimeoutSeconds: float,
172
+ isAsyncExecution: bool,
173
+ *args: Any,
174
+ **kwargs: Any,
175
+ ): ...
176
+ def get_rpc_timeout() -> float: ...
177
+ def enable_gil_profiling(flag: bool): ...
178
+ def _set_rpc_timeout(rpcTimeoutSeconds: float): ...
179
+
180
+ class RemoteProfilerManager:
181
+ @staticmethod
182
+ def set_current_profiling_key(key: str): ...
183
+
184
+ def _enable_server_process_global_profiler(new_config: ProfilerConfig): ...
185
+ def _disable_server_process_global_profiler() -> list[list[list[ProfilerEvent]]]: ...
186
+ def _set_profiler_node_id(default_node_id: int): ...
187
+ def _enable_jit_rref_pickle(): ...
188
+ def _disable_jit_rref_pickle(): ...
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_C/_distributed_rpc_testing.pyi ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ from torch._C._distributed_c10d import Store
3
+ from torch._C._distributed_rpc import _TensorPipeRpcBackendOptionsBase, TensorPipeAgent
4
+
5
+ # This module is defined in torch/csrc/distributed/rpc/testing/init.cpp
6
+
7
+ class FaultyTensorPipeRpcBackendOptions(_TensorPipeRpcBackendOptionsBase):
8
+ def __init__(
9
+ self,
10
+ num_worker_threads: int,
11
+ rpc_timeout: float,
12
+ init_method: str,
13
+ messages_to_fail: list[str],
14
+ messages_to_delay: dict[str, float],
15
+ num_fail_sends: int,
16
+ ) -> None: ...
17
+ num_send_recv_threads: int
18
+ messages_to_fail: list[str]
19
+ messages_to_delay: dict[str, float]
20
+ num_fail_sends: int
21
+
22
+ class FaultyTensorPipeAgent(TensorPipeAgent):
23
+ def __init__(
24
+ self,
25
+ store: Store,
26
+ name: str,
27
+ rank: int,
28
+ world_size: int,
29
+ options: FaultyTensorPipeRpcBackendOptions,
30
+ reverse_device_maps: dict[str, dict[torch.device, torch.device]],
31
+ devices: list[torch.device],
32
+ ) -> None: ...
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_C/_export.pyi ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ # Defined in torch/csrc/export/pybind.cpp
2
+
3
+ class CppExportedProgram: ...
4
+
5
+ def deserialize_exported_program(
6
+ serialized_program: str,
7
+ ) -> CppExportedProgram: ...
8
+ def serialize_exported_program(
9
+ cpp_exported_program: CppExportedProgram,
10
+ ) -> str: ...
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_C/_functions.pyi ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import AnyStr, overload
2
+
3
+ from torch import Tensor
4
+
5
+ class UndefinedGrad:
6
+ def __init__(self) -> None: ...
7
+ def __call__(self, *inputs: Tensor) -> list[Tensor]: ...
8
+
9
+ class DelayedError:
10
+ def __init__(self, msg: AnyStr, num_inputs: int) -> None: ...
11
+
12
+ # __call__ should really be a higher-kinded type:
13
+ # def __call__(self, arg: Tensor) -> Tensor: ...
14
+ # def __call__(self, *args: Tensor * num_inputs) -> Tuple[Tensor * num_inputs]: ...
15
+
16
+ @overload
17
+ def __call__(self, i0: Tensor) -> Tensor: ...
18
+ @overload
19
+ def __call__(self, *args: Tensor) -> tuple[Tensor, ...]: ...
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_C/_functorch.pyi ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # mypy: allow-untyped-defs
2
+ from enum import Enum
3
+
4
+ from torch import Tensor
5
+
6
+ # Defined in torch/csrc/functorch/init.cpp
7
+
8
+ def _set_dynamic_layer_keys_included(included: bool) -> None: ...
9
+ def get_unwrapped(tensor: Tensor) -> Tensor: ...
10
+ def is_batchedtensor(tensor: Tensor) -> bool: ...
11
+ def is_functionaltensor(tensor: Tensor) -> bool: ...
12
+ def is_functorch_wrapped_tensor(tensor: Tensor) -> bool: ...
13
+ def is_gradtrackingtensor(tensor: Tensor) -> bool: ...
14
+ def is_legacy_batchedtensor(tensor: Tensor) -> bool: ...
15
+ def maybe_get_bdim(tensor: Tensor) -> int: ...
16
+ def maybe_get_level(tensor: Tensor) -> int: ...
17
+ def maybe_current_level() -> int | None: ...
18
+ def unwrap_if_dead(tensor: Tensor) -> Tensor: ...
19
+ def _unwrap_for_grad(tensor: Tensor, level: int) -> Tensor: ...
20
+ def _wrap_for_grad(tensor: Tensor, level: int) -> Tensor: ...
21
+ def _unwrap_batched(tensor: Tensor, level: int) -> tuple[Tensor, int | None]: ...
22
+ def current_level() -> int: ...
23
+ def count_jvp_interpreters() -> int: ...
24
+ def _add_batch_dim(tensor: Tensor, bdim: int, level: int) -> Tensor: ...
25
+ def set_single_level_autograd_function_allowed(allowed: bool) -> None: ...
26
+ def get_single_level_autograd_function_allowed() -> bool: ...
27
+ def _unwrap_functional_tensor(tensor: Tensor, reapply_views: bool) -> Tensor: ...
28
+ def _wrap_functional_tensor(tensor: Tensor, level: int) -> Tensor: ...
29
+ def _vmap_increment_nesting(batch_size: int, randomness: str) -> int: ...
30
+ def _vmap_decrement_nesting() -> int: ...
31
+ def _grad_increment_nesting() -> int: ...
32
+ def _grad_decrement_nesting() -> int: ...
33
+ def _jvp_increment_nesting() -> int: ...
34
+ def _jvp_decrement_nesting() -> int: ...
35
+
36
+ # Defined in aten/src/ATen/functorch/Interpreter.h
37
+ class TransformType(Enum):
38
+ Torch = ...
39
+ Vmap = ...
40
+ Grad = ...
41
+ Jvp = ...
42
+ Functionalize = ...
43
+
44
+ class RandomnessType(Enum):
45
+ Error = ...
46
+ Same = ...
47
+ Different = ...
48
+
49
+ class CInterpreter:
50
+ def key(self) -> TransformType: ...
51
+ def level(self) -> int: ...
52
+
53
+ class CGradInterpreterPtr:
54
+ def __init__(self, interpreter: CInterpreter) -> None: ...
55
+ def lift(self, Tensor) -> Tensor: ...
56
+ def prevGradMode(self) -> bool: ...
57
+
58
+ class CJvpInterpreterPtr:
59
+ def __init__(self, interpreter: CInterpreter) -> None: ...
60
+ def lift(self, Tensor) -> Tensor: ...
61
+ def prevFwdGradMode(self) -> bool: ...
62
+
63
+ class CFunctionalizeInterpreterPtr:
64
+ def __init__(self, interpreter: CInterpreter) -> None: ...
65
+ def key(self) -> TransformType: ...
66
+ def level(self) -> int: ...
67
+ def functionalizeAddBackViews(self) -> bool: ...
68
+
69
+ class CVmapInterpreterPtr:
70
+ def __init__(self, interpreter: CInterpreter) -> None: ...
71
+ def key(self) -> TransformType: ...
72
+ def level(self) -> int: ...
73
+ def batchSize(self) -> int: ...
74
+ def randomness(self) -> RandomnessType: ...
75
+
76
+ class DynamicLayer: ...
77
+
78
+ def get_dynamic_layer_stack_depth() -> int: ...
79
+ def get_interpreter_stack() -> list[CInterpreter]: ...
80
+ def peek_interpreter_stack() -> CInterpreter: ...
81
+ def pop_dynamic_layer_stack() -> DynamicLayer: ...
82
+ def pop_dynamic_layer_stack_and_undo_to_depth(int) -> None: ...
83
+ def push_dynamic_layer_stack(dl: DynamicLayer) -> int: ...
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_C/_instruction_counter.pyi ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ # Defined in torch/csrc/instruction_counter/Module.cpp
2
+
3
+ def start() -> int: ...
4
+ def end(id: int) -> int: ...
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_C/_itt.pyi ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ # Defined in torch/csrc/itt.cpp
2
+ def is_available() -> None: ...
3
+ def rangePush(message: str) -> None: ...
4
+ def rangePop() -> None: ...
5
+ def mark(message: str) -> None: ...
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_C/_lazy.pyi ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from torch import Tensor
2
+
3
+ # defined in torch/csrc/lazy/python/init.cpp
4
+ def _mark_step(device: str, devices: list[str], wait: bool) -> None: ...
5
+ def _wait_device_ops(devices: list[str]) -> None: ...
6
+ def _reset_metrics() -> None: ...
7
+ def _counter_names() -> list[str]: ...
8
+ def _counter_value(name: str) -> int: ...
9
+ def _metrics_report() -> str: ...
10
+ def _get_graph_hash(tensors: list[Tensor]) -> str: ...
11
+ def _sync_multi(
12
+ tensors: list[Tensor],
13
+ devices: list[str],
14
+ wait: bool = True,
15
+ sync_ltc_data: bool = True,
16
+ ) -> None: ...
17
+ def _get_tensor_id(tensor: Tensor) -> int: ...
18
+ def _get_tensors_text(tensors: list[Tensor]) -> str: ...
19
+ def _get_tensors_dot(tensors: list[Tensor]) -> str: ...
20
+ def _get_tensors_backend(tensors: list[Tensor]) -> str: ...
21
+ def _get_force_fallback() -> str: ...
22
+ def _set_force_fallback(newval: str) -> None: ...
23
+ def _clear_ir_cache() -> None: ...
24
+ def _dump_ir_cache(filename: str) -> None: ...
25
+ def _set_reuse_ir(val: bool) -> None: ...
26
+ def _get_default_device_type() -> str: ...
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_C/_lazy_ts_backend.pyi ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # mypy: allow-untyped-defs
2
+ # defined in torch/csrc/lazy/python/init.cpp
3
+
4
+ from typing import Any
5
+
6
+ from torch import Tensor
7
+
8
+ def _init(): ...
9
+ def _get_tensors_ts_device_data_node(
10
+ tensors: list[Tensor],
11
+ ) -> tuple[list[int], list[Any]]: ...
12
+ def _run_cached_graph(hash_str: str, graph_inputs: list[Any]) -> list[Tensor]: ...
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_C/_monitor.pyi ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Defined in torch/csrc/monitor/python_init.cpp
2
+
3
+ import datetime
4
+ from enum import Enum
5
+ from types import TracebackType
6
+ from typing import Callable, Optional
7
+
8
+ class Aggregation(Enum):
9
+ VALUE = ...
10
+ MEAN = ...
11
+ COUNT = ...
12
+ SUM = ...
13
+ MAX = ...
14
+ MIN = ...
15
+
16
+ class Stat:
17
+ name: str
18
+ count: int
19
+ def __init__(
20
+ self,
21
+ name: str,
22
+ aggregations: list[Aggregation],
23
+ window_size: int,
24
+ max_samples: int = -1,
25
+ ) -> None: ...
26
+ def add(self, v: float) -> None: ...
27
+ def get(self) -> dict[Aggregation, float]: ...
28
+
29
+ class Event:
30
+ name: str
31
+ timestamp: datetime.datetime
32
+ data: dict[str, int | float | bool | str]
33
+ def __init__(
34
+ self,
35
+ name: str,
36
+ timestamp: datetime.datetime,
37
+ data: dict[str, int | float | bool | str],
38
+ ) -> None: ...
39
+
40
+ def log_event(e: Event) -> None: ...
41
+
42
+ class EventHandlerHandle: ...
43
+
44
+ def register_event_handler(handler: Callable[[Event], None]) -> EventHandlerHandle: ...
45
+ def unregister_event_handler(handle: EventHandlerHandle) -> None: ...
46
+
47
+ class _WaitCounterTracker:
48
+ def __enter__(self) -> None: ...
49
+ def __exit__(
50
+ self,
51
+ exec_type: Optional[type[BaseException]] = None,
52
+ exec_value: Optional[BaseException] = None,
53
+ traceback: Optional[TracebackType] = None,
54
+ ) -> None: ...
55
+
56
+ class _WaitCounter:
57
+ def __init__(self, key: str) -> None: ...
58
+ def guard(self) -> _WaitCounterTracker: ...
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_C/_nn.pyi ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # @generated by tools/pyi/gen_pyi.py from torch/_C/_nn.pyi.in
2
+ # mypy: disable-error-code="type-arg"
3
+
4
+ from typing import Literal, Optional, overload, Sequence, Union
5
+
6
+ from torch import memory_format, Tensor
7
+ from torch.types import _bool, _device, _dtype, _int, _size
8
+
9
+ # Defined in tools/autograd/templates/python_nn_functions.cpp
10
+
11
+ def adaptive_max_pool2d(input: Tensor, output_size: Union[_int, _size]) -> tuple[Tensor, Tensor]: ...
12
+ def adaptive_max_pool3d(input: Tensor, output_size: Union[_int, _size]) -> tuple[Tensor, Tensor]: ...
13
+ def avg_pool2d(input: Tensor, kernel_size: Union[_int, _size], stride: Optional[Union[_int, _size]] = None, padding: Union[_int, _size] = 0, ceil_mode: bool = False, count_include_pad: bool = True, divisor_override: Optional[int] = None) -> Tensor: ...
14
+ def avg_pool3d(input: Tensor, kernel_size: Union[_int, _size], stride: Optional[Union[_int, _size]] = None, padding: Union[_int, _size] = 0, ceil_mode: bool = False, count_include_pad: bool = True, divisor_override: Optional[int] = None) -> Tensor: ...
15
+ def elu_(input: Tensor, alpha: float = ...) -> Tensor: ...
16
+ def fractional_max_pool2d(input: Tensor, kernel_size: Union[_int, _size], output_size: Union[_int, _size], _random_samples: Tensor) -> tuple[Tensor, Tensor]: ...
17
+ def fractional_max_pool3d(input: Tensor, kernel_size: Union[_int, _size], output_size: Union[_int, _size], _random_samples: Tensor) -> tuple[Tensor, Tensor]: ...
18
+ def gelu(input: Tensor, approximate: str = ...) -> Tensor: ...
19
+ def hardsigmoid(input: Tensor, *, out: Optional[Tensor] = None) -> Tensor: ...
20
+ def hardtanh(input: Tensor, min_val: float = ..., max_val: float = ..., *, out: Optional[Tensor] = None) -> Tensor: ...
21
+ def hardtanh_(input: Tensor, min_val: float = ..., max_val: float = ...) -> Tensor: ...
22
+ def leaky_relu(input: Tensor, negative_slope: float = ..., *, out: Optional[Tensor] = None) -> Tensor: ...
23
+ def leaky_relu_(input: Tensor, negative_slope: float = ...) -> Tensor: ...
24
+ def linear(input: Tensor, weight: Tensor, bias: Optional[Tensor] = None) -> Tensor: ...
25
+ def log_sigmoid(input: Tensor) -> Tensor: ...
26
+ def one_hot(tensor: Tensor, num_classes: int = ...) -> Tensor: ...
27
+ def pad(input: Tensor, pad: Sequence[int], mode: str = ..., value: Optional[float] = None) -> Tensor: ...
28
+ def scaled_dot_product_attention(query: Tensor, key: Tensor, value: Tensor, attn_mask: Optional[Tensor] = None, dropout_p: float = 0.0, is_causal: bool = False, scale: Optional[float] = None, enable_gqa: bool = False) -> Tensor: ...
29
+ def softplus(input: Tensor, beta: float = ..., threshold: float = ...) -> Tensor: ...
30
+ def softshrink(input: Tensor, lambd: float = ...) -> Tensor: ...
31
+
32
+ # Defined in aten/src/ATen/native/mkldnn/Linear.cpp
33
+ def mkldnn_linear(input: Tensor, weight: Tensor, bias: Optional[Tensor]) -> Tensor: ...
34
+
35
+ # Defined at aten/src/ATen/native/mkldnn/MKLDNNConversions.cpp
36
+ def mkldnn_reorder_conv2d_weight(
37
+ self: Tensor,
38
+ padding: list,
39
+ stride: list,
40
+ dilatation: list,
41
+ groups: int,
42
+ ) -> Tensor: ...
43
+ def mkldnn_reorder_conv3d_weight(
44
+ self: Tensor,
45
+ padding: list,
46
+ stride: list,
47
+ dilatation: list,
48
+ groups: int,
49
+ ) -> Tensor: ...
50
+
51
+ # Defined in aten/src/ATen/native/mkldnn/Prelu.cpp
52
+ def mkldnn_prelu(input: Tensor, weight: Tensor) -> Tensor: ...
53
+
54
+ # Defined at tools/autograd/templates/python_nn_functions.cpp
55
+ @overload
56
+ def _parse_to(
57
+ device: _device,
58
+ dtype: _dtype,
59
+ non_blocking: _bool,
60
+ copy: _bool,
61
+ *,
62
+ memory_format: memory_format,
63
+ ) -> tuple[_device, _dtype, _bool, memory_format]: ...
64
+ @overload
65
+ def _parse_to(
66
+ dtype: _dtype,
67
+ non_blocking: _bool,
68
+ copy: _bool,
69
+ *,
70
+ memory_format: memory_format,
71
+ ) -> tuple[_device, _dtype, _bool, memory_format]: ...
72
+ @overload
73
+ def _parse_to(
74
+ tensor: Tensor,
75
+ non_blocking: _bool,
76
+ copy: _bool,
77
+ *,
78
+ memory_format: memory_format,
79
+ ) -> tuple[_device, _dtype, _bool, memory_format]: ...
80
+
81
+ # Defined in aten/src/ATen/native/PackedSequence.cpp
82
+ def pad_sequence(
83
+ sequences: Union[list[Tensor], tuple[Tensor, ...]],
84
+ batch_first: bool = False,
85
+ padding_value: float = 0.0,
86
+ padding_side: Union[Literal["left", "right"], str] = "right",
87
+ ) -> Tensor: ...
88
+ def flatten_dense_tensors(tensors: list[Tensor]) -> Tensor: ...
89
+ def unflatten_dense_tensors(flat: Tensor, tensors: list[Tensor]) -> list[Tensor]: ...
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_C/_nvtx.pyi ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ # mypy: allow-untyped-defs
2
+ # Defined in torch/csrc/cuda/shared/nvtx.cpp
3
+ def rangePushA(message: str) -> int: ...
4
+ def rangePop() -> int: ...
5
+ def rangeStartA(message: str) -> int: ...
6
+ def rangeEnd(int) -> None: ...
7
+ def markA(message: str) -> None: ...
8
+ def deviceRangeStart(message: str, stream: int) -> object: ...
9
+ def deviceRangeEnd(range_handle: object, stream: int) -> None: ...
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_C/_onnx.pyi ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Defined in torch/csrc/onnx/init.cpp
2
+
3
+ from enum import Enum
4
+
5
+ PRODUCER_VERSION: str
6
+
7
+ class TensorProtoDataType(Enum):
8
+ UNDEFINED = ...
9
+ FLOAT = ...
10
+ UINT8 = ...
11
+ INT8 = ...
12
+ UINT16 = ...
13
+ INT16 = ...
14
+ INT32 = ...
15
+ INT64 = ...
16
+ STRING = ...
17
+ BOOL = ...
18
+ FLOAT16 = ...
19
+ DOUBLE = ...
20
+ UINT32 = ...
21
+ UINT64 = ...
22
+ COMPLEX64 = ...
23
+ COMPLEX128 = ...
24
+ BFLOAT16 = ...
25
+ FLOAT8E5M2 = ...
26
+ FLOAT8E4M3FN = ...
27
+ FLOAT8E5M2FNUZ = ...
28
+ FLOAT8E4M3FNUZ = ...
29
+
30
+ class OperatorExportTypes(Enum):
31
+ ONNX = ...
32
+ ONNX_ATEN = ...
33
+ ONNX_ATEN_FALLBACK = ...
34
+ ONNX_FALLTHROUGH = ...
35
+
36
+ class TrainingMode(Enum):
37
+ EVAL = ...
38
+ PRESERVE = ...
39
+ TRAINING = ...
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_C/_profiler.pyi ADDED
@@ -0,0 +1,246 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from enum import Enum
2
+ from typing import Any, Literal, Optional
3
+ from typing_extensions import TypeAlias
4
+
5
+ from torch._C import device, dtype, layout
6
+
7
+ # defined in torch/csrc/profiler/python/init.cpp
8
+
9
+ class RecordScope(Enum):
10
+ FUNCTION = ...
11
+ BACKWARD_FUNCTION = ...
12
+ TORCHSCRIPT_FUNCTION = ...
13
+ KERNEL_FUNCTION_DTYPE = ...
14
+ CUSTOM_CLASS = ...
15
+ BUILD_FEATURE = ...
16
+ LITE_INTERPRETER = ...
17
+ USER_SCOPE = ...
18
+ STATIC_RUNTIME_OP = ...
19
+ STATIC_RUNTIME_MODEL = ...
20
+
21
+ class ProfilerState(Enum):
22
+ Disable = ...
23
+ CPU = ...
24
+ CUDA = ...
25
+ NVTX = ...
26
+ ITT = ...
27
+ KINETO = ...
28
+ KINETO_GPU_FALLBACK = ...
29
+ KINETO_PRIVATEUSE1_FALLBACK = ...
30
+ KINETO_PRIVATEUSE1 = ...
31
+
32
+ class ActiveProfilerType(Enum):
33
+ NONE = ...
34
+ LEGACY = ...
35
+ KINETO = ...
36
+ NVTX = ...
37
+ ITT = ...
38
+
39
+ class ProfilerActivity(Enum):
40
+ CPU = ...
41
+ CUDA = ...
42
+ XPU = ...
43
+ MTIA = ...
44
+ HPU = ...
45
+ PrivateUse1 = ...
46
+
47
+ class _EventType(Enum):
48
+ TorchOp = ...
49
+ Backend = ...
50
+ Allocation = ...
51
+ OutOfMemory = ...
52
+ PyCall = ...
53
+ PyCCall = ...
54
+ Kineto = ...
55
+
56
+ class _ExperimentalConfig:
57
+ def __init__(
58
+ self,
59
+ profiler_metrics: list[str] = ...,
60
+ profiler_measure_per_kernel: bool = ...,
61
+ verbose: bool = ...,
62
+ performance_events: list[str] = ...,
63
+ enable_cuda_sync_events: bool = ...,
64
+ ) -> None: ...
65
+
66
+ class ProfilerConfig:
67
+ def __init__(
68
+ self,
69
+ state: ProfilerState,
70
+ report_input_shapes: bool,
71
+ profile_memory: bool,
72
+ with_stack: bool,
73
+ with_flops: bool,
74
+ with_modules: bool,
75
+ experimental_config: _ExperimentalConfig,
76
+ trace_id: Optional[str] = None,
77
+ ) -> None: ...
78
+
79
+ class _ProfilerEvent:
80
+ start_tid: int
81
+ start_time_ns: int
82
+ children: list[_ProfilerEvent]
83
+
84
+ # TODO(robieta): remove in favor of `self.typed`
85
+ extra_fields: (
86
+ _ExtraFields_TorchOp
87
+ | _ExtraFields_Backend
88
+ | _ExtraFields_Allocation
89
+ | _ExtraFields_OutOfMemory
90
+ | _ExtraFields_PyCall
91
+ | _ExtraFields_PyCCall
92
+ | _ExtraFields_Kineto
93
+ )
94
+
95
+ @property
96
+ def typed(
97
+ self,
98
+ ) -> (
99
+ tuple[Literal[_EventType.TorchOp], _ExtraFields_TorchOp]
100
+ | tuple[Literal[_EventType.Backend], _ExtraFields_Backend]
101
+ | tuple[Literal[_EventType.Allocation], _ExtraFields_Allocation]
102
+ | tuple[Literal[_EventType.OutOfMemory], _ExtraFields_OutOfMemory]
103
+ | tuple[Literal[_EventType.PyCall], _ExtraFields_PyCall]
104
+ | tuple[Literal[_EventType.PyCCall], _ExtraFields_PyCCall]
105
+ | tuple[Literal[_EventType.Kineto], _ExtraFields_Kineto]
106
+ ): ...
107
+ @property
108
+ def name(self) -> str: ...
109
+ @property
110
+ def tag(self) -> _EventType: ...
111
+ @property
112
+ def id(self) -> int: ...
113
+ @property
114
+ def parent(self) -> _ProfilerEvent | None: ...
115
+ @property
116
+ def correlation_id(self) -> int: ...
117
+ @property
118
+ def end_time_ns(self) -> int: ...
119
+ @property
120
+ def duration_time_ns(self) -> int: ...
121
+
122
+ class _TensorMetadata:
123
+ impl_ptr: int | None
124
+ storage_data_ptr: int | None
125
+ id: int | None
126
+
127
+ @property
128
+ def allocation_id(self) -> int | None: ...
129
+ @property
130
+ def layout(self) -> layout: ...
131
+ @property
132
+ def device(self) -> device: ...
133
+ @property
134
+ def dtype(self) -> dtype: ...
135
+ @property
136
+ def sizes(self) -> list[int]: ...
137
+ @property
138
+ def strides(self) -> list[int]: ...
139
+
140
+ Scalar: TypeAlias = int | float | bool | complex
141
+ Input: TypeAlias = _TensorMetadata | list[_TensorMetadata] | Scalar | None
142
+
143
+ class _ExtraFields_TorchOp:
144
+ name: str
145
+ sequence_number: int
146
+ allow_tf32_cublas: bool
147
+
148
+ @property
149
+ def inputs(self) -> list[Input]: ...
150
+ @property
151
+ def scope(self) -> RecordScope: ...
152
+
153
+ class _ExtraFields_Backend: ...
154
+
155
+ class _ExtraFields_Allocation:
156
+ ptr: int
157
+ id: int | None
158
+ alloc_size: int
159
+ total_allocated: int
160
+ total_reserved: int
161
+
162
+ @property
163
+ def allocation_id(self) -> int | None: ...
164
+ @property
165
+ def device(self) -> device: ...
166
+
167
+ class _ExtraFields_OutOfMemory: ...
168
+
169
+ class _PyFrameState:
170
+ line_number: int
171
+ function_name: str
172
+
173
+ @property
174
+ def file_name(self) -> str: ...
175
+
176
+ class _NNModuleInfo:
177
+ @property
178
+ def self_ptr(self) -> int: ...
179
+ @property
180
+ def cls_ptr(self) -> int: ...
181
+ @property
182
+ def cls_name(self) -> str: ...
183
+ @property
184
+ def parameters(
185
+ self,
186
+ ) -> list[tuple[str, _TensorMetadata, _TensorMetadata | None]]: ...
187
+
188
+ class _OptimizerInfo:
189
+ @property
190
+ def parameters(
191
+ self,
192
+ ) -> list[
193
+ tuple[
194
+ # Parameter
195
+ _TensorMetadata,
196
+ #
197
+ # Gradient (if present during optimizer.step())
198
+ _TensorMetadata | None,
199
+ #
200
+ # Optimizer state for Parameter as (name, tensor) pairs
201
+ list[tuple[str, _TensorMetadata]],
202
+ ]
203
+ ]: ...
204
+
205
+ class _ExtraFields_PyCCall:
206
+ @property
207
+ def caller(self) -> _PyFrameState: ...
208
+
209
+ class _ExtraFields_PyCall:
210
+ @property
211
+ def callsite(self) -> _PyFrameState: ...
212
+ @property
213
+ def caller(self) -> _PyFrameState: ...
214
+ @property
215
+ def module(self) -> _NNModuleInfo | None: ...
216
+ @property
217
+ def optimizer(self) -> _OptimizerInfo | None: ...
218
+
219
+ class _ExtraFields_Kineto: ...
220
+
221
+ def _add_execution_trace_observer(output_file_path: str) -> bool: ...
222
+ def _remove_execution_trace_observer() -> None: ...
223
+ def _enable_execution_trace_observer() -> None: ...
224
+ def _disable_execution_trace_observer() -> None: ...
225
+ def _set_record_concrete_inputs_enabled_val(val: bool) -> None: ...
226
+ def _set_fwd_bwd_enabled_val(val: bool) -> None: ...
227
+ def _set_cuda_sync_enabled_val(val: bool) -> None: ...
228
+
229
+ class CapturedTraceback: ...
230
+
231
+ def gather_traceback(python: bool, script: bool, cpp: bool) -> CapturedTraceback: ...
232
+
233
+ # The Dict has name, filename, line
234
+ def symbolize_tracebacks(
235
+ to_symbolize: list[CapturedTraceback],
236
+ ) -> list[list[dict[str, str]]]: ...
237
+
238
+ class _RecordFunctionFast:
239
+ def __init__(
240
+ self,
241
+ name: str,
242
+ input_values: list | tuple | None = None,
243
+ keyword_values: dict | None = None,
244
+ ) -> None: ...
245
+ def __enter__(self) -> None: ...
246
+ def __exit__(self, *args: Any) -> None: ...
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_C/_verbose.pyi ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ # Defined in torch/csrc/utils/verbose.cpp
2
+ def mkl_set_verbose(enable: int) -> int: ...
3
+ def mkldnn_set_verbose(level: int) -> int: ...
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_awaits/__init__.py ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ from typing import Generic, TypeVar
4
+
5
+ import torch
6
+
7
+ __all__ = ['Await']
8
+
9
+ W = TypeVar("W")
10
+
11
+ class _PyAwaitMeta(type(torch._C._Await), type(Generic)): # type: ignore[misc, no-redef]
12
+ pass
13
+
14
+ class _Await(torch._C._Await, Generic[W], metaclass=_PyAwaitMeta):
15
+ r"""
16
+ Wrapper around a ``torch._C.Await`` which encapsulates delayed execution
17
+ of a callable. All manipulations happen with functions ``torch.jit._awaitable``,
18
+ ``torch.jit._awaitable_wait``, ``torch.jit._awaitable_nowait``.
19
+
20
+ Torch scriptable manipulations:
21
+ ``torch.jit._awaitable(func, *args)``
22
+ Creates ``Await[W]`` object, where W is return type of func.
23
+
24
+ Returns:
25
+ ``torch.jit._awaitable_wait(Await[W])``
26
+ Returns the result of the function, specified at ``_awaitable``, with specified arguments.
27
+
28
+ Returns:
29
+ The result of type ``W`` of the function call. The result is owned by ``Await[W]``
30
+ and returned on all following ``_awaitable_wait`` calls.
31
+
32
+
33
+ ``torch.jit._awaitable_nowait(W)``
34
+ Returns:
35
+ Trivial ``Await[W]`` with specified result.
36
+
37
+
38
+ Only in eager mode:
39
+ ``fn() -> Callable[Tuple[Any], W]``
40
+ Returns:
41
+ Specified at ``_awaitable`` python function ``func``.
42
+
43
+ ``args() -> Tuple[Any]``
44
+ Returns:
45
+ Specified at ``_awaitable`` python args.
46
+
47
+ ``is_nowait() -> _bool``
48
+ Returns:
49
+ ``True`` if this object was created via ``_awaitable_nowait`` call (trivial `Await[W]`).
50
+
51
+ In eager mode ``Await[W]`` can be used as ``W`` i.e. attributes of W can be called on ``Await[W]``,
52
+ ``_awaitable_wait()`` call will be transparently added.
53
+ """
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_awaits/__pycache__/__init__.cpython-310.pyc ADDED
Binary file (2.1 kB). View file
 
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_functorch/__init__.py ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ # Copyright (c) Facebook, Inc. and its affiliates.
2
+ # All rights reserved.
3
+ #
4
+ # This source code is licensed under the BSD-style license found in the
5
+ # LICENSE file in the root directory of this source tree.
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_functorch/__pycache__/__init__.cpython-310.pyc ADDED
Binary file (227 Bytes). View file
 
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_functorch/__pycache__/aot_autograd.cpython-310.pyc ADDED
Binary file (37 kB). View file
 
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_functorch/__pycache__/apis.cpython-310.pyc ADDED
Binary file (18.3 kB). View file
 
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_functorch/__pycache__/autograd_function.cpython-310.pyc ADDED
Binary file (17.7 kB). View file
 
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_functorch/__pycache__/batch_norm_replacement.cpython-310.pyc ADDED
Binary file (1.09 kB). View file
 
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_functorch/__pycache__/compile_utils.cpython-310.pyc ADDED
Binary file (4.37 kB). View file
 
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_functorch/__pycache__/config.cpython-310.pyc ADDED
Binary file (2.41 kB). View file
 
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_functorch/__pycache__/deprecated.cpython-310.pyc ADDED
Binary file (4.94 kB). View file
 
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_functorch/__pycache__/eager_transforms.cpython-310.pyc ADDED
Binary file (55.5 kB). View file
 
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_functorch/__pycache__/functional_call.cpython-310.pyc ADDED
Binary file (11.7 kB). View file
 
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_functorch/__pycache__/make_functional.cpython-310.pyc ADDED
Binary file (21.4 kB). View file
 
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_functorch/__pycache__/partitioners.cpython-310.pyc ADDED
Binary file (53.3 kB). View file
 
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_functorch/__pycache__/pyfunctorch.cpython-310.pyc ADDED
Binary file (8.92 kB). View file
 
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_functorch/__pycache__/utils.cpython-310.pyc ADDED
Binary file (1.3 kB). View file
 
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_functorch/__pycache__/vmap.cpython-310.pyc ADDED
Binary file (12.4 kB). View file
 
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_functorch/_activation_checkpointing/__init__.py ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ # Copyright (c) Facebook, Inc. and its affiliates.
2
+ # All rights reserved.
3
+ #
4
+ # This source code is licensed under the BSD-style license found in the
5
+ # LICENSE file in the root directory of this source tree.
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_functorch/_activation_checkpointing/__pycache__/__init__.cpython-310.pyc ADDED
Binary file (253 Bytes). View file
 
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_functorch/_activation_checkpointing/__pycache__/ac_logging_utils.cpython-310.pyc ADDED
Binary file (4.16 kB). View file
 
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_functorch/_activation_checkpointing/__pycache__/graph_info_provider.cpython-310.pyc ADDED
Binary file (9.81 kB). View file
 
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_functorch/_activation_checkpointing/__pycache__/knapsack.cpython-310.pyc ADDED
Binary file (2.92 kB). View file
 
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_functorch/_activation_checkpointing/__pycache__/knapsack_evaluator.cpython-310.pyc ADDED
Binary file (9.23 kB). View file
 
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_functorch/_activation_checkpointing/ac_logging_utils.py ADDED
@@ -0,0 +1,145 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json
2
+ import logging
3
+ from typing import Any
4
+
5
+ from torch._logging import trace_structured
6
+ from torch.fx import Graph, Node
7
+
8
+
9
+ log: logging.Logger = logging.getLogger(__name__)
10
+
11
+
12
+ def create_joint_graph_node_information(
13
+ joint_graph: Graph,
14
+ recomputable_node_info: dict[str, int],
15
+ ) -> dict[str, Any]:
16
+ joint_graph_node_information: dict[str, Any] = {}
17
+
18
+ for i, joint_graph_node in enumerate(joint_graph.nodes):
19
+ is_recomputable_candidate: bool = (
20
+ joint_graph_node.name in recomputable_node_info
21
+ )
22
+ tensor_meta = joint_graph_node.meta.get("tensor_meta")
23
+ shape = getattr(tensor_meta, "shape", []) if tensor_meta else []
24
+
25
+ node_info: dict[str, Any] = {
26
+ "index": i,
27
+ "name": joint_graph_node.name,
28
+ "is_recomputable_candidate": is_recomputable_candidate,
29
+ "target": str(joint_graph_node.target),
30
+ "shape": str(shape),
31
+ "input_arguments": [inp.name for inp in joint_graph_node.all_input_nodes],
32
+ "stack_trace": joint_graph_node.meta.get("stack_trace", ""),
33
+ }
34
+
35
+ if is_recomputable_candidate:
36
+ idx: int = recomputable_node_info[joint_graph_node.name]
37
+ node_info["recomputable_candidate_info"] = {
38
+ "recomputable_node_idx": idx,
39
+ }
40
+
41
+ joint_graph_node_information[joint_graph_node.name] = node_info
42
+
43
+ return joint_graph_node_information
44
+
45
+
46
+ def create_joint_graph_edges(joint_graph: Graph) -> list[tuple[str, str]]:
47
+ joint_graph_edges: list[tuple[str, str]] = [
48
+ (inp.name, node.name)
49
+ for node in joint_graph.nodes
50
+ for inp in node.all_input_nodes
51
+ ]
52
+ return joint_graph_edges
53
+
54
+
55
+ def create_activation_checkpointing_logging_structure_payload(
56
+ joint_graph: Graph,
57
+ joint_graph_node_information: dict[str, Any],
58
+ joint_graph_edges: list[tuple[str, str]],
59
+ all_recomputable_banned_nodes: list[Node],
60
+ expected_runtime: float,
61
+ saved_node_idxs: list[int],
62
+ recomputable_node_idxs: list[int],
63
+ memories_banned_nodes: list[float],
64
+ runtimes_banned_nodes: list[float],
65
+ min_cut_saved_values: list[Node],
66
+ ) -> dict[str, Any]:
67
+ activation_checkpointing_logging_structure_payload: dict[str, Any] = {
68
+ "Joint Graph Size": len(joint_graph.nodes),
69
+ "Joint Graph Edges": {
70
+ "Total": len(joint_graph_edges),
71
+ "Edges": joint_graph_edges,
72
+ },
73
+ "Joint Graph Node Information": joint_graph_node_information,
74
+ "Recomputable Banned Nodes Order": [
75
+ node.name for node in all_recomputable_banned_nodes
76
+ ],
77
+ "Expected Runtime": expected_runtime,
78
+ "Knapsack Saved Nodes": saved_node_idxs,
79
+ "Knapsack Recomputed Nodes": recomputable_node_idxs,
80
+ "Knapsack Input Memories": memories_banned_nodes,
81
+ "Knapsack Input Runtimes": runtimes_banned_nodes,
82
+ "Min Cut Solution Saved Values": [node.name for node in min_cut_saved_values],
83
+ }
84
+ return activation_checkpointing_logging_structure_payload
85
+
86
+
87
+ def create_structured_trace_for_min_cut_info(
88
+ joint_graph: Graph,
89
+ all_recomputable_banned_nodes: list[Node],
90
+ saved_node_idxs: list[int],
91
+ recomputable_node_idxs: list[int],
92
+ expected_runtime: float,
93
+ memories_banned_nodes: list[float],
94
+ runtimes_banned_nodes: list[float],
95
+ min_cut_saved_values: list[Node],
96
+ ) -> None:
97
+ recomputable_node_info: dict[str, int] = {
98
+ node.name: idx for idx, node in enumerate(all_recomputable_banned_nodes)
99
+ }
100
+ joint_graph_node_information = create_joint_graph_node_information(
101
+ joint_graph, recomputable_node_info
102
+ )
103
+
104
+ for node_name, node_info in joint_graph_node_information.items():
105
+ if node_info["is_recomputable_candidate"]:
106
+ idx = recomputable_node_info[node_name]
107
+ node_info["recomputable_candidate_info"]["memory"] = memories_banned_nodes[
108
+ idx
109
+ ]
110
+ node_info["recomputable_candidate_info"]["runtime"] = runtimes_banned_nodes[
111
+ idx
112
+ ]
113
+ node_info["recomputable_candidate_info"]["is_saved"] = (
114
+ idx in saved_node_idxs
115
+ )
116
+ node_info["recomputable_candidate_info"]["is_recomputed"] = (
117
+ idx in recomputable_node_idxs
118
+ )
119
+
120
+ joint_graph_edges = create_joint_graph_edges(joint_graph)
121
+ activation_checkpointing_logging_structure_payload = (
122
+ create_activation_checkpointing_logging_structure_payload(
123
+ joint_graph,
124
+ joint_graph_node_information,
125
+ joint_graph_edges,
126
+ all_recomputable_banned_nodes,
127
+ expected_runtime,
128
+ saved_node_idxs,
129
+ recomputable_node_idxs,
130
+ memories_banned_nodes,
131
+ runtimes_banned_nodes,
132
+ min_cut_saved_values,
133
+ )
134
+ )
135
+
136
+ trace_structured(
137
+ "artifact",
138
+ metadata_fn=lambda: {
139
+ "name": "min_cut_information",
140
+ "encoding": "json",
141
+ },
142
+ payload_fn=lambda: json.dumps(
143
+ activation_checkpointing_logging_structure_payload
144
+ ),
145
+ )
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_functorch/_activation_checkpointing/graph_info_provider.py ADDED
@@ -0,0 +1,321 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import Any, Optional
2
+
3
+ import networkx as nx
4
+
5
+ from torch.fx import Graph, Node
6
+
7
+
8
+ class GraphInfoProvider:
9
+ """
10
+ This class provides information about the graph, such as the nodes, edges, and their runtime and memory requirements.
11
+ It also provides methods to create graphs from the information provided.
12
+ """
13
+
14
+ __RECOMPUTABLE_NODE_ONLY_GRAPH = "recomputable_node_only_graph"
15
+ __RECOMPUTABLE_NODE_ONLY_GRAPH_WITH_LARGER_GRAPH_CONTEXT = (
16
+ "recomputable_node_only_graph_with_larger_graph_context"
17
+ )
18
+ __FULL_NX_JOINT_GRAPH = "full_nx_joint_graph"
19
+ __SIMPLIFIED_FX_JOINT_GRAPH = "fx_joint_graph"
20
+
21
+ def __init__(
22
+ self,
23
+ graph_nodes_in_order: list[str],
24
+ graph_edges: list[tuple[str, str]],
25
+ all_recomputable_banned_nodes: list[str],
26
+ all_node_runtimes: Optional[dict[str, float]] = None,
27
+ all_node_memories: Optional[dict[str, float]] = None,
28
+ recorded_knapsack_input_memories: Optional[list[float]] = None,
29
+ recorded_knapsack_input_runtimes: Optional[list[float]] = None,
30
+ joint_graph: Optional[Graph] = None,
31
+ ):
32
+ self.graph_nodes_in_order = graph_nodes_in_order
33
+ self.graph_edges = graph_edges
34
+ self.all_node_runtimes: dict[str, float] = dict()
35
+ if all_node_runtimes is None:
36
+ if recorded_knapsack_input_runtimes is None:
37
+ raise ValueError(
38
+ "Either all_node_runtimes or recorded_knapsack_input_runtimes must be provided."
39
+ )
40
+ self.all_node_runtimes = {
41
+ node: recorded_knapsack_input_runtimes[i]
42
+ for i, node in enumerate(all_recomputable_banned_nodes)
43
+ }
44
+ else:
45
+ self.all_node_runtimes.update(all_node_runtimes)
46
+ self.all_node_memories: dict[str, float] = dict()
47
+ if all_node_memories is None:
48
+ if recorded_knapsack_input_memories is None:
49
+ raise ValueError(
50
+ "Either all_node_memories or recorded_knapsack_input_memories must be provided."
51
+ )
52
+ self.all_node_memories = {
53
+ node: recorded_knapsack_input_memories[i]
54
+ for i, node in enumerate(all_recomputable_banned_nodes)
55
+ }
56
+ else:
57
+ self.all_node_memories.update(all_node_memories)
58
+ self.all_recomputable_banned_nodes = all_recomputable_banned_nodes
59
+ self.all_recomputable_banned_nodes_set = set(all_recomputable_banned_nodes)
60
+ self.recorded_knapsack_input_memories = recorded_knapsack_input_memories
61
+ self.recorded_knapsack_input_runtimes = recorded_knapsack_input_runtimes
62
+ self._lazily_initialized_graphs: dict[str, Any] = {
63
+ self.__RECOMPUTABLE_NODE_ONLY_GRAPH: None,
64
+ self.__RECOMPUTABLE_NODE_ONLY_GRAPH_WITH_LARGER_GRAPH_CONTEXT: None,
65
+ self.__FULL_NX_JOINT_GRAPH: None,
66
+ self.__SIMPLIFIED_FX_JOINT_GRAPH: None,
67
+ }
68
+
69
+ @classmethod
70
+ def inialize_from_graph(
71
+ cls,
72
+ joint_graph: Graph,
73
+ all_recomputable_banned_nodes: list[Node],
74
+ recorded_knapsack_input_memories: list[float],
75
+ recorded_knapsack_input_runtimes: list[float],
76
+ ) -> "GraphInfoProvider":
77
+ """
78
+ Enables initialization from a joint graph.
79
+ """
80
+ graph_nodes_in_order = [node.name for node in joint_graph.nodes]
81
+ graph_edges = [
82
+ (node.name, user.name) for node in joint_graph.nodes for user in node.users
83
+ ]
84
+ all_recomputable_banned_node_names = [
85
+ node.name for node in all_recomputable_banned_nodes
86
+ ]
87
+ return cls(
88
+ graph_nodes_in_order=graph_nodes_in_order,
89
+ graph_edges=graph_edges,
90
+ all_recomputable_banned_nodes=all_recomputable_banned_node_names,
91
+ recorded_knapsack_input_memories=recorded_knapsack_input_memories,
92
+ recorded_knapsack_input_runtimes=recorded_knapsack_input_runtimes,
93
+ joint_graph=joint_graph,
94
+ )
95
+
96
+ @property
97
+ def recomputable_node_only_graph(self) -> nx.DiGraph:
98
+ if self._lazily_initialized_graphs[self.__RECOMPUTABLE_NODE_ONLY_GRAPH] is None:
99
+ self._lazily_initialized_graphs[
100
+ self.__RECOMPUTABLE_NODE_ONLY_GRAPH
101
+ ] = self._create_recomputable_node_only_graph()
102
+ return self._lazily_initialized_graphs[self.__RECOMPUTABLE_NODE_ONLY_GRAPH]
103
+
104
+ @property
105
+ def recomputable_node_only_graph_with_larger_graph_context(self) -> nx.DiGraph:
106
+ if (
107
+ self._lazily_initialized_graphs[
108
+ self.__RECOMPUTABLE_NODE_ONLY_GRAPH_WITH_LARGER_GRAPH_CONTEXT
109
+ ]
110
+ is None
111
+ ):
112
+ self._lazily_initialized_graphs[
113
+ self.__RECOMPUTABLE_NODE_ONLY_GRAPH_WITH_LARGER_GRAPH_CONTEXT
114
+ ] = self._create_recomputable_node_only_graph_with_larger_graph_context()
115
+ return self._lazily_initialized_graphs[
116
+ self.__RECOMPUTABLE_NODE_ONLY_GRAPH_WITH_LARGER_GRAPH_CONTEXT
117
+ ]
118
+
119
+ @property
120
+ def full_joint_nx_graph(self) -> nx.DiGraph:
121
+ if self._lazily_initialized_graphs[self.__FULL_NX_JOINT_GRAPH] is None:
122
+ self._lazily_initialized_graphs[
123
+ self.__FULL_NX_JOINT_GRAPH
124
+ ] = self._create_full_joint_graph()
125
+ return self._lazily_initialized_graphs[self.__FULL_NX_JOINT_GRAPH]
126
+
127
+ @property
128
+ def simplified_fx_joint_graph(self) -> Graph:
129
+ if self._lazily_initialized_graphs[self.__SIMPLIFIED_FX_JOINT_GRAPH] is None:
130
+ self._lazily_initialized_graphs[
131
+ self.__SIMPLIFIED_FX_JOINT_GRAPH
132
+ ] = self._recreate_psuedo_joint_graph()
133
+ return self._lazily_initialized_graphs[self.__SIMPLIFIED_FX_JOINT_GRAPH]
134
+
135
+ def get_non_ac_peak_memory(self) -> float:
136
+ return sum(
137
+ self.all_node_memories[node_name]
138
+ for node_name in self.all_recomputable_banned_nodes_set
139
+ )
140
+
141
+ def get_theoretical_max_runtime(self) -> float:
142
+ return sum(
143
+ self.all_node_runtimes[node_name]
144
+ for node_name in self.all_recomputable_banned_nodes_set
145
+ )
146
+
147
+ def get_knapsack_memory_input(self) -> list[float]:
148
+ return (
149
+ self.recorded_knapsack_input_memories
150
+ if self.recorded_knapsack_input_memories
151
+ else [
152
+ self.all_node_memories[node_name]
153
+ for node_name in self.all_recomputable_banned_nodes
154
+ ]
155
+ )
156
+
157
+ def get_knapsack_runtime_input(self) -> list[float]:
158
+ return (
159
+ self.recorded_knapsack_input_runtimes
160
+ if self.recorded_knapsack_input_runtimes
161
+ else [
162
+ self.all_node_runtimes[node_name]
163
+ for node_name in self.all_recomputable_banned_nodes
164
+ ]
165
+ )
166
+
167
+ def _create_recomputable_node_only_graph(self) -> nx.DiGraph:
168
+ graph = nx.DiGraph()
169
+ for recomputable_node in self.all_recomputable_banned_nodes:
170
+ graph.add_node(recomputable_node)
171
+
172
+ for a, b in self.graph_edges:
173
+ if (
174
+ a in self.all_recomputable_banned_nodes_set
175
+ and b in self.all_recomputable_banned_nodes_set
176
+ ):
177
+ graph.add_edge(a, b)
178
+ return graph
179
+
180
+ def _create_recomputable_node_only_graph_with_larger_graph_context(
181
+ self,
182
+ ) -> nx.DiGraph:
183
+ # Create a dictionary to store the reachable nodes for each node
184
+ all_recomputable_banned_nodes_set = set(self.all_recomputable_banned_nodes)
185
+
186
+ reachable_nodes = {}
187
+ for node in all_recomputable_banned_nodes_set:
188
+ # Use BFS to find all reachable nodes
189
+ predecessors = dict(nx.bfs_predecessors(self.full_joint_nx_graph, node))
190
+ reachable_recomputable_nodes = set(predecessors.keys()).intersection(
191
+ all_recomputable_banned_nodes_set
192
+ )
193
+ reachable_nodes[node] = reachable_recomputable_nodes
194
+ # Create the candidate graph
195
+ candidate_graph = nx.DiGraph()
196
+ candidate_graph.add_nodes_from(all_recomputable_banned_nodes_set)
197
+ for node1 in all_recomputable_banned_nodes_set:
198
+ for node2 in reachable_nodes[node1]:
199
+ # Check if there is an overlapping path
200
+ overlapping_path = False
201
+ for intermediate_node in reachable_nodes[node1]:
202
+ if (
203
+ intermediate_node != node2
204
+ and node2 in reachable_nodes[intermediate_node]
205
+ ):
206
+ overlapping_path = True
207
+ break
208
+ if not overlapping_path:
209
+ candidate_graph.add_edge(node1, node2)
210
+ return candidate_graph
211
+
212
+ def _create_full_joint_graph(self) -> nx.DiGraph:
213
+ graph = nx.DiGraph()
214
+ for node in self.graph_nodes_in_order:
215
+ if node == "output":
216
+ continue
217
+ graph.add_node(node)
218
+
219
+ for a, b in self.graph_edges:
220
+ if a == "output" or b == "output":
221
+ continue
222
+ graph.add_edge(a, b)
223
+ return graph
224
+
225
+ def _recreate_psuedo_joint_graph(self) -> Graph:
226
+ # Create a dictionary to store the dependencies of each node
227
+ node_dependencies: dict[str, list[str]] = {
228
+ node: [] for node in self.graph_nodes_in_order
229
+ }
230
+ for a, b in self.graph_edges:
231
+ if a not in node_dependencies or b not in node_dependencies:
232
+ raise ValueError(f"Edge ({a}, {b}) references a non-existent node.")
233
+ node_dependencies[b].append(a)
234
+
235
+ joint_graph = Graph()
236
+ # Create nodes in the graph
237
+ nodes: dict[str, Node] = {}
238
+ for node_name in self.graph_nodes_in_order:
239
+ input_nodes = [nodes[dep] for dep in node_dependencies[node_name]]
240
+ if input_nodes:
241
+ node = joint_graph.call_function(lambda *x: x, tuple(input_nodes))
242
+ node.name = node_name
243
+ else:
244
+ node = joint_graph.placeholder(node_name)
245
+ nodes[node_name] = node
246
+ return joint_graph
247
+
248
+ def _visualize_recomputable_candidate_graph_with_larger_context(
249
+ self,
250
+ layout_k: float = 0.5,
251
+ layout_iterations: int = 30,
252
+ ) -> None:
253
+ """
254
+ Visualize the recomputable candidate graph with larger context.
255
+ """
256
+ from matplotlib import cm, colors as mcolors, pyplot as plt
257
+
258
+ pos = nx.spring_layout(
259
+ self.recomputable_node_only_graph_with_larger_graph_context,
260
+ k=layout_k,
261
+ iterations=layout_iterations,
262
+ )
263
+ # pos = nx.spectral_layout(graph_with_indirect_edges)
264
+ plt.figure(figsize=(20, 15))
265
+
266
+ # Create a dictionary for node labels using the index
267
+ labels = {
268
+ node: self.recomputable_node_only_graph_with_larger_graph_context.nodes[
269
+ node
270
+ ].get("index", node)
271
+ for node in self.recomputable_node_only_graph_with_larger_graph_context.nodes
272
+ }
273
+
274
+ # Extract memory values and normalize them
275
+ norm = mcolors.Normalize(
276
+ vmin=min(self.get_knapsack_memory_input()),
277
+ vmax=max(self.get_knapsack_memory_input()),
278
+ )
279
+ cmap = cm.viridis # type: ignore[attr-defined]
280
+
281
+ # Assign colors based on memory
282
+ node_colors = [
283
+ cmap(
284
+ norm(
285
+ float(
286
+ self.recomputable_node_only_graph_with_larger_graph_context.nodes[
287
+ node
288
+ ][
289
+ "memory"
290
+ ]
291
+ )
292
+ )
293
+ )
294
+ for node in self.recomputable_node_only_graph_with_larger_graph_context.nodes
295
+ ]
296
+
297
+ # Draw the graph with parsed nodes only
298
+ nx.draw_networkx_nodes(
299
+ self.recomputable_node_only_graph_with_larger_graph_context,
300
+ pos,
301
+ node_color=node_colors,
302
+ node_size=300,
303
+ label="Parsed Nodes",
304
+ )
305
+ nx.draw_networkx_edges(
306
+ self.recomputable_node_only_graph_with_larger_graph_context,
307
+ pos,
308
+ arrows=True,
309
+ arrowsize=10,
310
+ )
311
+ nx.draw_networkx_labels(
312
+ self.recomputable_node_only_graph_with_larger_graph_context,
313
+ pos,
314
+ labels=labels,
315
+ font_size=8,
316
+ font_weight="bold",
317
+ )
318
+
319
+ plt.title("Memory Colour Coded Dependency Graph for Recomputable Nodes")
320
+ plt.colorbar(cm.ScalarMappable(norm=norm, cmap=cmap), label="Memory")
321
+ plt.show()
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_functorch/_activation_checkpointing/knapsack.py ADDED
@@ -0,0 +1,121 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+
3
+
4
+ def greedy_knapsack(
5
+ memory: list[float], runtimes: list[float], max_memory: float
6
+ ) -> tuple[float, list[int], list[int]]:
7
+ n = len(runtimes)
8
+ items = list(range(n))
9
+
10
+ # Sort items based on the ratio of runtime to memory in descending order
11
+ items = sorted(items, key=lambda i: runtimes[i] / memory[i], reverse=True)
12
+
13
+ total_memory = 0.0
14
+ total_runtime = 0.0
15
+ items_to_save = []
16
+ items_to_allow_recomputing = []
17
+
18
+ for i in items:
19
+ if total_memory + memory[i] <= max_memory:
20
+ total_memory += memory[i]
21
+ total_runtime += runtimes[i]
22
+ items_to_save.append(i)
23
+ else:
24
+ items_to_allow_recomputing.append(i)
25
+ return total_runtime, items_to_save, items_to_allow_recomputing
26
+
27
+
28
+ def ilp_knapsack(
29
+ memory: list[float], runtimes: list[float], max_memory: float
30
+ ) -> tuple[float, list[int], list[int]]:
31
+ import numpy as np
32
+
33
+ try:
34
+ from scipy.optimize import Bounds, LinearConstraint, milp
35
+ except ImportError:
36
+ raise RuntimeError(
37
+ "To use the ILP for memory budget checkpointing you need to install scipy"
38
+ ) from None
39
+
40
+ np_memory = np.array(memory)
41
+ np_runtimes = np.array(runtimes)
42
+ c = -np_runtimes # type: ignore[operator]
43
+
44
+ memory_constraint = LinearConstraint(A=np_memory, ub=np.array(max_memory))
45
+ constraints = [memory_constraint]
46
+
47
+ integrality = np.ones_like(c)
48
+ res = milp(
49
+ c=c, constraints=constraints, integrality=integrality, bounds=Bounds(0, 1)
50
+ )
51
+ if not res.success:
52
+ raise RuntimeError("Somehow scipy solving failed")
53
+
54
+ items_to_save = []
55
+ items_to_allow_recomputing = []
56
+ for idx, i in enumerate(res.x):
57
+ if i == 1:
58
+ items_to_save.append(idx)
59
+ else:
60
+ items_to_allow_recomputing.append(idx)
61
+ return -res.fun, items_to_save, items_to_allow_recomputing
62
+
63
+
64
+ def dp_knapsack(
65
+ memory: list[float], runtime: list[float], max_memory: float
66
+ ) -> tuple[float, list[int], list[int]]:
67
+ # Scaling factor to convert floating point weights to integers
68
+ S = 10000
69
+
70
+ # Quantize the memory weights
71
+ quantized_memory = torch.tensor(
72
+ [int(round(m * S)) for m in memory], dtype=torch.long, device="cpu"
73
+ )
74
+ runtimes = torch.tensor(runtime, dtype=torch.float32, device="cpu")
75
+
76
+ # Quantized pseudopolynomial DP for 0-1 Knapsack
77
+ quantized_max_memory = int(round(max_memory * S))
78
+
79
+ n = len(memory)
80
+
81
+ # Initialize the DP table
82
+ # TODO(chilli): I think if needed, this memory can be optimized with sliding
83
+ # window trick + Hirschberg trick:
84
+ # https://codeforces.com/blog/entry/47247?#comment-316200
85
+ dp = torch.zeros(
86
+ (n + 1, quantized_max_memory + 1), dtype=torch.float32, device="cpu"
87
+ )
88
+
89
+ for i in range(1, n + 1):
90
+ current_memory = quantized_memory[i - 1]
91
+ current_runtime = runtimes[i - 1]
92
+
93
+ # Copy the previous row
94
+ dp[i, :] = dp[i - 1, :]
95
+
96
+ # Update dp[i, j] for all j >= current_memory
97
+ if current_memory == 0:
98
+ dp[i, :] = dp[i - 1, :] + current_runtime
99
+ else:
100
+ dp[i, current_memory:] = torch.maximum(
101
+ dp[i - 1, current_memory:],
102
+ dp[i - 1, :-current_memory] + current_runtime,
103
+ )
104
+
105
+ # Backtrack to find the items included in the knapsack
106
+ saved_items = []
107
+ recomputable_items = []
108
+ j: int = quantized_max_memory
109
+ for i in range(n, 0, -1):
110
+ if dp[i][j] != dp[i - 1][j]:
111
+ saved_items.append(i - 1) # Include this item (indexing from 0)
112
+ j -= int(quantized_memory[i - 1].item())
113
+ else:
114
+ recomputable_items.append(i - 1)
115
+
116
+ saved_items.reverse() # To get items in the order they were added
117
+
118
+ # The maximum runtime that can be achieved within the max_memory constraint
119
+ max_runtime = dp[n][quantized_max_memory].item()
120
+
121
+ return max_runtime, saved_items, recomputable_items
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_functorch/_activation_checkpointing/knapsack_evaluator.py ADDED
@@ -0,0 +1,261 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from collections import deque
2
+ from typing import Callable
3
+
4
+ import networkx as nx
5
+
6
+ from torch._functorch._activation_checkpointing.graph_info_provider import (
7
+ GraphInfoProvider,
8
+ )
9
+
10
+
11
+ class KnapsackEvaluator:
12
+ """
13
+ This class evaluates the theoretical runtime and peak memory usage of a given checkpointing strategy.
14
+ It takes in a graph and a list of nodes that are saved and recomputed, and then simulates the
15
+ backward pass to calculate the peak memory usage.
16
+ """
17
+
18
+ def __init__(
19
+ self,
20
+ graph_info_provider: GraphInfoProvider,
21
+ ) -> None:
22
+ self._graph_info_provider = graph_info_provider
23
+
24
+ def _get_backward_memory_from_topologically_sorted_graph(
25
+ self,
26
+ node_graph: nx.DiGraph,
27
+ node_memories: dict[str, float],
28
+ saved_nodes_set: set[str],
29
+ peak_memory_after_forward_pass: float,
30
+ ) -> list[tuple[float, str]]:
31
+ """
32
+ Simulates the backward pass and keeps track of the peak memory usage.
33
+
34
+ High Level Steps:
35
+ 1. Set Initial Peak/Current Memory
36
+ Allows you to set the peak memory after the forward pass, but typically this is
37
+ the sum of the estimated memory of the saved nodes.
38
+ 2. Perform a reverse topological sort of the node_graph.
39
+ If full graph is defined then will sort the full graph and only process the subset
40
+ of nodes in the node_graph.
41
+ 3. Iterate through the sorted graph nodes.
42
+ If the node is saved then just drop it's memory from current memory.
43
+ If the node is not saved then add it's memory to current memory and then traverse it's
44
+ predecessors to simulate recomuptation chain. Will check if new peak memory after all
45
+ predecessors are processed.
46
+
47
+ Args:
48
+ node_graph (nx.DiGraph): A directed graph representing the recomputable forward nodes.
49
+ saved_nodes_set (Set[str]): A set of node names that are saved.
50
+ peak_memory_after_forward_pass (float): The peak memory usage after the forward pass.
51
+ """
52
+ current_memory = [
53
+ (peak_memory_after_forward_pass, "Initial Peak/Current Memory")
54
+ ]
55
+ already_computed = set()
56
+ sorted_nodes = list(reversed(list(nx.topological_sort(node_graph))))
57
+ dependencies_computed = set()
58
+
59
+ for node in sorted_nodes:
60
+ if node in saved_nodes_set or node in already_computed:
61
+ current_memory.append(
62
+ (
63
+ current_memory[-1][0] - node_memories[node],
64
+ f"Dropping Node(already saved): {node}",
65
+ )
66
+ )
67
+ continue
68
+
69
+ already_computed.add(node)
70
+ current_memory.append(
71
+ (
72
+ current_memory[-1][0] + node_memories[node],
73
+ f"Recomputing Node: {node}",
74
+ )
75
+ )
76
+ # Create a queue of dependencies required for recomputation
77
+ predecessor_queue = deque(
78
+ [
79
+ dependency
80
+ for dependency, v in node_graph.in_edges(node)
81
+ if dependency not in already_computed
82
+ ]
83
+ )
84
+ while predecessor_queue:
85
+ dep = predecessor_queue.popleft()
86
+ already_computed.add(dep)
87
+ dependencies_computed.add(dep)
88
+ current_memory.append(
89
+ (
90
+ current_memory[-1][0] + node_memories[dep],
91
+ f"Recomputing Predecessor of {node}: {dep}",
92
+ )
93
+ )
94
+ # Add predecessors of the predecessor to the queue if they haven't been recomputed yet
95
+ for dependency_of_dependency, _ in node_graph.in_edges(dep):
96
+ if (
97
+ dependency_of_dependency in already_computed
98
+ or dependency_of_dependency in saved_nodes_set
99
+ or dependency_of_dependency in predecessor_queue
100
+ ):
101
+ continue
102
+ predecessor_queue.append(dependency_of_dependency)
103
+ dependencies_computed.clear()
104
+ current_memory.append(
105
+ (current_memory[-1][0] - node_memories[node], f"Dropping Node: {node}")
106
+ )
107
+ return current_memory
108
+
109
+ def _validate_all_indexes_accounted_for_in_provided_output(
110
+ self, saved_nodes_idxs: list[int], recomputable_node_idxs: list[int]
111
+ ) -> None:
112
+ """
113
+ Validate that all indexes are accounted for in the provided output.
114
+ This function checks that the union of saved nodes and recomputable nodes
115
+ covers all candidate nodes without any overlaps.
116
+ """
117
+ recomputable_node_idxs_set = set(recomputable_node_idxs)
118
+ saved_nodes_idxs_set = set(saved_nodes_idxs)
119
+ all_candidate_nodes_idxs = set(
120
+ range(len(self._graph_info_provider.all_recomputable_banned_nodes))
121
+ )
122
+ # Check that there are no overlaps between saved nodes and recomputable nodes
123
+ assert (
124
+ len(recomputable_node_idxs_set.intersection(saved_nodes_idxs_set)) == 0
125
+ ), "Saved nodes and recomputable nodes cannot have any overlaps"
126
+ # Check that all candidate nodes are accounted for
127
+ assert (
128
+ recomputable_node_idxs_set.union(saved_nodes_idxs_set)
129
+ == all_candidate_nodes_idxs
130
+ ), "All candidate nodes must be accounted for in the provided output"
131
+
132
+ def evaluate_knapsack_output(
133
+ self,
134
+ saved_nodes_idxs: list[int],
135
+ recomputable_node_idxs: list[int],
136
+ account_for_backward_pass: bool = False,
137
+ ) -> dict[str, float]:
138
+ """
139
+ Evaluate the theoretical runtime and peak memory usage of a given checkpointing strategy.
140
+ Args:
141
+ - saved_nodes_idxs (List[int]): The indices of nodes that are saved.
142
+ - recomputable_node_idxs (List[int]): The indices of nodes that need to be recomputed.
143
+ """
144
+ self._validate_all_indexes_accounted_for_in_provided_output(
145
+ saved_nodes_idxs, recomputable_node_idxs
146
+ )
147
+ recomputation_runtime = sum(
148
+ self._graph_info_provider.all_node_runtimes[
149
+ self._graph_info_provider.all_recomputable_banned_nodes[node]
150
+ ]
151
+ for node in recomputable_node_idxs
152
+ )
153
+ if account_for_backward_pass:
154
+ memory_list = self._get_backward_memory_from_topologically_sorted_graph(
155
+ node_graph=self._graph_info_provider.recomputable_node_only_graph_with_larger_graph_context,
156
+ saved_nodes_set={
157
+ self._graph_info_provider.all_recomputable_banned_nodes[i]
158
+ for i in saved_nodes_idxs
159
+ },
160
+ node_memories=self._graph_info_provider.all_node_memories,
161
+ peak_memory_after_forward_pass=sum(
162
+ self._graph_info_provider.all_node_memories[
163
+ self._graph_info_provider.all_recomputable_banned_nodes[i]
164
+ ]
165
+ for i in saved_nodes_idxs
166
+ ),
167
+ )
168
+ peak_memory = max(memory_list, key=lambda x: x[0])[0]
169
+ else:
170
+ peak_memory = sum(
171
+ self._graph_info_provider.all_node_memories[
172
+ self._graph_info_provider.all_recomputable_banned_nodes[node]
173
+ ]
174
+ for node in saved_nodes_idxs
175
+ )
176
+ return {
177
+ "peak_memory": peak_memory,
178
+ "recomputation_runtime": recomputation_runtime,
179
+ "non_ac_peak_memory": self._graph_info_provider.get_non_ac_peak_memory(),
180
+ "theoretical_max_runtime": self._graph_info_provider.get_theoretical_max_runtime(),
181
+ "percentage_of_theoretical_peak_memory": peak_memory
182
+ / self._graph_info_provider.get_non_ac_peak_memory(),
183
+ "percentage_of_theoretical_peak_runtime": recomputation_runtime
184
+ / self._graph_info_provider.get_theoretical_max_runtime(),
185
+ }
186
+
187
+ def evaluate_distribution_of_results_for_knapsack_algo(
188
+ self,
189
+ knapsack_algo: Callable[
190
+ [list[float], list[float], float], tuple[float, list[int], list[int]]
191
+ ],
192
+ memory_budget_values: list[float],
193
+ ) -> list[dict[str, float]]:
194
+ """
195
+ Evaluates the distribution of results for a given knapsack algorithm.
196
+ Args:
197
+ knapsack_algo (Callable): The knapsack algorithm to use for evaluation.
198
+ memory_budget_values (List[float]): A list of memory budgets to evaluate.
199
+ """
200
+ results = list()
201
+ for memory_budget in memory_budget_values:
202
+ _, saved_nodes, recomputed_nodes = knapsack_algo(
203
+ self._graph_info_provider.get_knapsack_memory_input(),
204
+ self._graph_info_provider.get_knapsack_runtime_input(),
205
+ memory_budget,
206
+ )
207
+ result = self.evaluate_knapsack_output(
208
+ saved_nodes_idxs=saved_nodes,
209
+ recomputable_node_idxs=recomputed_nodes,
210
+ )
211
+ result["memory_budget"] = memory_budget
212
+ results.append(result)
213
+ return results
214
+
215
+ def get_knee_point_memory_budget(
216
+ self,
217
+ knapsack_algo: Callable[
218
+ [list[float], list[float], float], tuple[float, list[int], list[int]]
219
+ ],
220
+ max_mem_budget: float = 0.1,
221
+ min_mem_budget: float = 0.001,
222
+ iterations: int = 100,
223
+ ) -> float:
224
+ """
225
+ Finds the memory budget at the knee point in the Pareto frontier.
226
+
227
+ The knee point is defined as the point where the trade-off between
228
+ runtime and memory usage is optimal.
229
+
230
+ Args:
231
+ knapsack_algo (callable): Knapsack algorithm to use for evaluation.
232
+ max_mem_budget (float, optional): Maximum memory budget. Defaults to 0.1.
233
+ min_mem_budget (float, optional): Minimum memory budget. Defaults to 0.001.
234
+ iterations (int, optional): Number of memory budgets to evaluate. Defaults to 100.
235
+
236
+ Returns:
237
+ float: Memory budget at the knee point.
238
+ """
239
+ import numpy as np
240
+
241
+ results = self.evaluate_distribution_of_results_for_knapsack_algo(
242
+ knapsack_algo=knapsack_algo,
243
+ memory_budget_values=np.linspace( # type: ignore[arg-type]
244
+ min_mem_budget, max_mem_budget, iterations
245
+ ).tolist(),
246
+ )
247
+ runtime_values = np.array(
248
+ [result["percentage_of_theoretical_peak_runtime"] for result in results]
249
+ )
250
+ memory_values = np.array(
251
+ [result["percentage_of_theoretical_peak_memory"] for result in results]
252
+ )
253
+ runtime_range = np.ptp(runtime_values)
254
+ memory_range = np.ptp(memory_values)
255
+ if runtime_range == 0 or memory_range == 0:
256
+ return max_mem_budget
257
+ runtime_norm = (runtime_values - runtime_values.min()) / runtime_range
258
+ memory_norm = (memory_values - memory_values.min()) / memory_range
259
+ distances = np.sqrt(runtime_norm**2 + memory_norm**2)
260
+ knee_index = np.argmin(distances)
261
+ return results[knee_index]["memory_budget"]
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_functorch/_aot_autograd/__init__.py ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ # Copyright (c) Facebook, Inc. and its affiliates.
2
+ # All rights reserved.
3
+ #
4
+ # This source code is licensed under the BSD-style license found in the
5
+ # LICENSE file in the root directory of this source tree.
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_functorch/_aot_autograd/__pycache__/__init__.cpython-310.pyc ADDED
Binary file (241 Bytes). View file
 
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_functorch/_aot_autograd/__pycache__/autograd_cache.cpython-310.pyc ADDED
Binary file (25.7 kB). View file
 
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_functorch/_aot_autograd/__pycache__/collect_metadata_analysis.cpython-310.pyc ADDED
Binary file (13.1 kB). View file