Skip to content

legate.py steals command-line arguments from target applications #2

@piyueh

Description

@piyueh

Problem

Lunching jacobi.py using legate with the flag --num does not change the size of the matrix A in the Jacobi example.

Steps to reproduce

  1. Install both legate.core and legate.numpy
  2. Go to the example folder of legate.numpy
  3. Run the jacobi.py code with legate with legate --cpus 1 --omps 1 --ompthreads 1 ./jacobi.py --num 1234

Expected and actual results

The log message should say "Generating 1234x1234 system...", However, the actual message says "Generating 100x100 system..."

Diagnosis

When running the example code of the Jacobi solver, the jacobi.py allows a command-line argument called --num. However, if launching jacobi.py using legate, legate steals the value of --num, saves it to numamem, and never actually passes it to jacobi.py.

This is because, by default, an ArgumentParser allows implicit abbreviations for long arguments. When executing legate <some flags> ./jacobi.py --num 1234, the argument parser of legate.py (line 549-807 here) sees --num as a abbreviation of the flag --numamem.

Solution

A quick solution is to disable the implicit abbreviation by changing line 549 in legate.py from

parser = argparse.ArgumentParser(description="Legate Driver.")

to

parser = argparse.ArgumentParser(description="Legate Driver.", allow_abbrev=False)

But I believe eventually there should be a better solution to separate the arguments of legate.py from a target application. Otherwise, if a target application has some overlapped arguments with legate.py (i.e., the same argument names), this conflict can not be resolved by simply disabling allow_abbrev.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions