Skip to content

Add error messages when memory providers are disabled #1012

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

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/provider/provider_cuda.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,37 @@
#include <umf.h>
#include <umf/providers/provider_cuda.h>

#include "utils_log.h"

#if defined(UMF_NO_CUDA_PROVIDER)

umf_result_t umfCUDAMemoryProviderParamsCreate(
umf_cuda_memory_provider_params_handle_t *hParams) {
(void)hParams;
LOG_ERR("CUDA provider is disabled (UMF_BUILD_CUDA_PROVIDER is OFF)!");
return UMF_RESULT_ERROR_NOT_SUPPORTED;
}

umf_result_t umfCUDAMemoryProviderParamsDestroy(
umf_cuda_memory_provider_params_handle_t hParams) {
(void)hParams;
LOG_ERR("CUDA provider is disabled (UMF_BUILD_CUDA_PROVIDER is OFF)!");
return UMF_RESULT_ERROR_NOT_SUPPORTED;
}

umf_result_t umfCUDAMemoryProviderParamsSetContext(
umf_cuda_memory_provider_params_handle_t hParams, void *hContext) {
(void)hParams;
(void)hContext;
LOG_ERR("CUDA provider is disabled (UMF_BUILD_CUDA_PROVIDER is OFF)!");
return UMF_RESULT_ERROR_NOT_SUPPORTED;
}

umf_result_t umfCUDAMemoryProviderParamsSetDevice(
umf_cuda_memory_provider_params_handle_t hParams, int hDevice) {
(void)hParams;
(void)hDevice;
LOG_ERR("CUDA provider is disabled (UMF_BUILD_CUDA_PROVIDER is OFF)!");
return UMF_RESULT_ERROR_NOT_SUPPORTED;
}

Expand All @@ -45,11 +51,13 @@ umf_result_t umfCUDAMemoryProviderParamsSetMemoryType(
umf_usm_memory_type_t memoryType) {
(void)hParams;
(void)memoryType;
LOG_ERR("CUDA provider is disabled (UMF_BUILD_CUDA_PROVIDER is OFF)!");
return UMF_RESULT_ERROR_NOT_SUPPORTED;
}

umf_memory_provider_ops_t *umfCUDAMemoryProviderOps(void) {
// not supported
LOG_ERR("CUDA provider is disabled (UMF_BUILD_CUDA_PROVIDER is OFF)!");
return NULL;
}

Expand Down
7 changes: 7 additions & 0 deletions src/provider/provider_devdax_memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,13 @@
#include <umf/memory_provider_ops.h>
#include <umf/providers/provider_devdax_memory.h>

#include "utils_log.h"

#if defined(_WIN32) || defined(UMF_NO_HWLOC)

umf_memory_provider_ops_t *umfDevDaxMemoryProviderOps(void) {
// not supported
LOG_ERR("DevDax memory provider is disabled!");
return NULL;
}

Expand All @@ -30,12 +33,14 @@ umf_result_t umfDevDaxMemoryProviderParamsCreate(
(void)hParams;
(void)path;
(void)size;
LOG_ERR("DevDax memory provider is disabled!");
return UMF_RESULT_ERROR_NOT_SUPPORTED;
}

umf_result_t umfDevDaxMemoryProviderParamsDestroy(
umf_devdax_memory_provider_params_handle_t hParams) {
(void)hParams;
LOG_ERR("DevDax memory provider is disabled!");
return UMF_RESULT_ERROR_NOT_SUPPORTED;
}

Expand All @@ -45,13 +50,15 @@ umf_result_t umfDevDaxMemoryProviderParamsSetDeviceDax(
(void)hParams;
(void)path;
(void)size;
LOG_ERR("DevDax memory provider is disabled!");
return UMF_RESULT_ERROR_NOT_SUPPORTED;
}

umf_result_t umfDevDaxMemoryProviderParamsSetProtection(
umf_devdax_memory_provider_params_handle_t hParams, unsigned protection) {
(void)hParams;
(void)protection;
LOG_ERR("DevDax memory provider is disabled!");
return UMF_RESULT_ERROR_NOT_SUPPORTED;
}

Expand Down
8 changes: 8 additions & 0 deletions src/provider/provider_file_memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,37 +18,44 @@
#include <umf/memory_provider_ops.h>
#include <umf/providers/provider_file_memory.h>

#include "utils_log.h"

#if defined(_WIN32) || defined(UMF_NO_HWLOC)

umf_memory_provider_ops_t *umfFileMemoryProviderOps(void) {
// not supported
LOG_ERR("File memory provider is disabled!");
return NULL;
}

