|
1 | 1 | /* |
2 | | - * Copyright (c) 2015 Mellanox Technologies, Inc. |
3 | | - * All rights reserved. |
4 | | - * Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved. |
5 | | - * Copyright (c) 2019 Research Organization for Information Science |
6 | | - * and Technology (RIST). All rights reserved. |
| 2 | + * Copyright (c) 2015-2020 Mellanox Technologies, Inc. |
| 3 | + * All rights reserved. |
| 4 | + * Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved. |
| 5 | + * Copyright (c) 2019 Research Organization for Information Science |
| 6 | + * and Technology (RIST). All rights reserved. |
7 | 7 | * $COPYRIGHT$ |
8 | 8 | * |
9 | 9 | * Additional copyrights may follow |
@@ -47,7 +47,7 @@ oshmem_info_t oshmem_shmem_info_env = { |
47 | 47 | */ |
48 | 48 | static int oshmem_info_value_to_bool(char *value, bool *interp); |
49 | 49 | static int oshmem_info_value_to_int(char *value, int *interp); |
50 | | -static int oshmem_info_get_heap_size(char *value, size_t *interp); |
| 50 | +static int oshmem_info_get_heap_size(const char *name, char *value, size_t *interp); |
51 | 51 | static int oshmem_info_get_library_version(char *version, int *len); |
52 | 52 |
|
53 | 53 |
|
@@ -105,19 +105,19 @@ int oshmem_info_init(void) |
105 | 105 | } |
106 | 106 |
|
107 | 107 | if (NULL != (cptr = getenv(OSHMEM_ENV_SYMMETRIC_SIZE))) { |
108 | | - char *p1 = getenv(SHMEM_HEAP_SIZE); |
109 | | - if (p1 && strcmp(cptr, p1)) { |
110 | | - SHMEM_API_ERROR("Found conflict between env '%s' and '%s'.\n", |
111 | | - OSHMEM_ENV_SYMMETRIC_SIZE, SHMEM_HEAP_SIZE); |
112 | | - ret = OSHMEM_ERR_BAD_PARAM; |
113 | | - goto out; |
| 108 | + char *p1; |
| 109 | + if (NULL != (p1 = getenv(SHMEM_HEAP_SIZE))) { |
| 110 | + SHMEM_API_WARNING("SYMMETRIC_HEAP_SIZE and SMA_HEAP_SIZE are both set;" |
| 111 | + "SYMMETRIC_HEAP_SIZE takes precedence."); |
114 | 112 | } |
115 | | - ret = oshmem_info_get_heap_size(cptr, &oshmem_shmem_info_env.symmetric_heap_size); |
| 113 | + ret = oshmem_info_get_heap_size(OSHMEM_ENV_SYMMETRIC_SIZE, cptr, |
| 114 | + &oshmem_shmem_info_env.symmetric_heap_size); |
116 | 115 | if (OSHMEM_SUCCESS != ret) { |
117 | 116 | goto out; |
118 | 117 | } |
119 | 118 | } else if (NULL != (cptr = getenv(SHMEM_HEAP_SIZE))) { |
120 | | - ret = oshmem_info_get_heap_size(cptr, &oshmem_shmem_info_env.symmetric_heap_size); |
| 119 | + ret = oshmem_info_get_heap_size(SHMEM_HEAP_SIZE, cptr, |
| 120 | + &oshmem_shmem_info_env.symmetric_heap_size); |
121 | 121 | if (OSHMEM_SUCCESS != ret) { |
122 | 122 | goto out; |
123 | 123 | } |
@@ -217,7 +217,7 @@ static int oshmem_info_value_to_int(char *value, int *interp) |
217 | 217 | return OSHMEM_SUCCESS; |
218 | 218 | } |
219 | 219 |
|
220 | | -static int oshmem_info_get_heap_size(char *value, size_t *interp) |
| 220 | +static int oshmem_info_get_heap_size(const char *name, char *value, size_t *interp) |
221 | 221 | { |
222 | 222 | char *p; |
223 | 223 | long long factor = 1; |
@@ -259,8 +259,7 @@ static int oshmem_info_get_heap_size(char *value, size_t *interp) |
259 | 259 | if (size <= 0) { |
260 | 260 | return OSHMEM_ERR_BAD_PARAM; |
261 | 261 | } else { |
262 | | - opal_setenv(OSHMEM_ENV_SYMMETRIC_SIZE, p, true, &environ); |
263 | | - opal_setenv(SHMEM_HEAP_SIZE, p, true, &environ); |
| 262 | + opal_setenv(name, p, true, &environ); |
264 | 263 | /* Probably needless code */ |
265 | 264 | #if 0 |
266 | 265 | char *tmp = p; |
|
0 commit comments