File tree Expand file tree Collapse file tree 2 files changed +21
-4
lines changed
Expand file tree Collapse file tree 2 files changed +21
-4
lines changed Original file line number Diff line number Diff line change 1+ # Copyright (c) 2014-2024, Lawrence Livermore National Security, LLC.
2+ # Produced at the Lawrence Livermore National Laboratory.
3+ # Written by the LBANN Research Team (B. Van Essen, et al.) listed in
4+ # the CONTRIBUTORS file. See the top-level LICENSE file for details.
5+ #
6+ # LLNL-CODE-697807.
7+ # All rights reserved.
8+ #
9+ # This file is part of LBANN: Livermore Big Artificial Neural Network
10+ # Toolkit. For details, see http://software.llnl.gov/LBANN or
11+ # https://github.com/LBANN and https://github.com/LLNL/LBANN.
12+ #
13+ # SPDX-License-Identifier: (Apache-2.0)
114from hpc_launcher .schedulers .scheduler import Scheduler
215from dataclasses import dataclass
316from typing import TYPE_CHECKING , Optional
Original file line number Diff line number Diff line change 1212#
1313# SPDX-License-Identifier: (Apache-2.0)
1414from psutil import Process
15+ import inspect
1516
16- # Save affinity before importing torch
17- affinity = Process ().cpu_affinity ()
17+ affinity = None
18+ if (hasattr (Process , 'cpu_affinity' ) and inspect .isfunction (Process .cpu_affinity )):
19+ # Save affinity before importing torch
20+ affinity = Process ().cpu_affinity ()
1821
1922import torch
2023
21- # Restore affinity after importing torch
22- Process ().cpu_affinity (affinity )
24+ if affinity is not None :
25+ # Restore affinity after importing torch
26+ Process ().cpu_affinity (affinity )
2327import os
2428
2529if torch .cuda .is_available ():
You can’t perform that action at this time.
0 commit comments