From 4bb508035dbaa1f09b8f110e2dcc2a228a250bdb Mon Sep 17 00:00:00 2001 From: Aaron Date: Wed, 14 Jul 2021 09:28:52 -0400 Subject: [PATCH 1/3] Configure.c will now exit_failure if there are issues with accessing the configuration file for workloads int configuration_load (const char *filepath, MPI_Comm comm, ConfigHandle *handle): If any of the file access functions return a nonsuccess status, then a char* variable named error is set describing the status. If the error variable is assigned a value, the system will EXIT_FAILURE. --- src/modelconfig/configuration.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/modelconfig/configuration.c b/src/modelconfig/configuration.c index 831493fc..54712c8a 100644 --- a/src/modelconfig/configuration.c +++ b/src/modelconfig/configuration.c @@ -36,7 +36,8 @@ int configuration_load (const char *filepath, char *error = NULL; int rc = 0; char *tmp_path = NULL; - + int len; + rc = MPI_File_open(comm, (char*)filepath, MPI_MODE_RDONLY, MPI_INFO_NULL, &fh); if (rc != MPI_SUCCESS) goto finalize; @@ -54,10 +55,14 @@ int configuration_load (const char *filepath, #else f = fmemopen(txtdata, txtsize, "rb"); #endif - if (!f) { rc = 1; goto finalize; } + if (!f) { + rc = -1; + error = strdup("Could not access data in \'rb\' mode"); + goto finalize; + } *handle = txtfile_openStream(f, &error); - if (error) { rc = 1; goto finalize; } + if (error) { rc = -1; goto finalize; } /* NOTE: posix version overwrites argument :(. */ tmp_path = strdup(filepath); @@ -72,11 +77,17 @@ int configuration_load (const char *filepath, if (f) fclose(f); free(txtdata); free(tmp_path); + + if (rc != MPI_SUCCESS && !error) { + error = (char*) malloc(MPI_MAX_ERROR_STRING); + MPI_Error_string(rc, error, &len); + } + if (error) { fprintf(stderr, "config error: %s\n", error); free(error); + exit(EXIT_FAILURE); } - return rc; } From ea8ca5045debbc65f97ff7c5d6d63ca5164a99b3 Mon Sep 17 00:00:00 2001 From: Aaron Date: Wed, 4 Aug 2021 10:09:00 -0400 Subject: [PATCH 2/3] Configuration.c: Fixed an error where MPI_Error_string would be called on a non-MPI error integer. --- src/modelconfig/configuration.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/modelconfig/configuration.c b/src/modelconfig/configuration.c index 54712c8a..1b6ecb33 100644 --- a/src/modelconfig/configuration.c +++ b/src/modelconfig/configuration.c @@ -78,8 +78,9 @@ int configuration_load (const char *filepath, free(txtdata); free(tmp_path); - if (rc != MPI_SUCCESS && !error) { + if (rc != MPI_SUCCESS && rc > 0) { error = (char*) malloc(MPI_MAX_ERROR_STRING); + printf("%d\n", rc); MPI_Error_string(rc, error, &len); } From e2b4b50f3bcde8a52c7a5428d80fe494c321fab8 Mon Sep 17 00:00:00 2001 From: Aaron Date: Wed, 18 Aug 2021 11:04:57 -0400 Subject: [PATCH 3/3] Configuration.c: Added Warning for error on configuration_get_lpgroups in congfiguration_load() --- src/modelconfig/configuration.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/modelconfig/configuration.c b/src/modelconfig/configuration.c index 1b6ecb33..e89fadc7 100644 --- a/src/modelconfig/configuration.c +++ b/src/modelconfig/configuration.c @@ -56,7 +56,8 @@ int configuration_load (const char *filepath, f = fmemopen(txtdata, txtsize, "rb"); #endif if (!f) { - rc = -1; + rc = -1; + printf("%d FILE MEM OPEN\n", rc); error = strdup("Could not access data in \'rb\' mode"); goto finalize; } @@ -72,13 +73,18 @@ int configuration_load (const char *filepath, rc = configuration_get_lpgroups(handle, "LPGROUPS", &lpconf); + if(rc == -1){ + printf("WARNING: Configuration file might have an issue with the definition of its LPGROUPS"); + rc = 0; + } + finalize: if (fh != MPI_FILE_NULL) MPI_File_close(&fh); if (f) fclose(f); free(txtdata); free(tmp_path); - if (rc != MPI_SUCCESS && rc > 0) { + if (rc != MPI_SUCCESS && !error) { error = (char*) malloc(MPI_MAX_ERROR_STRING); printf("%d\n", rc); MPI_Error_string(rc, error, &len);