Exemplo n.º 1
0
def run_ipu_estimator_cnn(**kwargs):
    """Helper function to run ipu_estimator_cnn tensorflow python script with
       command line arguments"""
    out = run_python_script_helper(
        os.path.dirname(__file__), "ipu_estimator_cnn.py", **kwargs
    )
    return out
Exemplo n.º 2
0
def run_popart_mnist_complete(**kwargs):
    """Helper function to run popart mnist linear model python script with
       command line arguments"""
    out = run_python_script_helper(os.path.dirname(__file__), "../complete/popart_mnist.py",
                                   env=os.environ.update({"PVTI_OPTIONS": '{"enable":"true"}'}),
                                   **kwargs)
    return out
Exemplo n.º 3
0
def run_connection_type(connection_type):
    """Helper to run connect_type.py with specific connection type,
       capture the output, and parse the result."""
    kwargs = {"--connection_type": connection_type}
    out = run_python_script_helper(os.path.dirname(__file__),
                                   "connection_type.py",
                                   want_std_err=True,
                                   **kwargs)
    result = parse_output(out)
    print("result {}".format(result))
    return result
Exemplo n.º 4
0
 def test_tf_code(self):
     """Run the python script and check the result"""
     # Run the script and capture the output
     out = run_python_script_helper(self.path, "tf_code.py")
     # Get the first and the second line of output
     ipu_res, target_res = out.split("\n")[:-1]
     # Convert these lines to arrays, in turn
     list_regex = r"\[.*\]$"
     match = re.search(list_regex, ipu_res)
     string_vals = match.group()[1:-1].split()
     ipu_arr = np.array([float(val) for val in string_vals],
                        dtype=np.float32)
     match = re.search(list_regex, target_res)
     string_vals = match.group()[1:-1].split()
     target_arr = np.array([float(val) for val in string_vals],
                           dtype=np.float32)
     # Finally, check that the results are reasonably close
     assert np.allclose(ipu_arr,
                        target_arr), ("Output value {} does not "
                                      "equal expected value {}".format(
                                          ipu_arr, target_arr))
     # Clean up
     subprocess.run(["make", "clean"], cwd=self.path)
def run_pytorch_mnist(**kwargs):
    return run_python_script_helper(os.path.dirname(__file__),
                                    "pytorch_popart_mnist.py", **kwargs)
def run_simple_replication(**kwargs):
    """Helper function to run replication tensorflow python script with
       command line arguments"""
    out = run_python_script_helper(os.path.dirname(__file__),
                                   "simple_replication.py", **kwargs)
    return out
Exemplo n.º 7
0
def run_mnist_training(**kwargs):
    """Helper function to run popart block-sparse mnist linear model python script with
       command line arguments"""
    out = run_python_script_helper(os.path.dirname(__file__), "bs_mnist.py",
                                   **kwargs)
    return out
Exemplo n.º 8
0
def run_popart_mnist_training(**kwargs):
    out = test_util.run_python_script_helper(os.path.dirname(__file__),
                                             "popart_mnist_conv.py", **kwargs)
    return out
def run_phased_execution(**kwargs):
    """Helper function to run phased execution python script with
       command line arguments"""
    out = run_python_script_helper(os.path.dirname(__file__),
                                   "phased_execution.py", **kwargs)
    return out
Exemplo n.º 10
0
def run_sparse_attention(**kwargs):
    """Helper function to run popart sparse attention model python script with
       command line arguments"""
    out = run_python_script_helper(os.path.dirname(__file__), "short_demo.py",
                                   **kwargs)
    return out
Exemplo n.º 11
0
def run_sparse_softmax_subblock(**kwargs):
    """Helper function to run popart sparse softmax with subblock model python script with
       command line arguments"""
    out = run_python_script_helper(os.path.dirname(__file__),
                                   "sparse_softmax_subblock_demo.py", **kwargs)
    return out
Exemplo n.º 12
0
def run_report_generation(**kwargs):
    """Helper function to run report generation python script"""
    out = run_python_script_helper(os.path.dirname(__file__),
                                   "report_generation_example.py", **kwargs)
    return out