Skip to content

Commit

Permalink
Rearranged data transfer slides
Browse files Browse the repository at this point in the history
  • Loading branch information
CFrauen authored Aug 30, 2024
1 parent d009423 commit 77c15fd
Showing 1 changed file with 33 additions and 35 deletions.
68 changes: 33 additions & 35 deletions B3/L9/docs/gpu_lecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -375,31 +375,6 @@ Accelerator Kernel Timing data
```
</div>



# Data clauses

| <span style="font-size:75%;"> Clause </span> | <span style="font-size:75%;"> Behavior </span> |
| --- | ------ |
| <span style="font-size:75%;"> COPYIN </span> | <span style="font-size:75%;"> Check if variables are already present on device; if not create space and copy data to device </span> |
| <span style="font-size:75%;"> COPYOUT </span> | <span style="font-size:75%;"> Check if variables are already present on device; if not create space and copy resulting data from device </span> |
| <span style="font-size:75%;"> COPY </span> | <span style="font-size:75%;"> Behaves like both COPYIN and COPYOUT </span> |
| <span style="font-size:75%;"> CREATE </span> | <span style="font-size:75%;"> Check if variables are already present on device; if not create empty space </span> |
| <span style="font-size:75%;"> PRESENT </span> | <span style="font-size:75%;"> Assume that variables are already present on device </span> |

<span style="font-size:75%;"> Remark: Scalars are first private by default, they rarely appear in a data clause </span>

# Update clauses

Within data regions host and device memory can be updated with the <span style="color: green;"> `UPDATE` </span> clause

<br>

| <span style="font-size:75%;"> Clause </span> | <span style="font-size:75%;"> Behavior </span> |
| --- | ------ |
| <span style="font-size:75%;"> UPDATE DEVICE </span> | <span style="font-size:75%;"> Copy data from host to device </span> |
| <span style="font-size:75%;"> UPDATE SELF </span> <br> <span style="font-size:75%;"> UPDATE HOST </span> | <span style="font-size:75%;"> Copy data from device to host </span> |

# Optimization: Device data management

<div class=column style=width:32%>
Expand Down Expand Up @@ -444,16 +419,6 @@ END PROGRAM

# Optimization: Device data management

* Syntax:
<br>
<span style="color: green;">`!$ACC DATA [data_clause]`</span>
<br>
<span style="color: green;">`!$ACC END DATA`</span>

* data_clause: e.g. <span style="color: green;"> `CREATE` </span>, <span style="color: green;"> `COPYIN` </span>

# Optimization: Device data management

<div class=column style=width:48%>
```
> NVCOMPILER_ACC_TIME=1 ./p1A
Expand Down Expand Up @@ -505,6 +470,39 @@ Accelerator Kernel Timing data
device time(us): total=28 max=28 min=28 avg=28
```

# Optimization: Device data management

* Syntax:
<br>
<span style="color: green;">`!$ACC DATA [data_clause]`</span>
<br>
<span style="color: green;">`!$ACC END DATA`</span>

* data_clause: e.g. <span style="color: green;"> `CREATE` </span>, <span style="color: green;"> `COPYIN` </span>

# Data clauses

| <span style="font-size:75%;"> Clause </span> | <span style="font-size:75%;"> Behavior </span> |
| --- | ------ |
| <span style="font-size:75%;"> COPYIN </span> | <span style="font-size:75%;"> Check if variables are already present on device; if not create space and copy data to device </span> |
| <span style="font-size:75%;"> COPYOUT </span> | <span style="font-size:75%;"> Check if variables are already present on device; if not create space and copy resulting data from device </span> |
| <span style="font-size:75%;"> COPY </span> | <span style="font-size:75%;"> Behaves like both COPYIN and COPYOUT </span> |
| <span style="font-size:75%;"> CREATE </span> | <span style="font-size:75%;"> Check if variables are already present on device; if not create empty space </span> |
| <span style="font-size:75%;"> PRESENT </span> | <span style="font-size:75%;"> Assume that variables are already present on device </span> |

<span style="font-size:75%;"> Remark: Scalars are first private by default, they rarely appear in a data clause </span>

# Update clauses

Within data regions host and device memory can be updated with the <span style="color: green;"> `UPDATE` </span> clause

<br>

| <span style="font-size:75%;"> Clause </span> | <span style="font-size:75%;"> Behavior </span> |
| --- | ------ |
| <span style="font-size:75%;"> UPDATE DEVICE </span> | <span style="font-size:75%;"> Copy data from host to device </span> |
| <span style="font-size:75%;"> UPDATE SELF </span> <br> <span style="font-size:75%;"> UPDATE HOST </span> | <span style="font-size:75%;"> Copy data from device to host </span> |

# Explicit data transfer

<div class=column style=width:30%>
Expand Down

0 comments on commit 77c15fd

Please sign in to comment.