def _build_data(self):
def baseN(nodes, mpn):<EOL><INDENT>return int(math.sqrt(mpn * <NUM_LIT> * nodes * <NUM_LIT> * <NUM_LIT> / <NUM_LIT:8>))<EOL><DEDENT>def nFromNb(baseN, nb):<EOL><INDENT>factor = int(baseN / nb)<EOL>if factor % <NUM_LIT:2> != <NUM_LIT:0>:<EOL><INDENT>factor -= <NUM_LIT:1><EOL><DEDENT>return nb * factor<EOL><DEDENT>def get_grid(nodes, ppn):<EOL><INDENT>cores = nodes * ppn<EOL>sqrt = math.sqrt(cores)<EOL>factors = [<EOL>num for num in range(<NUM_LIT:2>, int(math.floor(sqrt) + <NUM_LIT:1>)) if cores % num == <NUM_LIT:0><EOL>]<EOL>if len(factors) == <NUM_LIT:0>:<EOL><INDENT>factors = [<NUM_LIT:1>]<EOL><DEDENT>diff = <NUM_LIT:0><EOL>keep = <NUM_LIT:0><EOL>for factor in factors:<EOL><INDENT>if diff == <NUM_LIT:0>:<EOL><INDENT>diff = cores - factor<EOL><DEDENT>if keep == <NUM_LIT:0>:<EOL><INDENT>keep = factor<EOL><DEDENT>tmp_diff = cores - factor<EOL>if tmp_diff < diff:<EOL><INDENT>diff = tmp_diff<EOL>keep = factor<EOL><DEDENT><DEDENT>return [keep, int(cores / keep)]<EOL><DEDENT>properties = dict(<EOL>realN=nFromNb(baseN(self.nodes, self.memory_per_node), self.block_size),<EOL>nb=self.block_size,<EOL>pQ=get_grid(self.nodes, self.cores_per_node),<EOL>)<EOL>return self._data_from_jinja(**properties)<EOL>
Build HPL data from basic parameters