Skip to content

Commit

Permalink
Changing the order of commands so that GPU device is assigned before …
Browse files Browse the repository at this point in the history
…libhandle creation. (#92)
  • Loading branch information
PabloAndresCQ authored Apr 4, 2024
1 parent aafd61d commit 0b71367
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pytket/extensions/cutensornet/structured_state/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ class CuTensorNetHandle:
"""

def __init__(self, device_id: Optional[int] = None):
self.handle = cutn.create()
self._is_destroyed = False

# Make sure CuPy uses the specified device
Expand All @@ -63,6 +62,8 @@ def __init__(self, device_id: Optional[int] = None):
dev = cp.cuda.Device()
self.device_id = int(dev)

self.handle = cutn.create()

def __enter__(self) -> CuTensorNetHandle:
return self

Expand Down

0 comments on commit 0b71367

Please sign in to comment.