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

Simplified install and more infos in README #1

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 23 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,56 +1,48 @@
# ttVecAdd

A simple vector-addition on Tenstorrent devices using tt-Metalium.
A simple vector-addition demo on Tenstorrent devices using tt-Metalium.

## How to use
This demo works on grayskull e150 and e75.


Before building this project. Setup the enviroment variables that Metalium needs
## Setup
Before building this project. Setup the enviroment variables in `setup_env.sh` that Metalium needs, e.g.:

```bash
export ARCH_NAME=grayskull
export TT_METAL_HOME=/path/to/your/root/of/tt-metal/
export TT_METAL_ENV=dev
```

Then build the project
`ln -s $(pwd)/vecadd_kernels $TT_METAL_HOME/ttvecadd_kernels` in `setup_env.sh` will also create a link in the root of TT_METAL_HOME (this is needed at this time because tt-metal looks in its root dir for kernels).

## Build
```bash
cd ttVecAdd
# HACK: Metalium only searches kernels under it's directories
ln -s vecadd_kernels $TT_METAL_HOME/vecadd_kernels

mkdir build
cd build
cmake ..
make
```

To run

```
➜ ./ttvecadd
## Run
```bash
$ ./ttvecadd
Metal | INFO | Initializing device 0
Device | INFO | Opening user mode device driver
2024-03-26 10:24:40.877 | INFO | SiliconDriver - Detected 1 PCI device : [0]
Metal | INFO | AI CLK for device 0 is: 1300 MHz
Metal | INFO | DPRINT enabled on device 0, worker core (x=0,y=0) (physical (x=1,y=1)).
Metal | INFO | DPRINT Server attached device 0
Verif | INFO | Created a random vector of size 512
Verif | INFO | Created a random vector of size 512
2024-04-07 19:02:21.965 | INFO | SiliconDriver - Detected 1 PCI device : {0}
Metal | INFO | AI CLK for device 0 is: 1202 MHz
Verif | INFO | Created a random vector of size 32768
Verif | INFO | Created a random vector of size 32768
Kernel execution finished
Partial results: (note we are running under BFP16. It's going to be less accurate)
17.625 + 8.1875 = 25.875
6.34375 + 17.125 = 23.5
5.0625 + 4.3125 = 9.375
17.375 + 4.53125 = 21.875
3.25 + 10.5625 = 13.8125
17 + 3.25 = 20.25
7.40625 + 6.8125 = 14.25
17.875 + 0.369141 = 18.25
15.75 + 10.75 = 26.5
15.1875 + 15.8125 = 31
2.32812 + 2.26562 = 4.59375
4.25 + 3.46875 = 7.71875
0.0114746 + 7.4375 = 7.4375
4.09375 + 6.9375 = 11.0625
3.89062 + 7.03125 = 10.9375
6.84375 + 6.0625 = 12.9375
0.0195312 + 3.71875 = 3.73438
9.4375 + 7.6875 = 17.125
6.8125 + 4.96875 = 11.8125
4.25 + 5.46875 = 9.75
Metal | INFO | Closing device 0
Metal | INFO | DPRINT Server dettached device 0
Device | INFO | Closing user mode device drivers
```
7 changes: 7 additions & 0 deletions setup_env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export ARCH_NAME=grayskull
export TT_METAL_HOME=~/Desktop/devs/tt-metal/
Copy link
Owner

Choose a reason for hiding this comment

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

I'm not super sure this should be in the repository. Foremost, the path is for your specific setup and not everyone have tt-metal on their dekstop.

I'm more leaning towards removing this file for the sake of generality. What's your thought?

Copy link
Author

@JonathanALevine JonathanALevine Apr 8, 2024

Choose a reason for hiding this comment

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

Great point.

How about keeping the file, but changing the variable TT_METAL_HOME to

TT_METAL_HOME=/path/to/your/root/of/tt-metal/

What do you think?

export TT_METAL_ENV=dev

mkdir build

ln -s $(pwd)/vecadd_kernels $TT_METAL_HOME/ttvecadd_kernels