From be1bd4661c2a2bb970effb3e5345d336e7f88b23 Mon Sep 17 00:00:00 2001 From: Nathan Hjelm Date: Mon, 5 Aug 2013 22:31:50 +0000 Subject: [PATCH] db/pmi: speed up modex by caching pmi data internally This commit was SVN r29001. --- opal/mca/db/pmi/db_pmi.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/opal/mca/db/pmi/db_pmi.c b/opal/mca/db/pmi/db_pmi.c index bd03e843d7..2b9093352a 100644 --- a/opal/mca/db/pmi/db_pmi.c +++ b/opal/mca/db/pmi/db_pmi.c @@ -543,6 +543,15 @@ static int fetch(const opal_identifier_t *uid, stored_type = (opal_data_type_t) strtol (tmp, NULL, 16); size = strtol (tmp2, NULL, 16); + /* cache value locally so we don't have to look it up via pmi again */ + if (OPAL_BYTE_OBJECT == stored_type) { + opal_byte_object_t bo = {.bytes = (unsigned char *) tmp3, .size = size}; + + opal_db.store (uid, OPAL_DB_INTERNAL, tmp_val + offset, &bo, stored_type); + } else { + opal_db.store (uid, OPAL_DB_INTERNAL, tmp_val + offset, tmp3, stored_type); + } + if (0 != strcmp (key, tmp_val + offset)) { offset = (size_t) (tmp3 - tmp_val) + size; continue; @@ -565,7 +574,8 @@ static int fetch(const opal_identifier_t *uid, rc = OPAL_ERR_TYPE_MISMATCH; } - break; + /* keep going and cache everything locally */ + offset = (size_t) (tmp3 - tmp_val) + size; } free (tmp_val);