Skip to content

Commit 7510404

Browse files
authored
Merge pull request #1012 from ldorau/Add_error_messages_when_memory_providers_are_disabled
Add error messages when memory providers are disabled
2 parents ac9094d + 0d0d9b2 commit 7510404

File tree

4 files changed

+39
-0
lines changed

4 files changed

+39
-0
lines changed

src/provider/provider_cuda.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,31 +12,37 @@
1212
#include <umf.h>
1313
#include <umf/providers/provider_cuda.h>
1414

15+
#include "utils_log.h"
16+
1517
#if defined(UMF_NO_CUDA_PROVIDER)
1618

1719
umf_result_t umfCUDAMemoryProviderParamsCreate(
1820
umf_cuda_memory_provider_params_handle_t *hParams) {
1921
(void)hParams;
22+
LOG_ERR("CUDA provider is disabled (UMF_BUILD_CUDA_PROVIDER is OFF)!");
2023
return UMF_RESULT_ERROR_NOT_SUPPORTED;
2124
}
2225

2326
umf_result_t umfCUDAMemoryProviderParamsDestroy(
2427
umf_cuda_memory_provider_params_handle_t hParams) {
2528
(void)hParams;
29+
LOG_ERR("CUDA provider is disabled (UMF_BUILD_CUDA_PROVIDER is OFF)!");
2630
return UMF_RESULT_ERROR_NOT_SUPPORTED;
2731
}
2832

2933
umf_result_t umfCUDAMemoryProviderParamsSetContext(
3034
umf_cuda_memory_provider_params_handle_t hParams, void *hContext) {
3135
(void)hParams;
3236
(void)hContext;
37+
LOG_ERR("CUDA provider is disabled (UMF_BUILD_CUDA_PROVIDER is OFF)!");
3338
return UMF_RESULT_ERROR_NOT_SUPPORTED;
3439
}
3540

3641
umf_result_t umfCUDAMemoryProviderParamsSetDevice(
3742
umf_cuda_memory_provider_params_handle_t hParams, int hDevice) {
3843
(void)hParams;
3944
(void)hDevice;
45+
LOG_ERR("CUDA provider is disabled (UMF_BUILD_CUDA_PROVIDER is OFF)!");
4046
return UMF_RESULT_ERROR_NOT_SUPPORTED;
4147
}
4248

@@ -45,11 +51,13 @@ umf_result_t umfCUDAMemoryProviderParamsSetMemoryType(
4551
umf_usm_memory_type_t memoryType) {
4652
(void)hParams;
4753
(void)memoryType;
54+
LOG_ERR("CUDA provider is disabled (UMF_BUILD_CUDA_PROVIDER is OFF)!");
4855
return UMF_RESULT_ERROR_NOT_SUPPORTED;
4956
}
5057

5158
umf_memory_provider_ops_t *umfCUDAMemoryProviderOps(void) {
5259
// not supported
60+
LOG_ERR("CUDA provider is disabled (UMF_BUILD_CUDA_PROVIDER is OFF)!");
5361
return NULL;
5462
}
5563

src/provider/provider_devdax_memory.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,13 @@
1717
#include <umf/memory_provider_ops.h>
1818
#include <umf/providers/provider_devdax_memory.h>
1919

20+
#include "utils_log.h"
21+
2022
#if defined(_WIN32) || defined(UMF_NO_HWLOC)
2123

2224
umf_memory_provider_ops_t *umfDevDaxMemoryProviderOps(void) {
2325
// not supported
26+
LOG_ERR("DevDax memory provider is disabled!");
2427
return NULL;
2528
}
2629

@@ -30,12 +33,14 @@ umf_result_t umfDevDaxMemoryProviderParamsCreate(
3033
(void)hParams;
3134
(void)path;
3235
(void)size;
36+
LOG_ERR("DevDax memory provider is disabled!");
3337
return UMF_RESULT_ERROR_NOT_SUPPORTED;
3438
}
3539

3640
umf_result_t umfDevDaxMemoryProviderParamsDestroy(
3741
umf_devdax_memory_provider_params_handle_t hParams) {
3842
(void)hParams;
43+
LOG_ERR("DevDax memory provider is disabled!");
3944
return UMF_RESULT_ERROR_NOT_SUPPORTED;
4045
}
4146

@@ -45,13 +50,15 @@ umf_result_t umfDevDaxMemoryProviderParamsSetDeviceDax(
4550
(void)hParams;
4651
(void)path;
4752
(void)size;
53+
LOG_ERR("DevDax memory provider is disabled!");
4854
return UMF_RESULT_ERROR_NOT_SUPPORTED;
4955
}
5056

5157
umf_result_t umfDevDaxMemoryProviderParamsSetProtection(
5258
umf_devdax_memory_provider_params_handle_t hParams, unsigned protection) {
5359
(void)hParams;
5460
(void)protection;
61+
LOG_ERR("DevDax memory provider is disabled!");
5562
return UMF_RESULT_ERROR_NOT_SUPPORTED;
5663
}
5764

src/provider/provider_file_memory.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,37 +18,44 @@
1818
#include <umf/memory_provider_ops.h>
1919
#include <umf/providers/provider_file_memory.h>
2020

21+
#include "utils_log.h"
22+
2123
#if defined(_WIN32) || defined(UMF_NO_HWLOC)
2224

