From 811ff3ad05082917720a612e42a1b2d114bbf03e Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 28 Mar 2024 05:10:58 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- source/api_cc/src/DeepPotPT.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/api_cc/src/DeepPotPT.cc b/source/api_cc/src/DeepPotPT.cc index 30641348c7..4fcebfb5d9 100644 --- a/source/api_cc/src/DeepPotPT.cc +++ b/source/api_cc/src/DeepPotPT.cc @@ -38,10 +38,11 @@ void DeepPotPT::init(const std::string& model, return; } int gpu_num = torch::cuda::device_count(); - if(gpu_num > 0) + if (gpu_num > 0) { gpu_id = gpu_rank % gpu_num; - else + } else { gpu_id = 0; + } torch::Device device(torch::kCUDA, gpu_id); gpu_enabled = torch::cuda::is_available(); if (!gpu_enabled) {