Commit 839eead
authored
* fix: flush MPS cache in alora test GPU cleanup (#790)
Add torch.mps.empty_cache() after CUDA cleanup blocks in both
alora integration tests, matching the existing conftest pattern.
Prevents MPS memory from accumulating between tests on Apple Silicon.
* refactor(test): extract flush_device_caches() helper for GPU cleanup
Consolidate the duplicated gc.collect + CUDA/MPS cache flush pattern
into a single flush_device_caches() function in test/conftest.py.
- Replaces 4 inline flush sites with a single call
- Adds MPS support to sites that previously only handled CUDA
(pytest_runtest_setup backend transitions, memory_cleaner fixture)
- Fixes a bug where gc.collect() was conditional on CUDA availability
in pytest_runtest_setup (now runs unconditionally)
- Adds torch.mps.synchronize() for parity with CUDA synchronize()
- Enriches cleanup_gpu_backend() VRAM logging: device-aware reporting
for both CUDA (free/total/allocated/reserved/fragmentation) and MPS
(allocated/max), with reclaimed bytes on both paths
- Removes unused shutil/sys imports from test_alora_train_integration
1 parent e0ffd3d commit 839eead
2 files changed
Lines changed: 70 additions & 58 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
9 | | - | |
10 | 8 | | |
11 | 9 | | |
12 | 10 | | |
13 | 11 | | |
14 | 12 | | |
| 13 | + | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| |||
292 | 292 | | |
293 | 293 | | |
294 | 294 | | |
295 | | - | |
296 | | - | |
297 | 295 | | |
298 | 296 | | |
299 | 297 | | |
| |||
310 | 308 | | |
311 | 309 | | |
312 | 310 | | |
313 | | - | |
314 | | - | |
315 | | - | |
316 | | - | |
317 | | - | |
318 | | - | |
| 311 | + | |
| 312 | + | |
319 | 313 | | |
320 | 314 | | |
321 | 315 | | |
| |||
391 | 385 | | |
392 | 386 | | |
393 | 387 | | |
394 | | - | |
395 | | - | |
396 | | - | |
397 | | - | |
398 | | - | |
399 | | - | |
400 | | - | |
| 388 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
260 | 260 | | |
261 | 261 | | |
262 | 262 | | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
263 | 290 | | |
264 | 291 | | |
265 | 292 | | |
| |||
275 | 302 | | |
276 | 303 | | |
277 | 304 | | |
278 | | - | |
279 | | - | |
280 | 305 | | |
281 | 306 | | |
282 | 307 | | |
283 | 308 | | |
284 | 309 | | |
285 | 310 | | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
286 | 314 | | |
287 | | - | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
288 | 318 | | |
289 | | - | |
290 | | - | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
291 | 332 | | |
292 | | - | |
293 | | - | |
294 | 333 | | |
295 | 334 | | |
296 | 335 | | |
| |||
357 | 396 | | |
358 | 397 | | |
359 | 398 | | |
360 | | - | |
361 | | - | |
| 399 | + | |
362 | 400 | | |
| 401 | + | |
363 | 402 | | |
364 | | - | |
365 | | - | |
366 | | - | |
367 | | - | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
368 | 406 | | |
369 | | - | |
370 | | - | |
371 | | - | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
372 | 419 | | |
373 | | - | |
374 | | - | |
375 | 420 | | |
376 | 421 | | |
377 | 422 | | |
| |||
478 | 523 | | |
479 | 524 | | |
480 | 525 | | |
481 | | - | |
482 | | - | |
483 | | - | |
484 | | - | |
485 | | - | |
486 | | - | |
487 | | - | |
488 | | - | |
489 | | - | |
490 | | - | |
491 | | - | |
| 526 | + | |
492 | 527 | | |
493 | 528 | | |
494 | 529 | | |
| |||
566 | 601 | | |
567 | 602 | | |
568 | 603 | | |
569 | | - | |
570 | | - | |
571 | | - | |
572 | | - | |
573 | | - | |
574 | | - | |
575 | | - | |
576 | | - | |
577 | | - | |
578 | | - | |
579 | | - | |
580 | | - | |
| 604 | + | |
581 | 605 | | |
582 | 606 | | |
583 | 607 | | |
| |||
0 commit comments