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

support gdr malloc&free #8

Merged
merged 1 commit into from
Dec 24, 2024
Merged

support gdr malloc&free #8

merged 1 commit into from
Dec 24, 2024

Conversation

starkhu
Copy link
Contributor

@starkhu starkhu commented Dec 23, 2024

No description provided.

@@ -17,7 +17,7 @@ flagcxResult_t mluAdaptorDeviceMemcpy(void *dst, void *src, size_t size, flagcxM
if (stream == NULL) {
DEVCHECK(cnrtMemcpy(dst, src, size, memcpy_type_map[type]));
} else {
DEVCHECK(cnrtMemcpyAsync_V3(dst, src, size, stream->base, memcpy_type_map[type]));
DEVCHECK(cnrtMemcpyAsync_V2(dst, src, size, stream->base, memcpy_type_map[type]));
Copy link
Collaborator

Choose a reason for hiding this comment

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

这里后续会升级导致兼容问题么?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

这个貌似没有更好的办法,只能锚定cambricon的某个版本,后续更新cambricon docker后再升级接口。

@@ -73,12 +73,12 @@ flagcxResult_t mluAdaptorGetVendor(char *vendor) {
}

flagcxResult_t mluAdaptorGdrMemAlloc(void **ptr, size_t size, void *memHandle) {
// TODO: Implement GDR memory allocation
DEVCHECK(cnrtMalloc(ptr, size));
Copy link
Collaborator

Choose a reason for hiding this comment

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

这里直接用cnrtMalloc就可以了?不需要再进行额外操作?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

参照cuda代码,添加了防呆。mlu申请gdr内存时暂时没有设置属性的函数,因此暂不需要其他其他操作。


ifeq ($(strip $(DEVICE_HOME)),)
ifeq ($(USE_NVIDIA), 1)
DEVICE_HOME = /usr/local/cuda
else ifeq ($(USE_ILUVATAR_COREX), 1)
DEVICE_HOME = /usr/local/corex
else ifeq ($(USE_CAMBRICON), 1)
DEVICE_HOME = /torch/neuware_home
DEVICE_HOME = $(NEUWARE_HOME)
Copy link
Collaborator

Choose a reason for hiding this comment

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

NEUWARE_HOME是系统默认环境变量?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

mlu的docker中都默认设置了这个环境变量,不需要用户自己设置。

@MC952-arch MC952-arch merged commit c4fc7fa into FlagOpen:main Dec 24, 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.

2 participants