Notes: Variable system currently takes ownership of string values. This is done so strings can be freed when overwritten (by mca_base_var_set_value) or when the variable is deregistered. This requires that initial string values be allocated on the heap (not .DATA, heap, etc). Brian raised a good point that projects/frameworks/components should be responsible for freeing anything they allocate and that it shouldn't be the responsibility of the MCA variable system to free these strings (though we have to handle the mca_base_var_set_value case).
Some options: 1) Always duplicate the string passed in by the caller. The caller will have to free the original value if it was allocated. Ex: tmp = strdup ("some_string_value"); backing_store = tmp; mca_base_var_register (..., MCA_BASE_VAR_TYPE_STRING, ..., &backing_store); free (tmp); 2) Add a flag indicating whether the variable system should call free on the initial value. Ex: backing_store = "some_string_value"; mca_base_var_register (..., MCA_BASE_VAR_TYPE_STRING, ..., MCA_BASE_VAR_FLAG_STATIC, ..., &backing_store); If the STATIC flag is not set the variable system takes ownership of the string and frees it later. If the STATIC flag is set the variable system can either 1) use the initial value, or 2) strdup the initial value. There are issues with using the initial value without duplication since the registree would need to ensure the initial value lives as long as the registered variable (not a problem if the value is in .DATA or .BSS). Thoughts on these options? Other options? List of initial supported types is adequate: char *, int, and bool. We can re-evaluate later if there is a need for more types. We need to figure out how Open MPI could read all file values and build an environment that could be passed to the backend to prevent the need to read from files on the backend. This may necessitate modifying the mca_base_var API. -Nathan
openmpi_mpit.pdf
Description: Adobe PDF document