Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: --assert_all_regions_parallelizable flag that has the same func… #722

Open
wants to merge 2 commits into
base: future
Choose a base branch
from

Conversation

YUUU23
Copy link

@YUUU23 YUUU23 commented Jun 16, 2024

To introduce the --assert_all_regions_parallelizable flag (should exit with error when both UnparallelizableError and general exception are caught) and changing the original --assert_compiler_success flag to exiting with error only when general exceptions are caught (does not exit with error when UnparallelizableError are caught), the following were added:

  • compiler/orchestrator_runtime/pash_init_setup.sh, compiler/cli.py : set-up and add information regarding --assert_all_regions_parallelizable flag for pash to recognize

  • compiler/custom_error.py: introduce NotAllRegionParallelizableError to be raised when UnparallelizableError are caught in the compile.ir function in pash/compiler/pash_compiler.py ;

    • the NotAllRegionParallelizableError will be caught in compiler/pash_compilation_server.py when the compile.ir function is called; if this error is caught, the new variable all_region_parallelizable in compiler/pash_compilation_server.py will be marked false
    • to differentiate all regions not parallelizable from general error, a error_response with a different error message is saved in the compiler server
    • don't increase the running procs if assert_compiler_success flag is on and compile_success is false but all_region_parallelizable is true (some general exceptions caught) ; or assert_all_regions_parallelizable flag on and compile_success is false because of both general exceptions or unparallelizable region
  • compiler/orchestrator_runtime/pash_prepare_call_compiler.sh: marks variable pash_all_region_parallelizable if error_response contains message regarding regions not being parallelizable. We should exit on error when,

    • assert_all_regions_parallelizable flag on and runtime_return_code != 0 : general exception
    • assert_all_regions_parallelizable flag on and pash_all_region_parallelizable != 0 : some region is not parallelizable
    • assert_compiler_success_flag flag on and runtime_return_code != 0 and pash_all_region_parallelizable == 0 : general exception (and not error because some regions were not parallelizable)
  • evaluation/tests/test_evaluation_scripts.sh : when executing tests, change --assert_compiler_success to --assert_all_regions_parallelizable, since what assert_compiler_success originally does is now carried out by --assert_all_regions_parallelizable

Tested the above for expected behavior by running some intro scripts in the directory, and it does seem like we are exiting with error for --assert_compiler_success only when general exceptions are caught and not the unparallelizable ones. We are also exiting on error for both reasons when --assert_all_regions_parallelizable flag is on. When both flags are used at the same time, we follow the behavior of --assert_all_regions_parallelizable. PaSh testing scripts locally also seems to pass all tests.

@YUUU23 YUUU23 force-pushed the assert-all-parallelizable-region-flag branch from cd4c265 to 349efe6 Compare June 16, 2024 20:57
@YUUU23 YUUU23 marked this pull request as ready for review June 16, 2024 21:00
Copy link

OS:ubuntu-20.04
Sun Jun 16 21:02:20 UTC 2024
intro: 2/2 tests passed.
interface: 41/41 tests passed.
compiler: 54/54 tests passed.

Copy link

OS =
CPU =
Ram =
Hash = 349efe6
Kernel=
||
|-|-|-|-|-|-|-|-|-|

@YUUU23 YUUU23 linked an issue Jun 16, 2024 that may be closed by this pull request
@YUUU23 YUUU23 requested a review from angelhof June 16, 2024 21:09
@yizhengx
Copy link

LGTM :-)

Copy link
Member

@angelhof angelhof left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, if you can do the small changes that I suggest we can merge :)

compiler/cli.py Outdated
)
self.add_argument(
"--assert_all_regions_parallelizable",
help="assert that the compiler succeeded with all regions being parallelizable and no general error occuring (used to make tests more robust)",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can add a comment that this is strictly stricter than --assert_compiler_success

if compile_success:
response = server_util.success_response(
f"{process_id} {compiled_script_file} {var_file} {input_ir_file}"
)
elif not all_region_parallelizable:
# send specified message to say not all regions are parallelizable instead of general exception caught
response = server_util.error_response(f"{process_id} not all regions are parallelizable; failed to compile")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The response can be more specific, and slightly reworded. At this point we know precisely which region is not parallelizable, and we can respond with that (instead of a more generic "not all regions"). Also, the all_region_parallelizable flag could be renamed to current_region_parallelizable or parallelizability_success since it refers to a specific region and not all regions.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would it be okay to response with "current region" along with the process_id? I'm not entirely sure how to refer to a region
Thank you for the reviews!

Copy link

OS =
CPU =
Ram =
Hash = 9e67a36
Kernel=
||
|-|-|-|-|-|-|-|-|-|

Copy link

OS:ubuntu-20.04
Fri Jul 12 20:03:49 UTC 2024
intro: 2/2 tests passed.
interface: 41/41 tests passed.
compiler: 54/54 tests passed.

…tion as old assert_compiler_success flag; new assert_compiler_success flag now will not exit with error when regions are unparallelizable and exit with error when general exceptions are caught

Signed-off-by: YUUU23 <[email protected]>
@YUUU23 YUUU23 force-pushed the assert-all-parallelizable-region-flag branch from 9e67a36 to 536bd8e Compare July 12, 2024 20:04
Copy link

OS =
CPU =
Ram =
Hash = 536bd8e
Kernel=
||
|-|-|-|-|-|-|-|-|-|

Copy link

OS:ubuntu-20.04
Fri Jul 12 20:06:57 UTC 2024
intro: 2/2 tests passed.
interface: 41/41 tests passed.
compiler: 54/54 tests passed.

@YUUU23 YUUU23 requested a review from angelhof July 12, 2024 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improving exception handling for debugging
3 participants