Skip to content

Commit 61eb537

Browse files
EdCauntmloubout
authored andcommitted
compiler: Tweak nbytes_avail_mapper behaviour
1 parent 82704f3 commit 61eb537

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

devito/operator/operator.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1399,12 +1399,16 @@ def _visible_devices(self):
13991399
for v in device_vars:
14001400
try:
14011401
return tuple(int(i) for i in os.environ[v].split(','))
1402-
except (ValueError, KeyError):
1403-
# Environment variable not set or visible devices set via UUIDs
1404-
# or other non-integer identifiers.
1402+
except ValueError:
1403+
# Visible devices set via UUIDs or other non-integer identifiers.
1404+
warning("Setting visible devices via UUIDs or other non-integer"
1405+
" identifiers is currently unsupported: environment variable"
1406+
f" {v}={os.environ[v]} ignored.")
1407+
except KeyError:
1408+
# Environment variable not set
14051409
continue
14061410

1407-
return None
1411+
return {}
14081412

14091413
@cached_property
14101414
def _physical_deviceid(self):
@@ -1413,11 +1417,7 @@ def _physical_deviceid(self):
14131417
rank = self.comm.Get_rank() if self.comm != MPI.COMM_NULL else 0
14141418

14151419
logical_deviceid = max(self.get('deviceid', 0), 0) + rank
1416-
if self._visible_devices is not None:
1417-
return self._visible_devices[logical_deviceid]
1418-
else:
1419-
return logical_deviceid
1420-
1420+
return self._visible_devices.get(logical_deviceid, logical_deviceid)
14211421
else:
14221422
return None
14231423

0 commit comments

Comments
 (0)