2325
umf_memory_provider_ops_t *umfFileMemoryProviderOps(void) {
2426
// not supported
27+
LOG_ERR("File memory provider is disabled!");
2528
return NULL;
2629
}
2730

2831
umf_result_t umfFileMemoryProviderParamsCreate(
2932
umf_file_memory_provider_params_handle_t *hParams, const char *path) {
3033
(void)hParams;
3134
(void)path;
35+
LOG_ERR("File memory provider is disabled!");
3236
return UMF_RESULT_ERROR_NOT_SUPPORTED;
3337
}
3438

3539
umf_result_t umfFileMemoryProviderParamsDestroy(
3640
umf_file_memory_provider_params_handle_t hParams) {
3741
(void)hParams;
42+
LOG_ERR("File memory provider is disabled!");
3843
return UMF_RESULT_ERROR_NOT_SUPPORTED;
3944
}
4045

4146
umf_result_t umfFileMemoryProviderParamsSetPath(
4247
umf_file_memory_provider_params_handle_t hParams, const char *path) {
4348
(void)hParams;
4449
(void)path;
50+
LOG_ERR("File memory provider is disabled!");
4551
return UMF_RESULT_ERROR_NOT_SUPPORTED;
4652
}
4753

4854
umf_result_t umfFileMemoryProviderParamsSetProtection(
4955
umf_file_memory_provider_params_handle_t hParams, unsigned protection) {
5056
(void)hParams;
5157
(void)protection;
58+
LOG_ERR("File memory provider is disabled!");
5259
return UMF_RESULT_ERROR_NOT_SUPPORTED;
5360
}
5461

@@ -57,6 +64,7 @@ umf_result_t umfFileMemoryProviderParamsSetVisibility(
5764
umf_memory_visibility_t visibility) {
5865
(void)hParams;
5966
(void)visibility;
67+
LOG_ERR("File memory provider is disabled!");
6068
return UMF_RESULT_ERROR_NOT_SUPPORTED;
6169
}
6270

src/provider/provider_level_zero.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,23 @@
1414
#include <umf/memory_provider_ops.h>
1515
#include <umf/providers/provider_level_zero.h>
1616

17+
#include "utils_log.h"
18+
1719
#if defined(UMF_NO_LEVEL_ZERO_PROVIDER)
1820

1921
umf_result_t umfLevelZeroMemoryProviderParamsCreate(
2022
umf_level_zero_memory_provider_params_handle_t *hParams) {
2123
(void)hParams;
24+
LOG_ERR("L0 memory provider is disabled! (UMF_BUILD_LEVEL_ZERO_PROVIDER is "
25+
"OFF)");
2226
return UMF_RESULT_ERROR_NOT_SUPPORTED;
2327
}
2428

2529
umf_result_t umfLevelZeroMemoryProviderParamsDestroy(
2630
umf_level_zero_memory_provider_params_handle_t hParams) {
2731
(void)hParams;
32+
LOG_ERR("L0 memory provider is disabled! (UMF_BUILD_LEVEL_ZERO_PROVIDER is "
33+
"OFF)");
2834
return UMF_RESULT_ERROR_NOT_SUPPORTED;
2935
}
3036

@@ -33,6 +39,8 @@ umf_result_t umfLevelZeroMemoryProviderParamsSetContext(
3339
ze_context_handle_t hContext) {
3440
(void)hParams;
3541
(void)hContext;
42+
LOG_ERR("L0 memory provider is disabled! (UMF_BUILD_LEVEL_ZERO_PROVIDER is "
43+
"OFF)");
3644
return UMF_RESULT_ERROR_NOT_SUPPORTED;
3745
}
3846

@@ -41,6 +49,8 @@ umf_result_t umfLevelZeroMemoryProviderParamsSetDevice(
4149
ze_device_handle_t hDevice) {
4250
(void)hParams;
4351
(void)hDevice;
52+
LOG_ERR("L0 memory provider is disabled! (UMF_BUILD_LEVEL_ZERO_PROVIDER is "
53+
"OFF)");
4454
return UMF_RESULT_ERROR_NOT_SUPPORTED;
4555
}
4656

@@ -49,6 +59,8 @@ umf_result_t umfLevelZeroMemoryProviderParamsSetMemoryType(
4959
umf_usm_memory_type_t memoryType) {
5060
(void)hParams;
5161
(void)memoryType;
62+
LOG_ERR("L0 memory provider is disabled! (UMF_BUILD_LEVEL_ZERO_PROVIDER is "
63+
"OFF)");
5264
return UMF_RESULT_ERROR_NOT_SUPPORTED;
5365
}
5466

@@ -58,11 +70,15 @@ umf_result_t umfLevelZeroMemoryProviderParamsSetResidentDevices(
5870
(void)hParams;
5971
(void)hDevices;
6072
(void)deviceCount;
73+
LOG_ERR("L0 memory provider is disabled! (UMF_BUILD_LEVEL_ZERO_PROVIDER is "
74+
"OFF)");
6175
return UMF_RESULT_ERROR_NOT_SUPPORTED;
6276
}
6377

6478
umf_memory_provider_ops_t *umfLevelZeroMemoryProviderOps(void) {
6579
// not supported
80+
LOG_ERR("L0 memory provider is disabled! (UMF_BUILD_LEVEL_ZERO_PROVIDER is "
81+
"OFF)");
6682
return NULL;
6783
}
6884

0 commit comments

Comments
 (0)