Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(dipu): move some env vars to environs.hpp #911

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

zyf654321
Copy link
Contributor

Use macro definition to read environment variables, add comments and modify the name of environment variables.

@yewentao256
Copy link
Contributor

需要修一下lint

Copy link
Collaborator

@lljbash lljbash left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

修改了一些文档,按照我的思路在过一下其他的,后续也一样

注意语法、简洁性和明确性,如果对作用不明确可以找人问


// Configure a value to limit the maximum length of the asynchronous resource
// pool to avoid resource leakage and optimize resource management.
inline const std::size_t kDefaultMaxAsyncResourcePoolLength = 96;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
inline const std::size_t kDefaultMaxAsyncResourcePoolLength = 96;
constexpr std::size_t kDefaultMaxAsyncResourcePoolLength = 96;

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

有些地方定义了常量,有些地方直接写了默认值,建议统一起来


// Configure a numerical value to control the device 's affinity settings
// on the CPU to optimize thread scheduling during concurrent execution.
DIPU_ENV_VAR(affinityCpuAffinit, "DIPU_CPU_AFFINITY", std::size_t, 0);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
DIPU_ENV_VAR(affinityCpuAffinit, "DIPU_CPU_AFFINITY", std::size_t, 0);
DIPU_ENV_VAR(cpuAffinity, "DIPU_CPU_AFFINITY", std::size_t, 0);

Comment on lines +118 to +119
// Configure a numerical value to control the device 's affinity settings
// on the CPU to optimize thread scheduling during concurrent execution.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Configure a numerical value to control the device 's affinity settings
// on the CPU to optimize thread scheduling during concurrent execution.
// Devices' CPU affinity settings.
// >0: specifies the number of adjacent CPU cores bound to each device
// =0: auto determine
// <0: affinity disabled

Comment on lines +113 to +114
// Control whether to force the use of back-off mode for P2P copy operation
// between Ascend chips.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Control whether to force the use of back-off mode for P2P copy operation
// between Ascend chips.
// Whether to force the use of back-off mode for P2P copy operation between
// Ascend chips.

DIPU_ENV_VAR(hostMemCachingAlgorithm, "DIPU_HOST_MEMCACHING_ALGORITHM",
std::string, kTorchAllocatorName);

// Used to specify the name of the device memory cache algorithm.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Used to specify the name of the device memory cache algorithm.
// Devices' memory caching algorithm.
// Candidates: TORCH, BF, BS, RAW

Comment on lines +90 to +91
// Determine the name of the host memory cache algorithm
// based on the current environment configuration.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Determine the name of the host memory cache algorithm
// based on the current environment configuration.
// Host's memory caching algorithm.
// Candidates: TORCH, BF, BS, RAW

Comment on lines +99 to +100
// Used to configure and initialize an instance of an object
// "CachingAllocatorConfig".
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Used to configure and initialize an instance of an object
// "CachingAllocatorConfig".
// Same as TORCH_ALLOCATOR_CONF in PyTorch.
// Only works with TORCH caching algorithm.

@lljbash lljbash changed the title refactor Kbh/move environ:Use macro definition to read environment variables refactor(dipu): move some env vars to environs.hpp Jul 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants