nlcpy.venode.VENode
- class nlcpy.venode.VENode(int pid, int lid, int serial_id, bool phys, bool connect=True)
Class that represents VE node.
- Parameters
- pidint
Physical id.
- lidint
Logical id.
- serial_idint
Serial id of VE.
- physbool
Whether pass into the argument of veo_proc_create() for physical id or not.
- connect: bool
Whether call veo_proc_create() when calling constructor or not.
Note
The instance of this class can be retrieved from
nlcpy.venode.VE()
Methods
- __enter__(self)
- __exit__(self, *args)
- apply(self)
Sets this VE to current active VE and change a top of stacked VE ids to this id.
Note that combination usage of this method and with context manager shows different behaviours from
use()
.Examples
>>> import nlcpy >>> ve0 = nlcpy.venode.VE(0) >>> ve1 = nlcpy.venode.VE(1) >>> _ = ve1.apply() >>> # Current VE is 1. >>> with ve0: ... pass ... # Current VE is 0. ... # When exiting the context manager, the current VE is set a top of ... # stacked VE ids (In this case, the top is VE 1). >>> # Current VE is 1.
- connect(self)
Establish connection to VE.
- disconnect(self)
Disconnect to VE (NotImplemented yet).
- synchronize(self)
Synchronizes to this VE.
See also
nlcpy.request.flush
Flushes stacked requests on VH to specified VE.
- use(self)
Sets this VE to current active VE.
Note that combination usage of this method and with context manager is discouraged.
Examples
>>> import nlcpy >>> ve0 = nlcpy.venode.VE(0) >>> ve1 = nlcpy.venode.VE(1) >>> _ = ve1.use() >>> # Current VE is 1. >>> with ve0: ... pass ... # Current VE is 0. ... # When exiting the context manager, the current VE is set a top of ... # stacked VE ids (In this case, the top is VE 0). >>> # Current VE is 0.
- __eq__(value, /)
Return self==value.
- __ne__(value, /)
Return self!=value.
- __lt__(value, /)
Return self<value.
- __le__(value, /)
Return self<=value.
- __gt__(value, /)
Return self>value.
- __ge__(value, /)
Return self>=value.
Attributes
- arch
- connected
- ctx
- id
- lib
- lib_prof
- libpath
- lid
- meminfo
- ncore
- pid
- pool
- proc
- request_manager
- serial_id
- status
Gets the VE status.
Examples
>>> import nlcpy >>> from pprint import pprint >>> pprint(nlcpy.venode.VE(0).status) {'arch': 3, 'fast_math': False, 'lid': 0, 'main_mem_used': 5389680640, 'main_total_memsize': 103079215104, 'mempool_capacity': 1073741824, 'mempool_remainder': 1073741824, 'mempool_used': 0, 'ncore': 16, 'offload_timing': 'lazy', 'pid': 0, 'running_request_on_VE': 0, 'stacked_request_on_VH': 0}