Skip to content

Commit

Permalink
Optimized the prompt information for users when setting CPU affinity (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaoguochun1995 authored Jul 5, 2024
1 parent ccd268e commit 99ba079
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 4 additions & 3 deletions dipu/torch_dipu/csrc_dipu/runtime/devproxy/deviceproxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "csrc_dipu/runtime/core/allocator/allocator_metrics.h"
#include "csrc_dipu/runtime/device/basedef.h"
#include "csrc_dipu/runtime/device/deviceapis.h"
#include "csrc_dipu/utils/Log.h"
#include "csrc_dipu/utils/env.hpp"

namespace dipu {
Expand Down Expand Up @@ -78,9 +79,9 @@ void setCpuAffinity(const int device) {
std::min((device + 1) * block_size, num_of_processors);
cpu_set_t mask;
CPU_ZERO(&mask);
TORCH_WARN("DIPU_CPU_AFFINITY: Bind device ", device,
" with cpu core: ", start_cpu_core, "~", end_cpu_core,
", the number of processors:", num_of_processors);
DIPU_LOG_INFO << "DIPU_CPU_AFFINITY: Bind device " << device
<< " with cpu cores: [" << start_cpu_core << "," << end_cpu_core
<< "), the number of processors:" << num_of_processors;
for (int i = start_cpu_core; i < end_cpu_core; i++) {
CPU_SET(i, &mask);
}
Expand Down
2 changes: 2 additions & 0 deletions dipu/torch_dipu/csrc_dipu/utils/Log.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@
#define DIPU_LOG_ERROR_ONCE \
static const auto& __attribute__((unused)) \
MAKE_UNIQUE_VARIABLE_NAME(__func__) = DIPU_LOG_ERROR

#define DIPU_LOG_INFO std::cout

0 comments on commit 99ba079

Please sign in to comment.