nlcpy.venode.transfer_array

nlcpy.venode.transfer_array(ndarray src, VENode target_ve, ndarray dst=None)

Transfers N-dimension array to a specified target VE.

Parameters
srcndarray

Array on VE to be transferred.

target_ve: VENode

Target VE.

dstndarray, optional

Array on target VE that receives data from src. Note that this array must be on target_ve. If omit this argument, the new array is created on target VE. If specify this argument, the return array of this function is the same to dst.

Returns
outndarray

Array on target VE that is transferred from src.

Note

This function cannot yet transfer data directly between VEs, in other words, the data transfer between VEs has to go through VH. If you need to transfer large data, we recommend using mpi4py-ve .

Examples

>>> import nlcpy
>>> with nlcpy.venode.VE(0):
...     x_ve0 = nlcpy.arange(10)
>>> x_ve1 = nlcpy.venode.transfer_array(x_ve0, nlcpy.venode.VE(1))
>>> x_ve1
array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
>>> x_ve1.venode  
<VE node logical_id=1, physical_id=1>