Skip to content

Commit

Permalink
Set up custom command in ir.py
Browse files Browse the repository at this point in the history
  • Loading branch information
kelseyshan101 committed Sep 4, 2024
1 parent 57747d3 commit 24b198f
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 3 deletions.
29 changes: 26 additions & 3 deletions compiler/ir.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -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."
Expand Down
15 changes: 15 additions & 0 deletions evaluation/intro/newfunctiontest.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 24b198f

Please sign in to comment.