Commit 197df27
Normalize CUDA Device to cuda:0 (#177)
Summary:
fix #176
## Changes
This PR adds device normalization logic to ensure all tensors are created on `cuda:0`, regardless of the device specified in the JSON configuration.
## Modifications
### 1. `load_tensor()` function
- Added device normalization before loading tensor from file
- Any CUDA device string (e.g., `cuda`, `cuda:1`, `cuda:2`) is now mapped to `cuda:0`
### 2. `_create_base_tensor()` function
- Added device normalization before creating new tensors
- Applies to all tensor types: floating-point, integer, complex, and unsigned integer
## Impact
- **Prevents multi-GPU issues**: All tensors are now consistently created on the same device
- **Backward compatible**: Non-CUDA devices (e.g., `cpu`) remain unchanged
- **Minimal code change**: Only two strategic locations modified for maximum coverage
## Testing
This change affects the template file used for generating reproducers. All generated test cases will now place tensors on `cuda:0` by default.
Pull Request resolved: #177
Reviewed By: wychi
Differential Revision: D85061992
Pulled By: FindHao
fbshipit-source-id: 594018cc2a8917a762328257950fdf7227ad75031 parent 4fa7d4e commit 197df27
1 file changed
+7
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
70 | 74 | | |
71 | 75 | | |
72 | 76 | | |
| |||
210 | 214 | | |
211 | 215 | | |
212 | 216 | | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
213 | 220 | | |
214 | 221 | | |
215 | 222 | | |
| |||
0 commit comments