Skip to content

Commit

Permalink
coll tuned add version identifier to the rules file
Browse files Browse the repository at this point in the history
the version identifier is optional but when provided it  must have the
following format and must appear on the first line.`rule-file-version-N`
where N is an unsigned integer. Older versions of the
parser will fall back to fixed decision mechanism when this line is
present. Version 1 is the original format, Version 2 has support for
optional coll_tuned_alltoall_algorithm_max_requests specification.

Signed-off-by: Burlen Loring <[email protected]>
  • Loading branch information
Burlen Loring committed Nov 7, 2024
1 parent 33f8c74 commit f6387a4
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions ompi/mca/coll/tuned/coll_tuned_dynamic_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ int ompi_coll_tuned_read_rules_config_file (char *fname, ompi_coll_alg_rule_t**
SEGSIZE = 0, /* algorithm specific tuning parameter */
MAXREQ = 0; /* algorithm specific tuning parameter */
FILE *fptr = (FILE*) NULL;
int x, ncs, nms;
int x, ncs, nms, version;

ompi_coll_alg_rule_t *alg_rules = (ompi_coll_alg_rule_t*) NULL; /* complete table of rules */

Expand Down Expand Up @@ -124,6 +124,11 @@ int ompi_coll_tuned_read_rules_config_file (char *fname, ompi_coll_alg_rule_t**
goto on_file_error;
}

/* consume the optional version identifier */
if (0 == fscanf(fptr, "rule-file-version-%u", &version)) {
version = 1;
}

/* get the number of collectives for which rules are provided in the file */
if( (getnext(fptr, &NCOL) < 0) || (NCOL < 0) ) {
OPAL_OUTPUT((ompi_coll_tuned_stream,"Could not read number of collectives in configuration file around line %d\n", fileline));
Expand Down Expand Up @@ -232,7 +237,7 @@ int ompi_coll_tuned_read_rules_config_file (char *fname, ompi_coll_alg_rule_t**

/* read the max requests tuning parameter. optional */
msg_p->result_max_requests = ompi_coll_tuned_alltoall_max_requests;
if( isnext_digit(fptr) ) {
if( (version > 1) && isnext_digit(fptr) ) {
if( (getnext (fptr, &MAXREQ) < 0) || (MAXREQ < 0) ) {
OPAL_OUTPUT((ompi_coll_tuned_stream,"Could not read max requests for collective ID %ld com rule %d msg rule %d at around line %d\n", COLID, ncs, nms, fileline));
goto on_file_error;
Expand Down Expand Up @@ -267,6 +272,7 @@ int ompi_coll_tuned_read_rules_config_file (char *fname, ompi_coll_alg_rule_t**
fclose (fptr);

OPAL_OUTPUT((ompi_coll_tuned_stream,"\nConfigure file Stats\n"));
OPAL_OUTPUT((ompi_coll_tuned_stream,"Version\t\t\t\t\t: %5u\n", version));
OPAL_OUTPUT((ompi_coll_tuned_stream,"Collectives with rules\t\t\t: %5d\n", total_alg_count));
OPAL_OUTPUT((ompi_coll_tuned_stream,"Communicator sizes with rules\t\t: %5d\n", total_com_count));
OPAL_OUTPUT((ompi_coll_tuned_stream,"Message sizes with rules\t\t: %5d\n", total_msg_count));
Expand Down

0 comments on commit f6387a4

Please sign in to comment.