Skip to content

Commit 8307c35

Browse files
manjugvawlauria
authored andcommitted
Changes to env var name and behavior to reflect the OpenSHMEM spec
Signed-off-by: Manjunath Gorentla Venkata <manjunath@nvidia.com> (cherry picked from commit 68c8951)
1 parent 62f2e6f commit 8307c35

File tree

3 files changed

+25
-21
lines changed

3 files changed

+25
-21
lines changed

oshmem/include/shmem.h.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ enum {
8484
/* size of symmetric heap in bytes.
8585
* Can be qualified with the letter 'K', 'M', 'G' or 'T'
8686
*/
87-
#define SHMEM_HEAP_SIZE "SHMEM_SYMMETRIC_HEAP_SIZE"
87+
#define SHMEM_HEAP_SIZE "SHMEM_SYMMETRIC_SIZE"
8888

8989
/*
9090
* Type of allocator used by symmetric heap

oshmem/info/info.c

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/*
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.
77
* $COPYRIGHT$
88
*
99
* Additional copyrights may follow
@@ -47,7 +47,7 @@ oshmem_info_t oshmem_shmem_info_env = {
4747
*/
4848
static int oshmem_info_value_to_bool(char *value, bool *interp);
4949
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);
5151
static int oshmem_info_get_library_version(char *version, int *len);
5252

5353

@@ -105,19 +105,19 @@ int oshmem_info_init(void)
105105
}
106106

107107
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.");
114112
}
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);
116115
if (OSHMEM_SUCCESS != ret) {
117116
goto out;
118117
}
119118
} 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);
121121
if (OSHMEM_SUCCESS != ret) {
122122
goto out;
123123
}
@@ -217,7 +217,7 @@ static int oshmem_info_value_to_int(char *value, int *interp)
217217
return OSHMEM_SUCCESS;
218218
}
219219

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)
221221
{
222222
char *p;
223223
long long factor = 1;
@@ -259,8 +259,7 @@ static int oshmem_info_get_heap_size(char *value, size_t *interp)
259259
if (size <= 0) {
260260
return OSHMEM_ERR_BAD_PARAM;
261261
} 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);
264263
/* Probably needless code */
265264
#if 0
266265
char *tmp = p;

oshmem/shmem/shmem_api_logger.h

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
2-
* Copyright (c) 2013 Mellanox Technologies, Inc.
3-
* All rights reserved.
4-
* Copyright (c) 2015 Cisco Systems, Inc. All rights reserved.
2+
* Copyright (c) 2013-2020 Mellanox Technologies, Inc.
3+
* All rights reserved.
4+
* Copyright (c) 2015 Cisco Systems, Inc. All rights reserved.
55
* $COPYRIGHT$
66
*
77
* Additional copyrights may follow
@@ -39,4 +39,9 @@ OSHMEM_DECLSPEC extern int shmem_api_logger_output;
3939
oshmem_output(shmem_api_logger_output, \
4040
"Error: %s:%d - %s()", __SPML_FILE__, __LINE__, __func__, __VA_ARGS__)
4141

42+
#define SHMEM_API_WARNING(...) \
43+
oshmem_output(shmem_api_logger_output, \
44+
"Warning: %s:%d - %s()", __SPML_FILE__, __LINE__, __func__, __VA_ARGS__)
45+
46+
4247
#endif /*SHMEM_API_LOGGER_H*/

0 commit comments

Comments
 (0)