Running and debugging with PyTorch RBLN¶
Overview¶
In this tutorial, we demonstrate how to run and debug with PyTorch RBLN.
Setup & Installation¶
- System Requirements:
- Python: 3.9-3.12
- RBLN Driver
- Major Package Requirements:
- Installation Command:
Note
Please note that torch-rbln
requires an RBLN Portal account.
Running a simple example (torch.add
)¶
The following add.py
is an example of verifying fp16 tensor ops on the Rebellions NPU. As you can see, the below example uses the same code as GPU or CPU except using rbln
instead of cuda
or cpu
.
add.py | |
---|---|
If you run the above script, we expect the following:
As we can see, fp16 element-wise torch.add
on rbln
matches the expected value.
Using PDB in PyTorch RBLN for further debugging¶
The following shows how to confirm the result tensor and indexed values in PDB.
In the above example, we can see that both the full tensor and indexed tensor match expectations.