|
| 1 | +from cutgeneratingfunctionorgy.igp import * |
| 2 | +import os |
| 3 | +import time |
| 4 | +import tomllib |
| 5 | + |
| 6 | +""" |
| 7 | +Estimates for distrbuted computations from previous breakpoints computations. |
| 8 | +""" |
| 9 | +def validate_breakpoint_paths(): |
| 10 | + """ |
| 11 | + Read and validate existance of paths. |
| 12 | + |
| 13 | + Returns: dictonary of paths. |
| 14 | + """ |
| 15 | + paths = {} |
| 16 | + return paths |
| 17 | + |
| 18 | +def read_breakpoint_params(paths): |
| 19 | + """ |
| 20 | + Read current cache computaiton parameters. |
| 21 | + |
| 22 | + Input: paths - dictionary of current path information |
| 23 | + Ouput: params - dictonary of read parameters. |
| 24 | + """ |
| 25 | + return params |
| 26 | + |
| 27 | +def write_breakpoint_metadata(paths, params): |
| 28 | + """ |
| 29 | + Write metadata for breakpoint cache as a toml file. |
| 30 | +
|
| 31 | + Metadata is max length of each file, number of files, number of breakpoints. |
| 32 | + """ |
| 33 | + pass |
| 34 | + |
| 35 | +def read_breakpoint_metadata(path_to_metadata): |
| 36 | + """ |
| 37 | + Output: dictionary of metadata information; using |
| 38 | + """ |
| 39 | + breakpoint_metadata = {} |
| 40 | + return breakpoint_metadata |
| 41 | + |
| 42 | +def write_inital_block_generation_job_script(paths, params, previous_breakpoint_metadata): |
| 43 | + """ |
| 44 | + Write a bash script to distach cluster jobs to distrubte generation of the next breakpoints. |
| 45 | + From the previous breakpoint files are treaded as "blocks" and are assigned to a row/column in square like |
| 46 | + "block" grid. The job script works on generation of and joinining of row of the underlying grid. |
| 47 | + Rows are made of indepenet blocks so this generation based on the row blocks can be distrubted. |
| 48 | + |
| 49 | + This writes to the temp folder. Results are targeted TEMP/NUM_BKPT |
| 50 | + """ |
| 51 | + block_row_length = int(round(math.sqrt(previous_breakpoint_metadata["number_of_files"]))) |
| 52 | + |
| 53 | + |
| 54 | +def write_row_block_collection_job_script(paths, params, previous_breakpoint_metadata, block_row_length): |
| 55 | + """ |
| 56 | + Write a bash script to dispatch cluster jobs which works on joining block rows. |
| 57 | +
|
| 58 | + To ensure uniqueness every row is checked against every other. |
| 59 | +
|
| 60 | + Jobs are assigned based on triangular numbers. We have (number_of_block_rows-1)number_of_block_rows/2 to check to ensure uniqueness. |
| 61 | + At most 2*number_of_bloc_rows batchs with number_of_block_rows/2 jobs are required. |
| 62 | + With this we want to ensure a block_row can only be read/write in one job per batch (to prevent I/O waiting). |
| 63 | +
|
| 64 | +
|
| 65 | + Script is written to temp folder. |
| 66 | + """ |
| 67 | + pass |
| 68 | + |
| 69 | +def create_write_row_files_job_script(paths, params): |
| 70 | + """ |
| 71 | + |
| 72 | + """ |
| 73 | + |
| 74 | + |
0 commit comments