-
Notifications
You must be signed in to change notification settings - Fork 2.7k
[FEATURE] Add nvidia-smi fallback for GPU detection in cloud environments #2694
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
16f141a
3dcf064
745a438
7783c00
9770d0b
2ad5a26
d05edc6
331383b
ccf9c5e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -169,6 +169,7 @@ class ContactForceSensorMetadata(RigidSensorMetadataMixin, NoisySensorMetadataMi | |||||||||||
|
|
||||||||||||
| min_force: torch.Tensor = make_tensor_field((0, 3)) | ||||||||||||
| max_force: torch.Tensor = make_tensor_field((0, 3)) | ||||||||||||
| history_length: int = 1 | ||||||||||||
|
|
||||||||||||
|
|
||||||||||||
| class ContactForceSensor( | ||||||||||||
|
|
@@ -185,6 +186,74 @@ def __init__(self, options: ContactForceSensorOptions, sensor_idx: int, sensor_m | |||||||||||
|
|
||||||||||||
| self.debug_object: "Mesh" | None = None | ||||||||||||
|
|
||||||||||||
| @gs.assert_built | ||||||||||||
| def read(self, envs_idx=None) -> torch.Tensor: | ||||||||||||
| """ | ||||||||||||
| Read the sensor data (with noise applied if applicable). | ||||||||||||
| """ | ||||||||||||
| envs_idx = self._sanitize_envs_idx(envs_idx) | ||||||||||||
| history_length = self._options.history_length | ||||||||||||
|
|
||||||||||||
| buffered_data = self._manager._buffered_data[gs.tc_float] | ||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The history branch reads from Useful? React with 👍 / 👎. |
||||||||||||
| cache_slice = slice(self._cache_idx, self._cache_idx + 3) | ||||||||||||
|
|
||||||||||||
| if history_length == 1: | ||||||||||||
| return self._get_formatted_data(self._manager.get_cloned_from_cache(self), envs_idx) | ||||||||||||
|
|
||||||||||||
| n_envs = self._manager._sim.n_envs | ||||||||||||
| # Determine actual number of envs being queried | ||||||||||||
| if envs_idx is None: | ||||||||||||
| n_query_envs = n_envs if n_envs > 0 else 0 | ||||||||||||
| else: | ||||||||||||
| n_query_envs = len(envs_idx) | ||||||||||||
|
|
||||||||||||
| history_data = [] | ||||||||||||
| for i in range(history_length): | ||||||||||||
| hist = buffered_data.at(i, envs_idx, cache_slice) | ||||||||||||
| if n_envs == 0: | ||||||||||||
| hist = hist.reshape(3) | ||||||||||||
| else: | ||||||||||||
| hist = hist.reshape(n_query_envs, 3) | ||||||||||||
| history_data.append(hist) | ||||||||||||
|
|
||||||||||||
| result = torch.stack(history_data, dim=1) | ||||||||||||
| return result.squeeze(1) if n_envs == 0 else result | ||||||||||||
|
Comment on lines
+219
to
+220
|
||||||||||||
| result = torch.stack(history_data, dim=1) | |
| return result.squeeze(1) if n_envs == 0 else result | |
| stack_dim = 0 if n_envs == 0 else 1 | |
| result = torch.stack(history_data, dim=stack_dim) | |
| return result |
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -12,6 +12,7 @@ | |||||||
| NonNegativeFloat, | ||||||||
| NonNegativeInt, | ||||||||
| PositiveFloat, | ||||||||
| PositiveInt, | ||||||||
| RotationMatrixType, | ||||||||
| UnitIntervalVec3Type, | ||||||||
| UnitIntervalVec4Type, | ||||||||
|
|
@@ -182,6 +183,9 @@ class ContactForce(RigidSensorOptionsMixin["ContactForceSensor"], NoisySensorOpt | |||||||
| The minimum detectable absolute force per each axis. Values below this will be treated as 0. Default is 0. | ||||||||
| max_force : float | array-like[float, float, float], optional | ||||||||
| The maximum output absolute force per each axis. Values above this will be clipped. Default is infinity. | ||||||||
| history_length : int, optional | ||||||||
| The number of historical force readings to store and return. Default is 1 (current value only). | ||||||||
| When > 1, the sensor returns a history buffer of shape (history_length, 3) per environment. | ||||||||
|
||||||||
| When > 1, the sensor returns a history buffer of shape (history_length, 3) per environment. | |
| When > 1, the sensor returns a history buffer with shape (history_length, 3) for a single environment, | |
| or (n_envs, history_length, 3) when returned in batched form across multiple environments. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR introduces additional public API/features beyond the stated GPU-detection fallback (e.g., new
RigidEntity.get_height_at()/get_normal_at()terrain helpers). Either update the PR description/title to reflect these additions or split them into a separate PR to keep review scope focused and reduce merge risk.