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.
  • Loading branch information
PabloAndresCQ committed Apr 3, 2024
1 parent 25e591d commit a47d1db
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 a47d1db

Please sign in to comment.