-
Notifications
You must be signed in to change notification settings - Fork 154
added logic to create graph depending on driver cuda version #413
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 5 commits
38b6f20
81a7467
201e009
b93de62
89aa3eb
aafd1e6
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 |
|---|---|---|
|
|
@@ -18,6 +18,9 @@ | |
| ModelBridge = WarpBridge | ||
| DataBridge = WarpBridge | ||
|
|
||
| # mujoco_warp uses 'wp.capture_while' which strictly requires Driver 12.4+ | ||
| _MIN_DRIVER_FOR_CONDITIONAL_GRAPHS = 12.4 | ||
|
|
||
| _JACOBIAN_MAP = { | ||
| "auto": mujoco.mjtJacobian.mjJAC_AUTO, | ||
| "dense": mujoco.mjtJacobian.mjJAC_DENSE, | ||
|
|
@@ -128,9 +131,22 @@ def __init__( | |
| self._model_bridge = WarpBridge(self._wp_model, nworld=self.num_envs) | ||
| self._data_bridge = WarpBridge(self._wp_data) | ||
|
|
||
| self.use_cuda_graph = self.wp_device.is_cuda and wp.is_mempool_enabled( | ||
| self.wp_device | ||
| driver_ver = wp.context.runtime.driver_version | ||
| driver_ver = float(f"{driver_ver[0]}.{driver_ver[1]}") | ||
| self.use_cuda_graph = ( | ||
| self.wp_device.is_cuda | ||
| and wp.is_mempool_enabled(self.wp_device) | ||
| and driver_ver >= _MIN_DRIVER_FOR_CONDITIONAL_GRAPHS | ||
| ) | ||
|
|
||
| if self.use_cuda_graph: | ||
| print("Warming up CUDA kernels...") | ||
| mjwarp.step(self.wp_model, self.wp_data) | ||
| wp.synchronize() | ||
|
||
| else: | ||
| print(f"[WARNING] Disabling CUDA Graphs. Current Driver {driver_ver} < 12.4.") | ||
| print(" mujoco_warp solver requires 12.4+ for graph loops.") | ||
|
|
||
| self.create_graph() | ||
|
|
||
| self.nan_guard = NanGuard(cfg.nan_guard, self.num_envs, self._mj_model) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.