umf_result_t umfFileMemoryProviderParamsCreate(
umf_file_memory_provider_params_handle_t *hParams, const char *path) {
(void)hParams;
(void)path;
LOG_ERR("File memory provider is disabled!");
return UMF_RESULT_ERROR_NOT_SUPPORTED;
}

umf_result_t umfFileMemoryProviderParamsDestroy(
umf_file_memory_provider_params_handle_t hParams) {
(void)hParams;
LOG_ERR("File memory provider is disabled!");
return UMF_RESULT_ERROR_NOT_SUPPORTED;
}

umf_result_t umfFileMemoryProviderParamsSetPath(
umf_file_memory_provider_params_handle_t hParams, const char *path) {
(void)hParams;
(void)path;
LOG_ERR("File memory provider is disabled!");
return UMF_RESULT_ERROR_NOT_SUPPORTED;
}

umf_result_t umfFileMemoryProviderParamsSetProtection(
umf_file_memory_provider_params_handle_t hParams, unsigned protection) {
(void)hParams;
(void)protection;
LOG_ERR("File memory provider is disabled!");
return UMF_RESULT_ERROR_NOT_SUPPORTED;
}

Expand All @@ -57,6 +64,7 @@ umf_result_t umfFileMemoryProviderParamsSetVisibility(
umf_memory_visibility_t visibility) {
(void)hParams;
(void)visibility;
LOG_ERR("File memory provider is disabled!");
return UMF_RESULT_ERROR_NOT_SUPPORTED;
}

Expand Down
16 changes: 16 additions & 0 deletions src/provider/provider_level_zero.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,23 @@
#include <umf/memory_provider_ops.h>
#include <umf/providers/provider_level_zero.h>

#include "utils_log.h"

#if defined(UMF_NO_LEVEL_ZERO_PROVIDER)

umf_result_t umfLevelZeroMemoryProviderParamsCreate(
umf_level_zero_memory_provider_params_handle_t *hParams) {
(void)hParams;
LOG_ERR("L0 memory provider is disabled! (UMF_BUILD_LEVEL_ZERO_PROVIDER is "
"OFF)");
return UMF_RESULT_ERROR_NOT_SUPPORTED;
}

umf_result_t umfLevelZeroMemoryProviderParamsDestroy(
umf_level_zero_memory_provider_params_handle_t hParams) {
(void)hParams;
LOG_ERR("L0 memory provider is disabled! (UMF_BUILD_LEVEL_ZERO_PROVIDER is "
"OFF)");
return UMF_RESULT_ERROR_NOT_SUPPORTED;
}

Expand All @@ -33,6 +39,8 @@ umf_result_t umfLevelZeroMemoryProviderParamsSetContext(
ze_context_handle_t hContext) {
(void)hParams;
(void)hContext;
LOG_ERR("L0 memory provider is disabled! (UMF_BUILD_LEVEL_ZERO_PROVIDER is "
"OFF)");
return UMF_RESULT_ERROR_NOT_SUPPORTED;
}

Expand All @@ -41,6 +49,8 @@ umf_result_t umfLevelZeroMemoryProviderParamsSetDevice(
ze_device_handle_t hDevice) {
(void)hParams;
(void)hDevice;
LOG_ERR("L0 memory provider is disabled! (UMF_BUILD_LEVEL_ZERO_PROVIDER is "
"OFF)");
return UMF_RESULT_ERROR_NOT_SUPPORTED;
}

Expand All @@ -49,6 +59,8 @@ umf_result_t umfLevelZeroMemoryProviderParamsSetMemoryType(
umf_usm_memory_type_t memoryType) {
(void)hParams;
(void)memoryType;
LOG_ERR("L0 memory provider is disabled! (UMF_BUILD_LEVEL_ZERO_PROVIDER is "
"OFF)");
return UMF_RESULT_ERROR_NOT_SUPPORTED;
}

Expand All @@ -58,11 +70,15 @@ umf_result_t umfLevelZeroMemoryProviderParamsSetResidentDevices(
(void)hParams;
(void)hDevices;
(void)deviceCount;
LOG_ERR("L0 memory provider is disabled! (UMF_BUILD_LEVEL_ZERO_PROVIDER is "
"OFF)");
return UMF_RESULT_ERROR_NOT_SUPPORTED;
}

umf_memory_provider_ops_t *umfLevelZeroMemoryProviderOps(void) {
// not supported
LOG_ERR("L0 memory provider is disabled! (UMF_BUILD_LEVEL_ZERO_PROVIDER is "
"OFF)");
return NULL;
}

Expand Down
Loading