Skip to content

Commit

Permalink
only show the reminder when GPU is used
Browse files Browse the repository at this point in the history
  • Loading branch information
Yi-FanLi committed Oct 30, 2024
1 parent 94b2d41 commit 5870a93
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions deepmd/tf/utils/batch_size.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@ def __init__(self, initial_batch_size: int = 1024, factor: float = 2.0) -> None:
super().__init__(initial_batch_size, factor)
DP_INFER_BATCH_SIZE = int(os.environ.get("DP_INFER_BATCH_SIZE", 0))
if not DP_INFER_BATCH_SIZE > 0:
log.info(
"If you encounter the error 'an illegal memory access was encountered', this may be due to a TensorFlow issue. "
"To avoid this, set the environment variable DP_INFER_BATCH_SIZE to a smaller value than the last adjusted batch size. "
"The environment variable DP_INFER_BATCH_SIZE controls the inference batch size (nframes * natoms). "
)
if self.is_gpu_available():
log.info(
"If you encounter the error 'an illegal memory access was encountered', this may be due to a TensorFlow issue. "
"To avoid this, set the environment variable DP_INFER_BATCH_SIZE to a smaller value than the last adjusted batch size. "
"The environment variable DP_INFER_BATCH_SIZE controls the inference batch size (nframes * natoms). "
)

def is_gpu_available(self) -> bool:
"""Check if GPU is available.
Expand Down

0 comments on commit 5870a93

Please sign in to comment.