From 24b198ff784a5317d42132a50261e977b499cbfb Mon Sep 17 00:00:00 2001 From: Kelsey Shan Date: Wed, 4 Sep 2024 13:36:29 -0700 Subject: [PATCH] Set up custom command in ir.py --- compiler/ir.py | 29 ++++++++++++++++++++++++++--- evaluation/intro/newfunctiontest.sh | 15 +++++++++++++++ 2 files changed, 41 insertions(+), 3 deletions(-) create mode 100644 evaluation/intro/newfunctiontest.sh diff --git a/compiler/ir.py b/compiler/ir.py index b7319cc23..8b219facc 100644 --- a/compiler/ir.py +++ b/compiler/ir.py @@ -19,6 +19,9 @@ from pash_annotations.datatypes.CommandInvocationWithIOVars import ( CommandInvocationWithIOVars, ) +from pash_annotations.annotation_generation.annotation_generators.InputOutputInfoGeneratorCustom import InputOutputInfoGeneratorCustom +from pash_annotations.annotation_generation.annotation_generators.ParallelizabilityInfoGeneratorCustom import ParallelizabilityInfoGeneratorCustom + from annotations_utils.util_parsing import parse_arg_list_to_command_invocation from annotations_utils.util_cmd_invocations import ( @@ -243,9 +246,29 @@ def compile_command_to_DFG(fileIdGen, command, options, redirections=None): command_invocation ) if io_info is None: - raise UnparallelizableError( - f"InputOutputInformation for {format_arg_chars(command)} not provided so considered side-effectful." - ) + #get input,output,parallelizability info of the command + #print(f"InputOutputInformation for {format_arg_chars(command)} not provided") + #input_info = input(f"Enter input:") + #output_info = input(f"Enter output:") + + # info to provide: parallelizer_list, round_robin_comp_with_cat, is_commutative (for optimisations) + #print(f"ParallelizabilityInformation for {format_arg_chars(command)} not provided") + #parallelizability_info_parallelizer_list = input(f"Enter parallelizer list info:") + #parallelizability_info_round_robin_comp_with_cat = input(f"Enter round robin info:") + #parallelizability_info_is_commutative = input(f"Enter commutative info [Y/N]:") + + #generate_info + custom_generator_io = InputOutputInfoGeneratorCustom(command) + custom_generator_io.generate_info() + + custom_generator_parallelizability = ParallelizabilityInfoGeneratorCustom(command) + custom_generator_parallelizability.generate_info() + + print("Inline Custom Command Attempt") + # + #raise UnparallelizableError( + # f"InputOutputInformation for {format_arg_chars(command)} not provided so considered side-effectful." + #) if io_info.has_other_outputs(): raise UnparallelizableError( f"Command {format_arg_chars(command)} has outputs other than streaming." diff --git a/evaluation/intro/newfunctiontest.sh b/evaluation/intro/newfunctiontest.sh new file mode 100644 index 000000000..d0b6fbfb0 --- /dev/null +++ b/evaluation/intro/newfunctiontest.sh @@ -0,0 +1,15 @@ +cd "$(dirname $0)" + +[ -z $PASH_TOP ] && { + echo "PASH_TOP not set, maybe $(git rev-parse --show-toplevel)?" + exit +} +FILE="input/100M.txt" + +#test function to make a custom command for +our_func() { + grep "$1" +} + + +cat "$FILE" | our_func choleric \ No newline at end of file