llnl / llnl/scr

SCR_Config contains pair of scr_param_init / scr_param_finalize

Open
#268 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
108
Forks
37
PR merge metrics
No merged PRs in 30d

Description

This pair causes the various parameter hashes and data structures to be created and torn down for each call to SCR_Config. Worse, it also triggers the file .scr/app.conf to be read / written for each SCR_Config call.

Eg in ed7b53214123615a07cb4e961957977b46fad0fe with an extra printf

diff --git a/src/scr_param.c b/src/scr_param.c
index e8e637d..e546c86 100644
--- a/src/scr_param.c
+++ b/src/scr_param.c
@@ -493,6 +493,7 @@ int scr_param_finalize()
     /* store parameters set by app code for use by post-run scripts */
     char* app_file = app_config_path();
     if (app_file != NULL) {
+      printf("writing app config file\n");
       scr_config_write(app_file, scr_app_hash);
     }
     scr_free(&app_file);

executing test_config gives:

./test_config
writing app config file
writing app config file
writing app config file
writing app config file
writing app config file
writing app config file
writing app config file
writing app config file
writing app config file
writing app config file
writing app config file
writing app config file
writing app config file
writing app config file
writing app config file
writing app config file
writing app config file
writing app config file
writing app config file
writing app config file
writing app config file
writing app config file
writing app config file
writing app config file
writing app config file
writing app config file
writing app config file
writing app config file
writing app config file
writing app config file
writing app config file
writing app config file
writing app config file
writing app config file
writing app config file
writing app config file
writing app config file

ie 37 file creations. Files are created / read only on rank 0 but still this is not good behaviour.

This seems to have been introduced in 561b4ea5035ef874197b4a25ae5385152320cb43 part of https://github.com/LLNL/scr/pull/216 , which also seems to remove the possibility for SCR_Config to return a failure to set a parameter (since it always returns NULL when setting values).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read SCR_Config and the scr_param_init/scr_param_finalize flow in src/scr_param.c, then run test_config to observe the repeated app.conf operations. Trace how parameter-setting failures are returned and determine the expected lifetime of the parameter hashes and data structures. Done means SCR_Config no longer recreates those structures or repeatedly reads/writes .scr/app.conf, while preserving failure reporting.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
api
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.