Skip to content

Commit

Permalink
Update utils.py
Browse files Browse the repository at this point in the history
lazily import tesselate ipu
  • Loading branch information
AlexanderMath authored Oct 30, 2023
1 parent 7b9084c commit 3e1ff75
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pyscf_ipu/nanoDFT/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,10 +240,11 @@ def prepare(val):
print("Numerical error visualisation saved in", gif_path)


from tessellate_ipu import tile_map, ipu_cycle_count, tile_put_sharded
from typing import List


def get_ipu_cycles(data_to_be_sharded: List[float], num_items_to_be_sharded: int = 1) -> List[float]:
from tessellate_ipu import tile_map, ipu_cycle_count, tile_put_sharded
from typing import List
tmp = data_to_be_sharded[0:num_items_to_be_sharded]
tiles = tuple(range(len(tmp)))
tmp = tile_put_sharded(tmp, tiles)
Expand All @@ -252,4 +253,4 @@ def get_ipu_cycles(data_to_be_sharded: List[float], num_items_to_be_sharded: int
for idx in tiles:
data_to_be_sharded = data_to_be_sharded.at[idx].set(tmp[idx])

return data_to_be_sharded, cycles_count
return data_to_be_sharded, cycles_count

0 comments on commit 3e1ff75

Please sign in to comment.